コード例 #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
        //void showInfo()
        //{
        //    CustomUIControls.TaskbarNotifier taskbarNotifier1;
        //    taskbarNotifier1 = new CustomUIControls.TaskbarNotifier();
        //    taskbarNotifier1.SetBackgroundBitmap(new Bitmap(Image.FromFile(@"../../pic/skin_logo.bmp")), Color.FromArgb(255, 0, 255));
        //    taskbarNotifier1.SetCloseBitmap(new Bitmap(Image.FromFile(@"../../pic/close_logo.bmp")), Color.FromArgb(255, 0, 255), new Point(190, 12));
        //    taskbarNotifier1.TitleRectangle = new Rectangle(65, 25, 135, 60);
        //    taskbarNotifier1.ContentRectangle = new Rectangle(15, 65, 205, 150);
        //    taskbarNotifier1.CloseClickable = true;
        //    taskbarNotifier1.TitleClickable = false;
        //    taskbarNotifier1.ContentClickable = false;
        //    taskbarNotifier1.EnableSelectionRectangle = false;
        //    taskbarNotifier1.KeepVisibleOnMousOver = true;
        //    taskbarNotifier1.ReShowOnMouseOver = true;
        //    taskbarNotifier1.Show("提示", "正在连接服务器", 500, 2000, 500);
        //    System.Console.WriteLine("thread");
        //}


        public MainForm()
        {
            readSQLConfig();
            //Thread FormThread = new Thread(new ThreadStart(ThreadFunc));
            //FormThread.Start();

            //Parameter.InitConnUser(); //初始化连接到有用户表的数据库
            //Parameter.ConnUserInit();
            LoginForm login = new LoginForm(this);

            login.ShowDialog();



            InitializeComponent();
            userLabel.Text = Parameter.userName;
            InitTaskBar();
            //SearchUnchecked();


            // 接收指令
            mySystem.Other.我的任务 f = new Other.我的任务();

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

            if (instru != null)
            {
                f.set指令(instru);
                f.ShowDialog();
                if (instru != null && instru.Contains("吹膜"))
                {
                    MainProduceBtn.PerformClick();
                    processForm.Btn吹膜.PerformClick();
                }
            }



            check库存预警();
            timer1.Interval = interval;
            timer1.Start();

            // 检查登陆状态的定时器
            timer2.Interval = timer2Interval; // 一分钟
            timer2.Start();


            // 试用
            // 读取配置文件中的  sy
            // 如果没有,则写入日期:2017/11/11
            // 读取日期,看看是否到了
            //

            //
            string        file   = System.Windows.Forms.Application.ExecutablePath;
            Configuration config = ConfigurationManager.OpenExeConfiguration(file);


            ConfigurationManager.RefreshSection("appSettings");
            string name;

            try
            {
                name = config.AppSettings.Settings["sy"].Value;
            }
            catch (Exception ee)
            {
                DateTime dt = new DateTime(2017, 11, 11);
                name = dt.ToString("yyyy/MM/dd");
                config.AppSettings.Settings.Add("sy", name);
                config.Save(ConfigurationSaveMode.Modified);
                ConfigurationManager.RefreshSection("appSettings");
            }
            if (DateTime.Now > DateTime.Parse(name))
            {
                System.Threading.Thread.Sleep(5000);
                MessageBox.Show("数据库异常!");
                this.Close();
            }
        }