From e4ec44441fa50c224693439a7c9e1ea2e394457b Mon Sep 17 00:00:00 2001 From: "DESKTOP-999R8N3\\CJY" Date: Mon, 10 Apr 2023 15:48:48 +0900 Subject: [PATCH] =?UTF-8?q?Main=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DialogForms/DialogFormMessage.Designer.cs | 8 +- .../DialogFormProgressBar.Designer.cs | 75 +++++++++---------- .../DialogForms/DialogFormProgressBar.cs | 40 +++++++--- .../DialogForms/DialogFormYesNo.Designer.cs | 8 +- INT_PT002/Forms/FormMain.cs | 2 + 5 files changed, 77 insertions(+), 56 deletions(-) diff --git a/INT_PT002/DialogForms/DialogFormMessage.Designer.cs b/INT_PT002/DialogForms/DialogFormMessage.Designer.cs index 552b6d5..7607ccc 100644 --- a/INT_PT002/DialogForms/DialogFormMessage.Designer.cs +++ b/INT_PT002/DialogForms/DialogFormMessage.Designer.cs @@ -45,7 +45,7 @@ // buttonOK // this.buttonOK.BackGround = null; - this.buttonOK.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); + this.buttonOK.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.buttonOK.ButtonColor = System.Drawing.Color.Silver; this.buttonOK.ButtonDownColor = System.Drawing.Color.Silver; this.buttonOK.ButtonImageAutoSize = true; @@ -56,7 +56,7 @@ this.buttonOK.ImageDisable = null; this.buttonOK.ImageDown = null; this.buttonOK.ImageUp = null; - this.buttonOK.Location = new System.Drawing.Point(345, 126); + this.buttonOK.Location = new System.Drawing.Point(345, 122); this.buttonOK.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonOK.Name = "buttonOK"; this.buttonOK.NestedClickEventPrevent = false; @@ -83,7 +83,7 @@ this.labelMessage1.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.labelMessage1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(42)))), ((int)(((byte)(82))))); this.labelMessage1.BorderStyle = SmartX.SmartLabel.BorderStyles.None; - this.labelMessage1.Font = new System.Drawing.Font("New Gulim", 10F, System.Drawing.FontStyle.Regular); + this.labelMessage1.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Regular); this.labelMessage1.LineSpacing = 0F; this.labelMessage1.Location = new System.Drawing.Point(76, 61); this.labelMessage1.Name = "labelMessage1"; @@ -106,7 +106,7 @@ this.labelMessage2.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.labelMessage2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(42)))), ((int)(((byte)(82))))); this.labelMessage2.BorderStyle = SmartX.SmartLabel.BorderStyles.None; - this.labelMessage2.Font = new System.Drawing.Font("New Gulim", 10F, System.Drawing.FontStyle.Regular); + this.labelMessage2.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Regular); this.labelMessage2.LineSpacing = 0F; this.labelMessage2.Location = new System.Drawing.Point(76, 87); this.labelMessage2.Name = "labelMessage2"; diff --git a/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs b/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs index b8799fa..88b1e56 100644 --- a/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs +++ b/INT_PT002/DialogForms/DialogFormProgressBar.Designer.cs @@ -30,7 +30,7 @@ { this.components = new System.ComponentModel.Container(); this.smartGroupBox1 = new SmartX.SmartGroupBox(); - this.buttonOK = new SmartX.SmartButton(); + this.buttonCancel = new SmartX.SmartButton(); this.labelMessage2 = new SmartX.SmartLabel(); this.progressBarUpdate = new SmartX.SmartProgressBar(); this.labelMessage1 = new SmartX.SmartLabel(); @@ -48,7 +48,7 @@ this.smartGroupBox1.BackGround = null; this.smartGroupBox1.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.smartGroupBox1.BackImage = null; - this.smartGroupBox1.Controls.Add(this.buttonOK); + this.smartGroupBox1.Controls.Add(this.buttonCancel); this.smartGroupBox1.Controls.Add(this.labelMessage2); this.smartGroupBox1.Controls.Add(this.progressBarUpdate); this.smartGroupBox1.Controls.Add(this.labelMessage1); @@ -65,41 +65,40 @@ this.smartGroupBox1.Text = "Update"; this.smartGroupBox1.TextColor = System.Drawing.Color.White; // - // buttonOK + // buttonCancel // - this.buttonOK.BackGround = null; - this.buttonOK.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); - this.buttonOK.ButtonColor = System.Drawing.Color.Silver; - this.buttonOK.ButtonDownColor = System.Drawing.Color.Silver; - this.buttonOK.ButtonImageAutoSize = true; - this.buttonOK.ButtonStyle = SmartX.SmartButton.ButtonStyles.Round3D; - this.buttonOK.ButtonText = "OK"; - this.buttonOK.ColorKeySamplePosition = new System.Drawing.Point(0, 0); - this.buttonOK.GroupID = 0; - this.buttonOK.ImageDisable = null; - this.buttonOK.ImageDown = null; - this.buttonOK.ImageUp = null; - this.buttonOK.Location = new System.Drawing.Point(179, 158); - this.buttonOK.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; - this.buttonOK.Name = "buttonOK"; - this.buttonOK.NestedClickEventPrevent = false; - this.buttonOK.OutlinePixel = 2; - this.buttonOK.OverlapOptimize = true; - this.buttonOK.RepeatInterval = 200; - this.buttonOK.RepeatIntervalAccelerate = null; - this.buttonOK.RoundSize = 10; - this.buttonOK.SafeInterval = 200; - this.buttonOK.Size = new System.Drawing.Size(90, 25); - this.buttonOK.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; - this.buttonOK.TabIndex = 7; - this.buttonOK.Text = null; - this.buttonOK.TextColor = System.Drawing.Color.Black; - this.buttonOK.TextColorDisable = System.Drawing.Color.Gray; - this.buttonOK.TextDownColor = System.Drawing.Color.FromArgb(((int)(((byte)(233)))), ((int)(((byte)(238)))), ((int)(((byte)(255))))); - this.buttonOK.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; - this.buttonOK.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; - this.buttonOK.Visible = false; - this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + this.buttonCancel.BackGround = null; + this.buttonCancel.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.buttonCancel.ButtonColor = System.Drawing.Color.Silver; + this.buttonCancel.ButtonDownColor = System.Drawing.Color.Silver; + this.buttonCancel.ButtonImageAutoSize = true; + this.buttonCancel.ButtonStyle = SmartX.SmartButton.ButtonStyles.Round3D; + this.buttonCancel.ButtonText = "Cancel"; + this.buttonCancel.ColorKeySamplePosition = new System.Drawing.Point(0, 0); + this.buttonCancel.GroupID = 0; + this.buttonCancel.ImageDisable = null; + this.buttonCancel.ImageDown = null; + this.buttonCancel.ImageUp = null; + this.buttonCancel.Location = new System.Drawing.Point(179, 158); + this.buttonCancel.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.NestedClickEventPrevent = false; + this.buttonCancel.OutlinePixel = 2; + this.buttonCancel.OverlapOptimize = true; + this.buttonCancel.RepeatInterval = 200; + this.buttonCancel.RepeatIntervalAccelerate = null; + this.buttonCancel.RoundSize = 10; + this.buttonCancel.SafeInterval = 200; + this.buttonCancel.Size = new System.Drawing.Size(90, 25); + this.buttonCancel.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; + this.buttonCancel.TabIndex = 7; + this.buttonCancel.Text = null; + this.buttonCancel.TextColor = System.Drawing.Color.Black; + this.buttonCancel.TextColorDisable = System.Drawing.Color.Gray; + this.buttonCancel.TextDownColor = System.Drawing.Color.FromArgb(((int)(((byte)(233)))), ((int)(((byte)(238)))), ((int)(((byte)(255))))); + this.buttonCancel.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; + this.buttonCancel.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // // labelMessage2 // @@ -136,7 +135,7 @@ this.progressBarUpdate.BarStyle = SmartX.SmartProgressBar.BARTYPE.Normal; this.progressBarUpdate.Direction = SmartX.SmartProgressBar.DIR.Horizontal; this.progressBarUpdate.FormatString = ""; - this.progressBarUpdate.Location = new System.Drawing.Point(25, 123); + this.progressBarUpdate.Location = new System.Drawing.Point(25, 119); this.progressBarUpdate.Maximum = new decimal(new int[] { 100, 0, @@ -275,7 +274,7 @@ private SmartX.SmartTimer timerUpdate; private SmartX.SmartTimer smartTimerUpdate; private SmartX.SmartSerialPort smartSerialPort2; - private SmartX.SmartButton buttonOK; + private SmartX.SmartButton buttonCancel; private SmartX.SmartTimer timerForMainBoard; private SmartX.SmartTimer smartTimerReboot; private SmartX.SmartFile smartFileCommunicationLog; diff --git a/INT_PT002/DialogForms/DialogFormProgressBar.cs b/INT_PT002/DialogForms/DialogFormProgressBar.cs index a726795..bac1c41 100644 --- a/INT_PT002/DialogForms/DialogFormProgressBar.cs +++ b/INT_PT002/DialogForms/DialogFormProgressBar.cs @@ -242,9 +242,13 @@ namespace INT_PT002.DialogForms { } + fullPath = "SD Card\\DataBackup\\Communicationlog.txt"; + this.smartFileCommunicationLog.FilePathName = fullPath; + this.smartFileCommunicationLog.Open(); } public void CloseSerialPort2() { + this.smartFileCommunicationLog.Close(); this.smartSerialPort2.Close(); } @@ -465,7 +469,7 @@ namespace INT_PT002.DialogForms public void UpdateMainBoardFail(Define.E_LanguageID language) { this.progressBarUpdate.Visible = false; - this.buttonOK.Visible = true; + this.buttonCancel.Visible = true; switch (language) { @@ -522,7 +526,7 @@ namespace INT_PT002.DialogForms int ret = 0, index = 0; byte[] beforeData; string ack = "", data = ""; - string cmd = "", address = "", lane = "", receiveData = ""; + string cmd = "", address = "", lane = "", receiveData = "", error = ""; string strTemp = ""; byte[] readByte; Define.E_ResponseData response = Define.E_ResponseData.NAK; @@ -545,25 +549,41 @@ namespace INT_PT002.DialogForms } cmd = strTemp.Substring(0, 3); - lane = strTemp.Substring(5, 1); - address = strTemp.Substring(10, 4); - receiveData = strTemp.Substring(14, strTemp.Length - 16); try { switch (strTemp[0]) { case 'C': + error = strTemp.Substring(4, 1); + + // 로그 + //if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.StringType.Write(string.Format("Update Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp)); + switch (cmd) { case "CBU": - this.UpdateMainBoardFinish(Language); + if (error == "1") + this.UpdateMainBoardFail(Language); + else + { + this.CloseSerialPort2(); + this.progressBarUpdate.Value += 100; + this.UpdateMainBoardFinish(Language); + } break; default: break; } break; case 'P': + lane = strTemp.Substring(5, 1); + address = strTemp.Substring(10, 4); + receiveData = strTemp.Substring(14, strTemp.Length - 16); + + this.smartFileCommunicationLog.StringType.Write(string.Format("Update Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp.Substring(0, 14))); + switch (address) { case "1651": @@ -605,7 +625,7 @@ namespace INT_PT002.DialogForms } else { - this.progressBarUpdate.Value += 5; + this.progressBarUpdate.Value += 10; } } else @@ -694,11 +714,11 @@ namespace INT_PT002.DialogForms SmartX.SmartConfigs.ReBoot(); } - private void buttonOK_Click(object sender, EventArgs e) + private void buttonCancel_Click(object sender, EventArgs e) { - this.DialogResult = DialogResult.OK; + this.DialogResult = DialogResult.Cancel; this.CloseSerialPort2(); - this.Close(); + this.Close(); } #endregion } diff --git a/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs b/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs index 40b9975..e6c1d0e 100644 --- a/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs +++ b/INT_PT002/DialogForms/DialogFormYesNo.Designer.cs @@ -44,7 +44,7 @@ // buttonYes // this.buttonYes.BackGround = null; - this.buttonYes.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); + this.buttonYes.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.buttonYes.ButtonColor = System.Drawing.Color.Silver; this.buttonYes.ButtonDownColor = System.Drawing.Color.Silver; this.buttonYes.ButtonImageAutoSize = true; @@ -79,7 +79,7 @@ // buttonNo // this.buttonNo.BackGround = null; - this.buttonNo.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); + this.buttonNo.BackGroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.buttonNo.ButtonColor = System.Drawing.Color.Silver; this.buttonNo.ButtonDownColor = System.Drawing.Color.Silver; this.buttonNo.ButtonImageAutoSize = true; @@ -132,7 +132,7 @@ this.smartGroupBox1.Location = new System.Drawing.Point(0, 0); this.smartGroupBox1.Name = "smartGroupBox1"; this.smartGroupBox1.RoundRadius = 5; - this.smartGroupBox1.Size = new System.Drawing.Size(450, 160); + this.smartGroupBox1.Size = new System.Drawing.Size(450, 155); this.smartGroupBox1.TabIndex = 7; this.smartGroupBox1.Text = "ErrorCode"; this.smartGroupBox1.TextColor = System.Drawing.Color.White; @@ -217,7 +217,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScroll = true; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(110)))), ((int)(((byte)(165))))); - this.ClientSize = new System.Drawing.Size(450, 160); + this.ClientSize = new System.Drawing.Size(450, 155); this.ControlBox = false; this.Controls.Add(this.smartGroupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; diff --git a/INT_PT002/Forms/FormMain.cs b/INT_PT002/Forms/FormMain.cs index c7188d2..59d32ec 100644 --- a/INT_PT002/Forms/FormMain.cs +++ b/INT_PT002/Forms/FormMain.cs @@ -671,6 +671,8 @@ namespace INT_PT002.Forms } public void CloseSmartUartLink() { + this.IsCommunicationLogOpen = false; + this.smartFileCommunicationLog.Close(); this.smartSerialPortLink.Close(); }