Exemple #1
0
        private void Btn_ParSave_Click(object sender, EventArgs e)
        {
            if (CheeckPar() == false)
            {
                Par_Normal("Read");
                FileLog.OperateLog("保存参数按钮,失败");
                return;
            }

            Par_Normal("Write");
            FileLog.OperateLog("保存参数按钮,成功");
            TableLayoutPanel1.Enabled = false;
            TableLayoutPanel3.Enabled = false;
            TableLayoutPanel4.Enabled = false;
            Par_Normal("Read");
            FunctionSub.Init_Serial1(); //重新加载串口
            FunctionSub.Init_Serial2(); //重新加载串口
            FunctionSub.Init_Serial3(); //重新加载串口

            if (Interaction.MsgBox("参数保存OK!", Constants.vbOKOnly, "提示") == Constants.vbOK)
            {
                return;
            }
        }
Exemple #2
0
 private void Button3_Click(object sender, EventArgs e)
 {
     Mod_ErrorCode.WriteCsvErrorCodeOK();
     FileLog.OperateLog("ErrorCode OK");
 }
Exemple #3
0
        private void Btn_UpadeSoft_Click(object sender, EventArgs e)
        {
            string Timestr = "";
            string Filestr = "";

            Btn_UpadeSoft.Enabled = false;
            Btn_UpadeSoft.Text    = "网络链接中";
            FileLog.OperateLog("Mini下载软件");
            try
            {
                Frm_Engineering.fEngineering.Tcp_PDCA.StopConnect(); //关闭PDCA
                WinAPI.Wait(100);
                if (Frm_Engineering.fEngineering.Tcp_PDCA.IsStart == false)
                {
                    Frm_Engineering.fEngineering.Tcp_PDCA.StartConnect(); //PDCA网络链接
                    WinAPI.Wait(2000);
                }

                if (Frm_Engineering.fEngineering.Tcp_PDCA.IsStart == false)
                {
                    Btn_UpadeSoft.Enabled = true;
                    Btn_UpadeSoft.Text    = "Mini下载软件";
                    Interaction.MsgBox("网络未连接", (int)MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "提示");
                    return;
                }

                Timestr = DateTime.Now.ToString("yyyyMMddHHmmss");
                System.IO.Directory.CreateDirectory(PVar.FileDirectoryDes + Timestr);

                Filestr = PVar.FileDirectorySrc + "*BAM*.rar";
                if (System.IO.File.Exists(Filestr) != false)
                {
                    System.IO.File.Copy(Filestr, PVar.FileDirectoryDes + Timestr + "\\" + "*BAM*.rar", true);
                    Btn_UpadeSoft_Click_UpdatetTime = System.Convert.ToDouble(API.GetTickCount());
                }
                else
                {
                    Interaction.MsgBox("目标源文件不存在", MsgBoxStyle.OkOnly, null);
                    Btn_UpadeSoft.Text    = "Mini下载软件";
                    Btn_UpadeSoft.Enabled = true;
                    return;
                }
                Btn_UpadeSoft.Text = "正在下载中";
                do
                {
                    if (Btn_UpadeSoft_Click_UpdatetTime - API.GetTickCount() > 10000)
                    {
                        Interaction.MsgBox("下载不成功", MsgBoxStyle.OkOnly, null);
                        Btn_UpadeSoft.Enabled = true;
                        Btn_UpadeSoft.Text    = "Mini下载软件";
                        return;
                    }
                    Application.DoEvents();
                } while (!(File.Exists(PVar.FileDirectoryDes + Timestr + "\\" + "*BAM*.rar")));

                Interaction.MsgBox("下载成功", MsgBoxStyle.OkOnly, null);
            }
            catch (Exception ex)
            {
                Btn_UpadeSoft.Enabled = true;
                Btn_UpadeSoft.Text    = "Mini下载软件";
                Interaction.MsgBox(ex.Message, (int)MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "提示");
            }
        }