Summary description for OptionsForm.
Inheritance: System.Windows.Forms.Form
Ejemplo n.º 1
0
		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);
			}
		}
        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);
                }
            }
        }