private void txtbox_ContChange_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (MessageClass.sqlconnect)
     {
         if (MessageClass.PCNum == "")
         {
             SettingWindow win = new SettingWindow();
             win.ShowDialog();
         }
     }
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = recorde;
            BindComBox();
            MessageClass.canclose = false;

            //撤销Windows热键,防止alt+F4关闭软件
            hook.Hook_Clear();
            hook.Dispose();
            hook.Hook_Start();
            //this.Topmost = true;


            if (!SqlHelper.OpenConnection())
            {
                MessageClass.sqlconnect = false;
            }
            else
            {
                MessageClass.sqlconnect = true;;

                DateTime webtime = Convert.ToDateTime(SqlHelper.ExecuteScalar("select now()").ToString());
                timediff = webtime - DateTime.Now;
                if (!MessageClass.CheckMacFromSql())//若数据库中没有本台电脑的MAC地址记录
                {
                    SettingWindow win = new SettingWindow();
                    if (win.ShowDialog() != null)
                    {
                    }
                }
                SqlHelper.ExecuteNonQuery("update t_pcmessage set PCM_NowState=1 where PCM_Num='" + MessageClass.PCNum + "'");
            }
            mythread = new Thread(new ParameterizedThreadStart(ThreadTest));
            mythread.IsBackground = true;
            mythread.Start();
        }
        private void bt_setting_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            SettingWindow setwin = new SettingWindow("pudate");

            setwin.ShowDialog();
        }