public frmMain(bool isAutoRun = false) { _isAutoRun = isAutoRun; InitializeComponent(); System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false; OnIPRetriveProgress += new IPRetriveProgress(UpdateUIProgress); OnLogQueryStatus += new LogQueryStatus(frmMain_OnLogQueryStatus); OnIPScanProgress += new IPScanProgress(UpdateUIProgressForIPScan); try { top_lblCurrentIPRetrive_Click(null, null); SettingBiz biz = new SettingBiz(); myTimer.Tick += new EventHandler(TimerEventProcessor); myTimer.Interval = biz.GetSettings().ExecuteInterval * (1000 * 60 * 60); myTimer.Start(); if (isAutoRun) { SettingBiz settingBiz = new SettingBiz(); var settingData = settingBiz.GetSettings(); SendRequestToRetrieveIP(settingData.StartupRunTimes); } } catch { } }
private void RetriveHandleStatus(object obj) { try { if (obj != null) { ObjectEntity objEntity = obj as ObjectEntity; MonitorData data = objEntity.Data as MonitorData; frmMain mainForm = objEntity.UIControl as frmMain; MonitorBiz biz = new MonitorBiz(); var result = biz.RetriveClientIP(data); SettingBiz settingBiz = new SettingBiz(); var settingData = settingBiz.GetSettings(); // repeat run if (settingData.EnableMannulRun && settingData.MannulRequestServerTimes > 1) { for (int i = settingData.MannulRequestServerTimes; i > 1; i--) { result = biz.RetriveClientIP(data); } } _lastClientIPUID = result.UID; mainForm.p2_lbl_ip.Text = result.IP; mainForm.p2_lbl_ipbelongto.Text = String.Format("{0} {1} {2}", result.RealOperator, result.RealOperatorProvince, result.RealOperatorCity).Trim(); // public ip is displaying set 5% if (OnIPRetriveProgress != null) { OnIPRetriveProgress(5); } // trace route RouteTrace(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "错误"); } }
private void SetUIData() { var modReg = new ModifyRegistry(); string startKey = modReg.Read(Constants.Register_Key_Start); this.chkAutoRun.Checked = !String.IsNullOrEmpty(startKey); SettingBiz settingBiz = new SettingBiz(); var setData = settingBiz.GetSettings(); this.checkBox1.Checked = setData.EnableStartupRun; this.numericUpDown1.Value = setData.StartupRunTimes; this.checkBox2.Checked = setData.EnableAutoRun; this.numericUpDown2.Value = setData.ExecuteInterval; this.numericUpDown3.Value = setData.AutoRequestServerTimes; this.checkBox3.Checked = setData.EnableMannulRun; this.numericUpDown4.Value = setData.MannulRequestServerTimes; }
private static void TimerEventProcessor(Object myObject,EventArgs myEventArgs) { try { // execute ip check SettingBiz settingBiz = new SettingBiz(); var settingData = settingBiz.GetSettings(); // repeat run MonitorBiz monBiz = new MonitorBiz(); if (settingData.EnableMannulRun && settingData.MannulRequestServerTimes > 0) { SendRequestToRetrieveIP(settingData.MannulRequestServerTimes); } } catch { } }