mirror of
https://github.com/ckaczor/ProcessCpuUsageStatusWindow.git
synced 2026-03-11 19:49:11 -04:00
Modernize project
This commit is contained in:
68
App.xaml.cs
68
App.xaml.cs
@@ -1,48 +1,38 @@
|
||||
using FloatingStatusWindowLibrary;
|
||||
using ProcessCpuUsageStatusWindow.Properties;
|
||||
using Squirrel;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using ChrisKaczor.Wpf.Windows.FloatingStatusWindow;
|
||||
using ProcessCpuUsageStatusWindow.Properties;
|
||||
|
||||
namespace ProcessCpuUsageStatusWindow
|
||||
namespace ProcessCpuUsageStatusWindow;
|
||||
|
||||
public partial class App
|
||||
{
|
||||
public partial class App
|
||||
private List<IDisposable> _windowSourceList;
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
private WindowSource _windowSource;
|
||||
base.OnStartup(e);
|
||||
|
||||
public static string UpdateUrl = "https://github.com/ckaczor/ProcessCpuUsageStatusWindow";
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
StartManager.ManageAutoStart = true;
|
||||
StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart;
|
||||
StartManager.AutoStartChanged += (value =>
|
||||
{
|
||||
SquirrelAwareApp.HandleEvents(onAppUpdate: version => Common.Settings.Extensions.RestoreSettings());
|
||||
Settings.Default.AutoStart = value;
|
||||
Settings.Default.Save();
|
||||
});
|
||||
|
||||
var application = new App();
|
||||
application.InitializeComponent();
|
||||
application.Run();
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
|
||||
StartManager.ManageAutoStart = true;
|
||||
StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart;
|
||||
StartManager.AutoStartChanged += value =>
|
||||
{
|
||||
Settings.Default.AutoStart = value;
|
||||
Settings.Default.Save();
|
||||
};
|
||||
|
||||
_windowSource = new WindowSource();
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
_windowSource.Dispose();
|
||||
|
||||
base.OnExit(e);
|
||||
}
|
||||
_windowSourceList =
|
||||
[
|
||||
new WindowSource()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
_windowSourceList.ForEach(ws => ws.Dispose());
|
||||
|
||||
base.OnExit(e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user