Improve UI

This commit is contained in:
Ivan Stošić 2022-09-16 15:22:00 +02:00 committed by Ivan Stosic
parent 805b0692dc
commit 471cdf3fa1
6 changed files with 24 additions and 14 deletions

View File

@ -7,5 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel x:Name="stackPanel" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ScrollViewer>
<StackPanel x:Name="stackPanel" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</ScrollViewer>
</Window>

View File

@ -44,7 +44,7 @@ namespace winrt::FileLocksmithGUI::implementation
stackPanel().Children().Clear();
for (const auto& process : m_process_info)
{
ProcessEntry entry(process.name, process.pid);
ProcessEntry entry(process.name, process.pid, process.num_files);
stackPanel().Children().Append(entry);
}
}

View File

@ -3,6 +3,6 @@ namespace FileLocksmithGUI
[default_interface]
runtimeclass ProcessEntry : Microsoft.UI.Xaml.Controls.UserControl
{
ProcessEntry(String process, Int32 pid);
ProcessEntry(String process, UInt32 pid, UInt64 num_files);
}
}

View File

@ -5,15 +5,21 @@
xmlns:local="using:FileLocksmithGUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="80"
d:DesignWidth="480">
mc:Ignorable="d">
<StackPanel Orientation="Horizontal">
<BitmapIcon Name="processIcon"></BitmapIcon>
<StackPanel Orientation="Vertical">
<TextBlock Margin="4" FontSize="24" Name="processName"/>
<TextBlock Margin="4" FontSize="10" Name="processPid"/>
<TextBlock Margin="4" FontSize="28" Name="processName"/>
<Grid Width="400">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Margin="4" FontSize="12" Name="processPid" HorizontalAlignment="Left"/>
<TextBlock Grid.Column="1" Margin="4" FontSize="12" Name="processFileCount" HorizontalAlignment="Center"/>
</Grid>
</StackPanel>
<Button Click="killProcessClick">Kill process</Button>
</StackPanel>

View File

@ -12,11 +12,16 @@ using namespace Microsoft::UI::Xaml;
namespace winrt::FileLocksmithGUI::implementation
{
ProcessEntry::ProcessEntry(const winrt::hstring& process, int pid)
ProcessEntry::ProcessEntry(const winrt::hstring& process, DWORD pid, uint64_t num_files)
{
InitializeComponent();
processName().Text(process);
processPid().Text(winrt::to_hstring(pid));
auto processPidStr = L"Process ID: " + std::to_wstring(pid);
auto processFileCountStr = L"Files used: " + std::to_wstring(num_files);
processPid().Text(processPidStr);
processFileCount().Text(processFileCountStr);
}
void ProcessEntry::killProcessClick(Windows::Foundation::IInspectable const&, RoutedEventArgs const&)
@ -24,6 +29,3 @@ namespace winrt::FileLocksmithGUI::implementation
MessageBoxW(NULL, L"Kill process", L"OK", MB_OK);
}
}

View File

@ -9,7 +9,7 @@ namespace winrt::FileLocksmithGUI::implementation
{
struct ProcessEntry : ProcessEntryT<ProcessEntry>
{
ProcessEntry(const winrt::hstring& process, int pid);
ProcessEntry(const winrt::hstring& process, DWORD pid, uint64_t num_files);
void killProcessClick(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
};
}