public void AddAndRemoveStartupTest()
 {
     StartUpManager.AddApplicationToCurrentUserStartup();
     StartUpManager.IsApplicationAddedToCurrentUserStartup().Should().BeTrue();
     StartUpManager.RemoveApplicationFromCurrentUserStartup();
     StartUpManager.IsApplicationAddedToCurrentUserStartup().Should().BeFalse();
 }
        private void LoadSettings()
        {
            try
            {
                var json = File.ReadAllText(Settings.SettingsPath);
                AppSettings = JsonConvert.DeserializeObject <Settings>(json);
            }
            catch (Exception)
            {
                AppSettings = null;
            }

            AppSettings ??= new Settings
            {
                AlwaysOnTopEnabled = false,
                AutoSaveEnabled    = false,
                AutoStartEnabled   = StartUpManager.IsApplicationAddedToCurrentUserStartup(),
                CurrentFilePath    = null
            };

            AppSettings.Height = AppSettings.Height > 0 ? AppSettings.Height : 300;
            AppSettings.Width  = AppSettings.Width > 0 ? AppSettings.Width : 220;

            Height = AppSettings.Height;
            Width  = AppSettings.Width;

            Topmost = AppSettings.AlwaysOnTopEnabled;
            AlwaysOnTopMenuItem.IsChecked = AppSettings.AlwaysOnTopEnabled;

            if (!string.IsNullOrWhiteSpace(AppSettings.CurrentFilePath))
            {
                LoadFile(AppSettings.CurrentFilePath, true);
            }

            AutoStartMenuItem.IsChecked = AppSettings.AutoStartEnabled;
            AutoSaveMenuItem.IsChecked  = AppSettings.AutoSaveEnabled;

            ApplyAutoStart(AppSettings.AutoStartEnabled);
        }