diff --git a/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.idl b/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.idl index c0cdbfce3b..506ff7ca02 100644 --- a/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.idl +++ b/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.idl @@ -4,5 +4,6 @@ namespace FileLocksmithGUI runtimeclass MainWindow : Microsoft.UI.Xaml.Window { MainWindow(); + void DisplayNoResultsInfo(); } } diff --git a/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.cpp b/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.cpp index 1e0ba2784f..77f6ce3ef1 100644 --- a/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.cpp +++ b/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.cpp @@ -32,11 +32,17 @@ namespace winrt::FileLocksmithGUI::implementation // TODO move to another thread stackPanel().Children().Clear(); + for (const auto& process : m_process_info) { ProcessEntry entry(process.name, process.pid, process.num_files); stackPanel().Children().Append(entry); } + + if (m_process_info.empty()) + { + DisplayNoResultsInfo(); + } } void MainWindow::place_and_resize() @@ -81,4 +87,14 @@ namespace winrt::FileLocksmithGUI::implementation app_window.MoveAndResize(rect); } + + void MainWindow::DisplayNoResultsInfo() + { + // Construct the UI element and display it + Controls::TextBlock text; + text.Text(L"No results."); + text.HorizontalAlignment(HorizontalAlignment::Center); + text.VerticalAlignment(VerticalAlignment::Center); + stackPanel().Children().Append(text); + } } diff --git a/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.h b/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.h index a4329f4d16..49f9b2a4df 100644 --- a/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.h +++ b/src/modules/FileLocksmith/FileLocksmithGUI/MainWindow.xaml.h @@ -8,7 +8,7 @@ namespace winrt::FileLocksmithGUI::implementation struct MainWindow : MainWindowT { MainWindow(); - + void DisplayNoResultsInfo(); private: std::vector m_process_info; void find_processes(); diff --git a/src/modules/FileLocksmith/FileLocksmithGUI/ProcessEntry.xaml.cpp b/src/modules/FileLocksmith/FileLocksmithGUI/ProcessEntry.xaml.cpp index 2747d2f00c..8eb00f49ac 100644 --- a/src/modules/FileLocksmith/FileLocksmithGUI/ProcessEntry.xaml.cpp +++ b/src/modules/FileLocksmith/FileLocksmithGUI/ProcessEntry.xaml.cpp @@ -42,5 +42,11 @@ namespace winrt::FileLocksmithGUI::implementation { siblings.RemoveAt(index); } + + if (siblings.Size() == 0) + { + auto main_window = Parent().as().Parent().as(); + main_window.DisplayNoResultsInfo(); + } } }