void Init() { tsModePre.ForeColor = _colors[RunningMode.PreSell]; tsModeLeak.ForeColor = _colors[RunningMode.CatchLeak]; tsModePro.ForeColor = _colors[RunningMode.Professional]; RefreshMode(); void HandleChangeSleep(object sender, EventArgs e) { var time = (int)((ToolStripMenuItem)sender).Tag; QueryConfiguration.Current.QuerySleep = time; } for (int i = 1; i <= 15; i++) { var item = new ToolStripMenuItem($"{i}秒") { Tag = i }; item.Click += HandleChangeSleep; DropDownItems.Add(item); } QueryConfiguration.Current.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(QueryConfiguration.QuerySleep)) { RefreshText(); } if (e.PropertyName == nameof(QueryConfiguration.StopQueryWhenFoundTicket)) { tsAutoStopOther.Checked = QueryConfiguration.Current.StopQueryWhenFoundTicket; } }; ProgramConfiguration.Instance.ModeChanged += (s, e) => { RefreshMode(); }; tsAutoStopOther.Checked = QueryConfiguration.Current.StopQueryWhenFoundTicket; tsAutoStopOther.Click += (_1, _2) => { QueryConfiguration.Current.StopQueryWhenFoundTicket = !QueryConfiguration.Current.StopQueryWhenFoundTicket; }; tsModeLeak.Click += (_1, _2) => ConfigurationPresets.Apply(RunningMode.CatchLeak); tsModePre.Click += (_1, _2) => ConfigurationPresets.Apply(RunningMode.PreSell); tsModePro.Click += (_1, _2) => ConfigurationPresets.Apply(RunningMode.Professional); }
public ConfigCenter() { InitializeComponent(); var isPro = RunTime.IsInProfessonalMode; AddOption(new GenericOption()); AddOption(new ThemeConfig()); AddOption(new UIConfig()); AddOption(new MediaOption()); if (isPro) { AddOption(new QueryConfig()); AddOption(new QueryView()); AddOption(new SubmitOrderConfig()); AddOption(new SubmitAutoResumeConfig()); } AddOption(new NetworkConfig()); AddOption(new FuncOption()); AddOption(new MailConfig()); if (isPro) { AddOption(new WebNotificationConfig()); } //AddOption(new PromotionOption()); AddOption(new VcConfig()); var ce = new GeneralEventArgs <List <AbstractOptionConfigUI> >(new List <AbstractOptionConfigUI>()); UiEvents.OnGenerateOptionsTabs(this, ce); ce.Data.ForEach(AddOption); cbMode.SelectedIndex = (int)ProgramConfiguration.Instance.Mode; cbMode.SelectedIndexChanged += (_1, _2) => { var mode = (RunningMode)cbMode.SelectedIndex; ConfigurationPresets.Apply(mode); lblModeChanged.Visible = true; }; }