示例#1
0
        private void btnMyTask_Click(object sender, EventArgs e)
        {
            //
            //string file = System.Windows.Forms.Application.ExecutablePath;
            //Configuration config = ConfigurationManager.OpenExeConfiguration(file);

            //ConfigurationManager.RefreshSection("appSettings");
            //string test;
            //try
            //{
            //    test = config.AppSettings.Settings["test"].Value;


            //}catch(Exception ee){
            //    test = ee.Message + "\n" + ee.StackTrace;
            //}
            //
            mySystem.Other.我的任务 f = new Other.我的任务();

            //f.set指令(test);
            //f.Show();
            String instru = receiveInstr();
            String msg    = SearchUnchecked();

            if (instru == null && msg.Equals(""))
            {
                MessageBox.Show("暂时没有新任务", "提示");
                return;
            }
            //if (instru == null)
            //{
            //    MessageBox.Show(msg, "提示");
            //}
            else
            {
                f.set指令(instru);
                f.set表单(msg);
                f.ShowDialog();
                //MessageBox.Show("请接收指令:\t " + instru + "\n\n" + msg, "提示");
                if (instru != null && instru.Contains("吹膜"))
                {
                    MainProduceBtn.PerformClick();
                    processForm.Btn吹膜.PerformClick();
                }
            }
        }
示例#2
0
        //退出登录按钮
        private void ExitBtn_Click(object sender, EventArgs e)
        {
            // 清空数据库中的token信息

            String            localUUID = Utility.getUUID();
            SqlDataAdapter    da        = new SqlDataAdapter("select * from users where 用户ID='" + mySystem.Parameter.userID + "'", Parameter.connUser);
            SqlCommandBuilder cb        = new SqlCommandBuilder(da);
            DataTable         dt        = new DataTable("user");

            da.Fill(dt);
            if (dt.Rows.Count >= 1)
            {
                String remoteUUID = dt.Rows[0]["token"].ToString();
                if (remoteUUID == localUUID)
                {
                    dt.Rows[0]["token"] = "";
                    da.Update(dt);
                }
            }

            // ---

            // 停止检查登陆状态
            timer2.Stop();
            timer2.Dispose();

            timer1.Stop();
            timer1.Dispose();
            this.Hide();
            foreach (Control control in MainPanel.Controls)
            {
                control.Dispose();
            }
            MainPanel.Controls.Clear();
            LoginForm login = new LoginForm(this);

            login.ShowDialog();
            // 接收指令

            mySystem.Other.我的任务 f = new Other.我的任务();

            //f.set指令(test);
            //f.Show();
            String instru = receiveInstr();

            if (instru != null)
            {
                f.set指令(instru);
                f.set表单("");
                f.ShowDialog();
            }
            //


            if (Parameter.userName != null)
            {
                userLabel.Text           = Parameter.userName;
                MainProduceBtn.BackColor = Color.FromName("Control");
                MainSettingBtn.BackColor = Color.FromName("Control");
                MainQueryBtn.BackColor   = Color.FromName("Control");
                this.Show();
                SearchUnchecked();
                timer1.Interval = interval;
                timer1.Start();
                timer2.Interval = timer2Interval;
                timer2.Start();
            }
            else
            {
                this.Close();
                Application.ExitThread();
            }
        }