コード例 #1
0
ファイル: MainForm.cs プロジェクト: huaminglee/yousoftbath
        //对话框载入
        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();
        }