private void btnSysConfig_Click(object sender, EventArgs e) { var dlg = new UI.Dialogs.ConfigCenter(); dlg.Shown += (ss, ee) => { dlg.SelectedConfig = dlg.FindConfigUI <UI.Controls.Option.NetworkConfig>().First(); }; dlg.ShowDialog(); Program.Restart(); }
void InitializeEvents() { st.TabItemClose += (s, e) => { var tab = e.Tab as UserTabDnb; if (tab != null) { e.Cancel = !MessageDialog.Question("确定要把放出来的账号【" + tab.Session.UserKeyData.DisplayName + "】残忍地关回小黑屋里?", true); if (!e.Cancel) { Session.OnLogout(tab.Session, LogoutReason.UserManually); e.Cancel = true; } } else if (e.Tab is SuperTabItem) { st.Tabs.Remove(e.Tab); st.Controls.Remove((e.Tab as SuperTabItem).AttachedControl); st.SelectedTabIndex = 0; } }; //状态统计 stuStatistics.DropDownOpening += (s, e) => { UpdateStatistics(); }; stuStatisticsQuery.DropDownOpening += (s, e) => UpdateQueryStatistics(); Shown += (s, e) => { var(isOpen, _) = ParamData.GetSystemMaintenanceTime(); if (ProgramConfiguration.Instance.AutoShowLoginDialog && isOpen && !st.Tabs.OfType <UserTabDnb>().Any()) { Login(); } }; //IP被封 var lastIpBlockTipTime = (DateTime?)null; TOBA.Events.IpBlocked += this.SafeInvoke((s, e) => { if (!ProgramConfiguration.Instance.ShowIPBlockTip) { return; } if (lastIpBlockTipTime != null && (DateTime.Now - lastIpBlockTipTime.Value).TotalMinutes <= 1) { return; } lastIpBlockTipTime = DateTime.Now; DesktopAlert.Show( "<b>检测到您的IP已经被12306封锁。</b>\n请重启路由器(拨号上网)\n或使用代理服务器(固定IP或局域网)。\n可能是其他人过于频繁刷票导致此问题的,揍丫的。", Properties.Resources.cou_32_warning, eDesktopAlertColor.Red, eAlertPosition.BottomRight, 30, 1L, _ => { var dlg = new UI.Dialogs.ConfigCenter(); dlg.Shown += (ss, ee) => { dlg.SelectedConfig = dlg.FindConfigUI <UI.Controls.Option.NetworkConfig>().First(); }; dlg.ShowDialog(); } ); }); }