Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
airtaxi committed Oct 7, 2023
1 parent 535e076 commit 33ac79b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
3 changes: 1 addition & 2 deletions PinStats/ReportWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public enum DWM_WINDOW_CORNER_PREFERENCE
private static partial int DwmSetWindowAttribute(IntPtr hwnd, uint dwAttribute, ref uint pvAttribute, uint cbAttribute);

public readonly static CpuUsageViewModel CpuUsageViewModel = new();

public ReportWindow()
{
InitializeComponent();
Expand All @@ -39,7 +38,7 @@ public ReportWindow()
DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, ref attribute, sizeof(uint));

Activated += OnActivated;
CpuUsageViewModel.InitializeSync(); // Renew the "sync" of the CpuUsageViewModel to prevent the chart from not being properly displayed.
CpuUsageViewModel.RefreshSync(); // Renew the "sync" of the CpuUsageViewModel to prevent the chart from not being properly displayed.
CartesianChartCpuUsage.DataContext = CpuUsageViewModel;
}

Expand Down
5 changes: 1 addition & 4 deletions PinStats/Resources/CpuUsageResources.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ private void OnCpuTaskbarIconLeftClicked(XamlUICommand sender, ExecuteRequestedE
reportWindow.BringToFront();
}

private void OnCloseProgramMenuFlyoutItemClicked(XamlUICommand sender, ExecuteRequestedEventArgs args)
{
Environment.Exit(0);
}
private void OnCloseProgramMenuFlyoutItemClicked(XamlUICommand sender, ExecuteRequestedEventArgs args) => Environment.Exit(0);

private void OnSetupStartupProgramMenuFlyoutItemClicked(XamlUICommand sender, ExecuteRequestedEventArgs args)
{
Expand Down
2 changes: 1 addition & 1 deletion PinStats/ViewModels/CpuUsageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public CpuUsageViewModel()
};
}

public void InitializeSync() => Sync = new object();
public void RefreshSync() => Sync = new object();

private double[] GetSeparators()
{
Expand Down

0 comments on commit 33ac79b

Please sign in to comment.