/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (Config.Instance.TickerConfig.ShowTicker) { Ticker.HideTicker(); } if (disposing) { _navigationComboBoxGenerator.Dispose(); if (_mainMenuGenerator != null) { _mainMenuGenerator.Dispose(); _mainMenuGenerator = null; } if (_toolBarGenerator != null) { _toolBarGenerator.Dispose(); _toolBarGenerator = null; } StyleConfig.StyleChange -= OnStyleChanged; if (components != null) { components.Dispose(); } } base.Dispose(disposing); Config.Save(); }
public void ExecuteShowAppOptions(ICommandContext context) { var oldValue = Config.Instance.ForumDisplayConfig.ShowUnreadThreadsOnly; using (var of = new OptionsForm()) { var owner = context.GetRequiredService <IUIShell>().GetMainWindowParent(); var res = of.ShowDialog(owner); if ((of.ActionType & ChangeActionType.Refresh) == ChangeActionType.Refresh && res == DialogResult.OK) { if (oldValue != Config.Instance.ForumDisplayConfig.ShowUnreadThreadsOnly) { Forums.Instance.Refresh(); } Features.Instance.ConfigChanged(); if (Config.Instance.TickerConfig.ShowTicker) { Ticker.ShowTicker(context); } else { Ticker.HideTicker(); } context.GetRequiredService <IMainWindowService>().Refresh(); } if ((of.ActionType & ChangeActionType.Restart) == ChangeActionType.Restart && res == DialogResult.OK) { MessageBox.Show( owner, SR.MainForm.AppNeedRestart, ApplicationInfo.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }