mirror of
https://github.com/ckaczor/ProcessCpuUsageStatusWindow.git
synced 2026-01-14 01:25:41 -05:00
Add settings window
This commit is contained in:
42
Options/GeneralOptionsPanel.xaml.cs
Normal file
42
Options/GeneralOptionsPanel.xaml.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Common.Wpf.Extensions;
|
||||
using System.Windows;
|
||||
|
||||
namespace ProcessCpuUsageStatusWindow.Options
|
||||
{
|
||||
public partial class GeneralOptionsPanel
|
||||
{
|
||||
public GeneralOptionsPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override void LoadPanel(object data)
|
||||
{
|
||||
base.LoadPanel(data);
|
||||
|
||||
var settings = Properties.Settings.Default;
|
||||
|
||||
StartWithWindows.IsChecked = settings.AutoStart;
|
||||
NumberOfProcesses.Text = settings.ProcessCount.ToString();
|
||||
}
|
||||
|
||||
public override bool ValidatePanel()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void SavePanel()
|
||||
{
|
||||
var settings = Properties.Settings.Default;
|
||||
|
||||
if (StartWithWindows.IsChecked.HasValue && settings.AutoStart != StartWithWindows.IsChecked.Value)
|
||||
settings.AutoStart = StartWithWindows.IsChecked.Value;
|
||||
|
||||
settings.ProcessCount = int.Parse(NumberOfProcesses.Text);
|
||||
|
||||
Application.Current.SetStartWithWindows(settings.AutoStart);
|
||||
}
|
||||
|
||||
public override string CategoryName => Properties.Resources.OptionCategory_General;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user