private void CustomInitializeComponent() { Text = GetCaption(); Bounds = Config.Instance.MainFormBounds.Bounds; if (Config.Instance.MainFormBounds.Maximized) { WindowState = FormWindowState.Maximized; } var userShortcuts = Config.Instance.XmlShortcuts; if (userShortcuts != null) { _shortcutManager.LoadFromXmlNode(userShortcuts); } ConfigureUI(); // Стили StyleConfig.StyleChange += OnStyleChanged; UpdateStyle(); if (Config.Instance.TickerConfig.ShowTicker) { Ticker.ShowTicker(_serviceProvider); } Application.AddMessageFilter(new WheelDispatcher()); Config.Instance.ConfigChanged += (sender, e) => ConfigureUI(); }
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); } } }