private void ApplySettings() { if (chAutoStart.Checked) { AutostartUtil.SetAutoStart(); } else { AutostartUtil.UnSetAutoStart(); } TaskbarProperties.ChangedFields changes = TaskbarProperties.ChangedFields.None; TaskbarPropertiesManager.Instance.Properties.ShowLabels = chShowLabels.Checked; TaskbarPropertiesManager.Instance.Properties.ShowClock = chShowClock.Checked; TaskbarPropertiesManager.Instance.Properties.SmallIcons = chSmallIcons.Checked; if (TaskbarPropertiesManager.Instance.Properties.AutoHide != chAutoHide.Checked) { changes |= TaskbarProperties.ChangedFields.AutoHide; TaskbarPropertiesManager.Instance.Properties.AutoHide = chAutoHide.Checked; } TaskbarPropertiesManager.Instance.Properties.AutoHideDelay = (int)nudAutohideDelay.Value; TaskbarPropertiesManager.Instance.Properties.ShowNotificationArea = chNotif.Checked; TaskbarPropertiesManager.Instance.Properties.ShowStartMenu = chStart.Checked; TaskbarPropertiesManager.Instance.Properties.CheckForUpdates = chCheckForUpdates.Checked; TaskbarPropertiesManager.Instance.Properties.UseCustomFont = chCustomFont.Checked; foreach (var control in panelLocations.Controls) { var cmb = control as ComboBox; if (cmb == null) { continue; } var deviceName = cmb.Tag as string; TaskbarPropertiesManager.Instance.Properties.SetTaskbarLocation(deviceName, ScreenLocationFromIndex(cmb.SelectedIndex)); } if (TaskbarPropertiesManager.Instance.Properties.MirrorButtons != chMirrorButtons.Checked) { changes |= TaskbarProperties.ChangedFields.MirrorButtons; TaskbarPropertiesManager.Instance.Properties.MirrorButtons = chMirrorButtons.Checked; } if (_ruleManager != null) { TaskbarPropertiesManager.Instance.Properties.Rules.Clear(); List <DualMonitor.Entities.Rule> rules = RuleManager.Clone(_ruleManager.GetRules()); TaskbarPropertiesManager.Instance.Properties.Rules.AddRange(rules); } TaskbarPropertiesManager.Instance.Save(); if (OnChanged != null) { OnChanged(changes); } }
private void CreateNewRuleManager() { List <DualMonitor.Entities.Rule> rules = RuleManager.Clone(TaskbarPropertiesManager.Instance.Properties.Rules); _ruleManager = new RuleManager(rules, null); lbRules.Items.Clear(); foreach (Rule r in _ruleManager.GetRules()) { lbRules.Items.Add(r); } }