mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-04 03:49:07 +08:00
Show something when there are no results
This commit is contained in:
parent
9293c8c395
commit
13ff89c5f9
@ -4,5 +4,6 @@ namespace FileLocksmithGUI
|
||||
runtimeclass MainWindow : Microsoft.UI.Xaml.Window
|
||||
{
|
||||
MainWindow();
|
||||
void DisplayNoResultsInfo();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace winrt::FileLocksmithGUI::implementation
|
||||
struct MainWindow : MainWindowT<MainWindow>
|
||||
{
|
||||
MainWindow();
|
||||
|
||||
void DisplayNoResultsInfo();
|
||||
private:
|
||||
std::vector<ProcessResult> m_process_info;
|
||||
void find_processes();
|
||||
|
@ -42,5 +42,11 @@ namespace winrt::FileLocksmithGUI::implementation
|
||||
{
|
||||
siblings.RemoveAt(index);
|
||||
}
|
||||
|
||||
if (siblings.Size() == 0)
|
||||
{
|
||||
auto main_window = Parent().as<Controls::StackPanel>().Parent().as<MainWindow>();
|
||||
main_window.DisplayNoResultsInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user