diff --git a/ObservatoryCore/PluginManagement/PluginEventHandler.cs b/ObservatoryCore/PluginManagement/PluginEventHandler.cs index b273bde..8542135 100644 --- a/ObservatoryCore/PluginManagement/PluginEventHandler.cs +++ b/ObservatoryCore/PluginManagement/PluginEventHandler.cs @@ -4,8 +4,6 @@ using Observatory.Framework.Files; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Observatory.Framework.Files.Journal; namespace Observatory.PluginManagement diff --git a/ObservatoryCore/Properties/Core.Designer.cs b/ObservatoryCore/Properties/Core.Designer.cs index e45a7d1..2c23cae 100644 --- a/ObservatoryCore/Properties/Core.Designer.cs +++ b/ObservatoryCore/Properties/Core.Designer.cs @@ -238,5 +238,17 @@ namespace Observatory.Properties { this["NativeNotifyTimeout"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool StartMonitor { + get { + return ((bool)(this["StartMonitor"])); + } + set { + this["StartMonitor"] = value; + } + } } } diff --git a/ObservatoryCore/Properties/Core.settings b/ObservatoryCore/Properties/Core.settings index 52f6786..60f2d28 100644 --- a/ObservatoryCore/Properties/Core.settings +++ b/ObservatoryCore/Properties/Core.settings @@ -56,5 +56,8 @@ 8000 + + False + \ No newline at end of file diff --git a/ObservatoryCore/UI/ViewModels/CoreViewModel.cs b/ObservatoryCore/UI/ViewModels/CoreViewModel.cs index 9521e9a..66c54ec 100644 --- a/ObservatoryCore/UI/ViewModels/CoreViewModel.cs +++ b/ObservatoryCore/UI/ViewModels/CoreViewModel.cs @@ -56,6 +56,11 @@ namespace Observatory.UI.ViewModels tabs.Add(new CoreModel() { Name = "Core", UI = new BasicUIViewModel(new ObservableCollection()) { UIType = Framework.PluginUI.UIType.Core } }); + if (Properties.Core.Default.StartMonitor) + { + ToggleMonitor(); + } + } public void ReadAll() diff --git a/ObservatoryCore/UI/Views/BasicUIView.axaml.cs b/ObservatoryCore/UI/Views/BasicUIView.axaml.cs index 8ea7c2f..7e5387f 100644 --- a/ObservatoryCore/UI/Views/BasicUIView.axaml.cs +++ b/ObservatoryCore/UI/Views/BasicUIView.axaml.cs @@ -655,7 +655,24 @@ namespace Observatory.UI.Views Properties.Core.Default.Save(); }; - + #endregion + + #region Monitor On Launch + + TextBlock startMonitorLabel = new() { Text = "Start monitor on Observatory launch" }; + CheckBox startMonitorCheckbox = new() { IsChecked = Properties.Core.Default.StartMonitor, Content = startMonitorLabel }; + + startMonitorCheckbox.Checked += (object sender, RoutedEventArgs e) => + { + Properties.Core.Default.StartMonitor = true; + Properties.Core.Default.Save(); + }; + + startMonitorCheckbox.Unchecked += (object sender, RoutedEventArgs e) => + { + Properties.Core.Default.StartMonitor = false; + Properties.Core.Default.Save(); + }; #endregion @@ -726,6 +743,7 @@ namespace Observatory.UI.Views #endregion gridManager.AddSetting(primeSystemContexCheckbox); + gridManager.AddSetting(startMonitorCheckbox); gridManager.AddSettingWithLabel(journalPathLabel, journalPath); gridManager.AddSetting(journalBrowse);