Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            ClientInit();
            PathInit();
            string sLasttime = MyIni.ReadIniData("Time", "Last", "0", Path_Ini);

            int.TryParse(sLasttime, out nLastTime);
            var strTime = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0);

            nNowTime = (int)strTime.TotalSeconds;
            int cha     = nNowTime - nLastTime;
            var nowTime = new DateTime(1970, 1, 1, 8, 0, 0).AddSeconds(cha);//时间戳转时间

            //lab_mes.Text = nLastTime + "; " + nNowTime+"; "+ nowTime.ToString();
            //lab_mes.Text = "LastTime:"+ sLasttime + " 时间差:" + cha + "; " + nowTime.ToString();
            //showMes("LastTime:" + sLasttime + " 时间差:" + cha + "; " + nowTime.ToString());
            txt_PM.Hide();
            if (cha > 50)
            {
                isFirst = true;
                //背景图设置
                pictureBox1.Image = Image.FromFile(Path_Project + @"\NoClose\Properties\bg\background1.jpg");//Image.FromFile(Path_Project + @"\NoClose\Properties\bg\background1.jpg");
                btn_disagree.Hide();
                btn_agree.Hide();
            }
            else
            {
                isCGOver = true;
                showMes(donotit);
                isFirst           = false;
                pictureBox1.Image = Image.FromFile(Path_Project + @"\NoClose\Properties\chat\ALiChat_2.png");//Image.FromFile(Path_Project + @"\NoClose\Properties\bg\background1.jpg");
            }
            if (!isFirst)
            {
                isBegin = true;
            }



            ////采用双缓冲技术的控件必需的设置
            //SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
            //监听
            FormClosing            += new FormClosingEventHandler(form1_FormClosed); //重启监听
            pictureBox1.MouseMove  += new MouseEventHandler(Form1_MouseMove);        //画面点击
            pictureBox1.MouseDown  += new MouseEventHandler(pictureBox1_MouseDown);  //鼠标移动
            btn_agree.MouseUp      += new MouseEventHandler(Btnagree_MouseUp);
            btn_agree.MouseDown    += new MouseEventHandler(Btnagree_MouseDown);
            btn_disagree.MouseMove += new MouseEventHandler(BtnDisagree_MouseMove); //危险,选中不同意
            KeyDown += new KeyEventHandler(Form1_KeyDown);                          //回车键
            //加载图片
            Init_Image();

            Thread mesThread = new Thread(Mes);

            mesThread.Start();
        }
Ejemplo n.º 2
0
 private void form1_FormClosed(object sender, FormClosingEventArgs e)
 {
     MyIni.WriteIniData("Time", "Last", nNowTime.ToString(), Path_Ini);
     if (!isOver)
     {
         reStart();
     }
     else
     {
         System.Environment.Exit(0);
     }
 }
Ejemplo n.º 3
0
        //private void MyThread_showMesg() {
        //    throw new NotImplementedException();
        //}

        /// <summary>
        /// 路径获取
        /// </summary>
        private void PathInit()
        {
            Path_Client      = MyIni.ReadIniData("Path", "Client", "", Path_Ini);
            Path_Project     = MyIni.ReadIniData("Path", "Project", "", Path_Ini);
            Path_VBS_restart = MyIni.ReadIniData("Path", "ReStar", "", Path_Ini);
        }