//对话框载入 private void Form1_Load(object sender, EventArgs e) { connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP); if (connectionIP == "") { PCListForm pCListForm = new PCListForm(); if (pCListForm.ShowDialog() != DialogResult.OK) { this.Close(); return; } connectionIP = pCListForm.ip; IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP); } dao = new DAO(connectionString); if (!dao.check_net()) { BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!"); this.Close(); return; } _options = dao.get_options(); m_company = _options.companyName; print_tech_msg = MConvert<bool>.ToTypeOrDefault(options.打印技师派遣单, false); user_card = MConvert<bool>.ToTypeOrDefault(options.启用员工服务卡, false); IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName()); foreach (var ip in ipe.AddressList) { m_ip = ip.ToString(); if (System.Text.RegularExpressions.Regex.IsMatch(m_ip, "[0-9]{1,3}//.[0-9]{1,3}//.[0-9]{1,3}//.[0-9]{1,3}")) break; } setMax(); //dgv.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 20); //dgv.RowsDefaultCellStyle.Font = new Font("宋体", 20); //dgv_show(); m_thread = new Thread(new ThreadStart(detect_msg)); m_thread.IsBackground = true; m_thread.Start(); m_thread_tech = new Thread(new ThreadStart(detect_tech_index)); m_thread_tech.IsBackground = true; m_thread_tech.Start(); clock_timer = new System.Timers.Timer(); clock_timer.Interval = 1000; clock_timer.Elapsed += new System.Timers.ElapsedEventHandler(clock_timer_Elapsed); clock_timer.Enabled = true; m_player = new SoundPlayer(); techId.Focus(); m_thread_clearMemory = new Thread(new ThreadStart(clear_Memory)); m_thread_clearMemory.IsBackground = true; m_thread_clearMemory.Start(); SplitGender.SplitterDistance = SplitGender.Width*2 / 3; create_tech_panel(); }
private void MainWindow_Load(object sender, EventArgs e) { connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP); if (connectionIP == "") { PCListForm pCListForm = new PCListForm(); if (pCListForm.ShowDialog() != DialogResult.OK) { this.Close(); return; } connectionIP = pCListForm.ip; IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP); } db = new BathDBDataContext(connectionString); if (!db.DatabaseExists()) { GeneralClass.printErrorMsg("连接IP不对或者网络不通,请重试!"); connectionIP = ""; IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP); this.Close(); return; } dir = IOUtil.get_config_by_key(ConfigKeys.KEY_VIDEO_SAVE_DIR); if (dir == "") set_dir(); if (dir == "") { this.Close(); return; } if (!dir.EndsWith("\\")) dir += "\\"; serverIp.Text = connectionIP; cacheDir.Text = dir; string pvs = IOUtil.get_config_by_key(ConfigKeys.KEY_VIDEO_TIMESPAN); if (pvs != "") { seconds.Text = pvs; ts = TimeSpan.Parse("00:00:" + pvs); } else { pvs = "30"; seconds.Text = pvs; ts = TimeSpan.Parse("00:00:" + pvs); IOUtil.set_config_by_key(ConfigKeys.KEY_VIDEO_TIMESPAN, pvs); } db.PayMsg.DeleteAllOnSubmit(db.PayMsg.ToArray()); db.SubmitChanges(); video = new cVideo(panel1.Handle, panel1.Width, panel1.Height); if (video.StartWebCam()) { video.get(); video.Capparms.fYield = true; video.Capparms.fAbortLeftMouse = false; video.Capparms.fAbortRightMouse = false; video.Capparms.fCaptureAudio = false; video.Capparms.dwRequestMicroSecPerFrame = 0x9C40; // 设定帧率25fps: 1*1000000/25 = 0x9C40 video.set(); } watch_Timer = new System.Timers.Timer(100); watch_Timer.Elapsed += new ElapsedEventHandler(watch_Timer_Elapsed); watch_Timer.Start(); watch_Timer.Enabled = true; }
//对话框载入 private void LogIn_Load(object sender, EventArgs e) { connectionIP = BathClass.get_config_by_key("connectionIP"); if (connectionIP == "") { PCListForm pCListForm = new PCListForm(); if (pCListForm.ShowDialog() != DialogResult.OK) { this.Close(); return; } connectionIP = pCListForm.ip; BathClass.set_config_by_key("connectionIP", connectionIP); } db = new BathDBDataContext(connectionString); if (!db.DatabaseExists()) { BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!"); connectionIP = ""; BathClass.set_config_by_key("connectionIP", connectionIP); this.Close(); return; } if (!RegisterForm.registered()) hasRegistered = false; if (hasRegistered) register.Visible = false; else if (!hasRegistered && !checkTrialTimes()) okBtn.Enabled = false; read_users(); id.Items.AddRange(idList.ToArray()); if (id.Items.Count != 0) id.Text = id.Items[0].ToString(); }
//对话框载入 private void OrderMainForm_Load(object sender, EventArgs e) { connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP); if (connectionIP == "") { PCListForm pCListForm = new PCListForm(); if (pCListForm.ShowDialog() != DialogResult.OK) { this.Close(); return; } connectionIP = pCListForm.ip; IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP); } db = new BathDBDataContext(connectionString); if (!db.DatabaseExists()) { BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!"); connectionIP = ""; IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP); this.Close(); return; } }
//对话框载入 private void OrderMainForm_Load(object sender, EventArgs e) { read_connection_IP(); if (connectionIP == "") { PCListForm pCListForm = new PCListForm(); if (pCListForm.ShowDialog() != DialogResult.OK) { this.Close(); return; } connectionIP = pCListForm.ip; write_connection_IP(); } var db = new BathDBDataContext(connectionString); if (!db.DatabaseExists()) { BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!"); PCListForm pCListForm = new PCListForm(); if (pCListForm.ShowDialog() != DialogResult.OK) { this.Close(); return; } } }