public void AlarmEvent(int Address, int Point) { ThreadSafeHelper.UIThread(this, () => { if (AlarmInformation.Time == DateTime.Now.Minute) { return; } if (AlarmInformation.FormOpen == false) { AlarmInformation.FormOpen = true; if (!AlarmInformation.Once) { AlarmInfo.AddInfo(UserData.Instance.GetErrorInformation((Address).ToString(), Point)); ParentForm.Controls.Add(AlarmInfo); ParentForm.Controls.SetChildIndex(AlarmInfo, 0); AlarmInformation.Once = true; } } else { if (!AlarmInformation.Once) { AlarmInfo.AddInfo(ATS.Models.UserData.Instance.GetErrorInformation((Address).ToString(), Point)); AlarmInformation.Once = true; } } WiseTech.Log.Logger.AlarmLog(UserData.Instance.GetErrorInformation((Address).ToString(), Point)); }); }
private void ColdInformationChange(int Location, string SlotID) { ThreadSafeHelper.UIThread(this, () => { if (SlotID == "") { ColdResins[Location - 1].SlotID = ""; ColdResins[Location - 1].ColdType = 0; ColdResins[Location - 1].ExpiredTime = ""; ColdResins[Location - 1].InColdOperator = ""; ColdResins[Location - 1].InColdTime = ""; return; } else { StoreMessage NewStoreMessage = Read(Location, SlotID, 1); if (NewStoreMessage == null) { return; } ColdResins[Location - 1].SlotID = SlotID; ColdResins[Location - 1].InColdTime = NewStoreMessage.InColdTime; ColdResins[Location - 1].ExpiredTime = NewStoreMessage.ExpiredTime; ColdResins[Location - 1].InColdOperator = NewStoreMessage.InColdOperator; panel2.Controls["TbColdResin" + Location].Text = SlotID; } }); }
private void CSTForm_OnAnimationUpdate(object sender, EventArgs e) { ThreadSafeHelper.UIThread(this, () => { RefreshStatus(); }); }
private void Core_OnAnimationUpdate(object sender, EventArgs e) { ThreadSafeHelper.UIThread(this, () => { SuspendLayout(); Point delta = targetLocation - new Size(Location); Size deltaSize = targetSize - Size; //距離差除2後 //(若在+2~-2之間則直接視為到達 用右移方式 +1和-1右移1會是0 所以不需要判斷是否在+2~-2間) delta.X >>= 1; delta.Y >>= 1; deltaSize.Width >>= 1; deltaSize.Height >>= 1; Location += new Size(delta.X, delta.Y); Size += deltaSize; if (delta.X == 0 && delta.Y == 0 && deltaSize.Width == 0 && deltaSize.Height == 0) { Location = targetLocation; Size = targetSize; TweenEnd(); } ResumeLayout(); }); }
private void Vms_OnGetRecipeSectionAlignmentReply(object sender, VmsEventArgs e) { ThreadSafeHelper.UIThread(this, () => { labelAlignmentReply.Text = e.Data.ToString(); }); }
private void WarmBottleChangeNum(byte Num) { ThreadSafeHelper.UIThread(this, () => { LbWarmNum.Text = Num.ToString(); }); }
private async void CSTForm_OnAnimationUpdate(object sender, EventArgs e) { ThreadSafeHelper.UIThread(this, () => { var statusKey = Enum.GetName(typeof(ATSData.AutomaticModeStatusType), ATSData.AutomaticModeStatus); labelStatus.Text = Language.Text(statusKey); switch (ATSData.AutomaticModeStatus) { case ATSData.AutomaticModeStatusType.Reset: labelStatus.BackColor = Color.Yellow; break; case ATSData.AutomaticModeStatusType.Pause: labelStatus.BackColor = Color.LightGray; break; case ATSData.AutomaticModeStatusType.Run: labelStatus.BackColor = Color.LightSeaGreen; break; case ATSData.AutomaticModeStatusType.Stop: labelStatus.BackColor = Color.LightGray; TaskNumberSelect.Moving = false; break; case ATSData.AutomaticModeStatusType.Error: labelStatus.BackColor = Color.FromArgb(237, 28, 36); break; } }); }
private void ShowImformation(string Imformation) { ThreadSafeHelper.UIThread(this, () => { //"1801930101;;8088X78;1.4;20190224;20180825\r"; string[] ImformationArray = Imformation.Split(';'); LbPdaBarco.Text = ImformationArray[0]; LbPdaSlotID.Text = ImformationArray[2]; LbPdaShelf.Text = ImformationArray[4]; PbBarco.Image.Dispose(); PbSlotID.Image.Dispose(); PbShelfLife.Image.Dispose(); PbBarco.Image = LbPdaBarco.Text == LbReaderBarco.Text ? Properties.Resources.MatchSuccess1 : Properties.Resources.Error; PbSlotID.Image = LbPdaSlotID.Text == LbReaderSlotID.Text ? Properties.Resources.MatchSuccess1 : Properties.Resources.Error; PbShelfLife.Image = LbPdaShelf.Text == LbReaderShelf.Text ? Properties.Resources.MatchSuccess1 : Properties.Resources.Error; if (LbPdaSlotID.Text == LbReaderSlotID.Text && LbPdaShelf.Text == LbReaderShelf.Text) { //BtnStart.Visible = true; //NowSlotID = ImformationArray[2]; //NowShelfTime = ImformationArray[4]; //MatchResult = true; //Start(); } else { BtnStart.Visible = false; } }); }
private void Core_OnSecUpdate(object sender, EventArgs e) { ThreadSafeHelper.UIThread(this, () => { labelDateTime.Text = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); }); }
private void WarmStoreChange(int Store, string Imformation) { ThreadSafeHelper.UIThread(this, () => { switch (Imformation) { case "0": WarmResins[Store].WarmType = 0; panel3.Controls["TbWarmResin" + (Store + 1)].Visible = false; break; case "1": WarmResins[Store].WarmType = 1; panel3.Controls["TbWarmResin" + (Store + 1)].Visible = true; break; case "2": WarmResins[Store].WarmType = 2; panel3.Controls["TbWarmResin" + (Store + 1)].Visible = true; break; case "3": WarmResins[Store].WarmType = 3; panel3.Controls["TbWarmResin" + (Store + 1)].Visible = true; break; case "4": WarmResins[Store].WarmType = 4; panel3.Controls["TbWarmResin" + (Store + 1)].Visible = true; break; } }); }
private void IOInputAutoOrMaintain() { ThreadSafeHelper.UIThread(this, () => { labelRunModeStatus.Text = MachineMode() ? "Automatic" : "Maintain"; ATSData.SystemMode = MachineMode() ? ATSData.SystemModeType.Automatic : ATSData.SystemModeType.Handmode; }); }
private void Start() { ThreadSafeHelper.UIThread(this, () => { TaskStart = true; PLCconnect.WriteInClod.MatchDataWithBarco(NowSlotID, NowShelfTime); ParentForm.Controls.Remove(BarcoReader.MatchImformationPanel1); }); }
private void Vms_OnGetRecipeSectionGeneralReply(object sender, VmsEventArgs e) { ThreadSafeHelper.UIThread(this, () => { //MessageBox.Show(e.Data.ToString()); labelGeneralReply.Text = e.Data.ToString(); }); }
private void Logger_OnError(object sender, LoggerLogEventArgs e) { ThreadSafeHelper.UIThread(this, () => { labelLog.ForeColor = Color.FromArgb(237, 28, 36); labelLog.Text = e.Level + " : " + e.Message; }); }
private void Logger_OnWarning(object sender, LoggerLogEventArgs e) { ThreadSafeHelper.UIThread(this, () => { labelLog.ForeColor = Color.Orange; labelLog.Text = e.Level + " : " + e.Message; }); }
private void CSTForm_OnAnimationUpdate(object sender, EventArgs e) { ThreadSafeHelper.UIThread(this, () => { var isCycleRun = ATSCore.Instance.CycleRun; buttonCycleRunOn.BackColor = isCycleRun ? Color.LightBlue : Color.DimGray; buttonCycleRunOff.BackColor = isCycleRun ? Color.DimGray : Color.LightBlue; }); }
private void WarmStoreChange(int Store, string Imformation) { ThreadSafeHelper.UIThread(this, () => { switch ((Store + 1)) { } }); }
private void CSTForm_OnAnimationUpdate(object sender, EventArgs e) { ThreadSafeHelper.UIThread(this, () => { var isSafetyDoor = ATSCore.Instance.SafetyDoor; buttonSafetyDoorEnable.BackColor = isSafetyDoor ? Color.LightBlue : Color.DimGray; buttonSafetyDoorDisable.BackColor = isSafetyDoor ? Color.DimGray : Color.LightBlue; }); }
private void IncoldUpdate(string Location, string SlotID, string Overtime) { ThreadSafeHelper.UIThread(this, () => { ColdResins[int.Parse(Location)].SlotID = SlotID; ColdResins[int.Parse(Location)].InColdTime = DateTime.Now.ToString("yyyy-MM-dd"); ColdResins[int.Parse(Location)].ExpiredTime = Overtime; ColdResins[int.Parse(Location)].InColdOperator = UserData.Instance.Now.Name; }); }
private void WarmTaskSuccessUpdate(string ColdLocation, string WarmLocation) { ThreadSafeHelper.UIThread(this, () => { StoreMessage Message = Read(Convert.ToInt32(WarmLocation), "", 2); switch (Convert.ToInt32(WarmLocation)) { } }); }
private void OutColdFirstSendInfo(int Location) { ThreadSafeHelper.UIThread(this, () => { panel3.Controls["TbWarmResin" + Location].Visible = true; panel3.Controls["TbWarmResin" + Location].Text = PLCconnect.WriteOutCold.LotID; panel3.Controls["WarmResin" + Location].BackgroundImage.Dispose(); panel3.Controls["WarmResin" + Location].BackgroundImage = Properties.Resources.YellowCircle1; panel3.Controls["LabelWarmNum" + Location].BackColor = Color.FromArgb(239, 228, 176); }); }
private void EmptyBottleWeightShow(string Weight) { EmptyBottle = Convert.ToDouble(Weight) / 1000; string ShowMessage = (FillBottle - EmptyBottle).ToString(); ThreadSafeHelper.UIThread(this, () => { TbWeight.Visible = true; TbWeight.Text = "淨重 : " + ShowMessage + " (g)"; }); }
private void WarmTimeEvent(int Store, string Time, int Expired) //0->Warming , 1->Success, 2->Expired 1st, 3->Expired 2rd { try { ThreadSafeHelper.UIThread(this, () => { #region 無資料 if (Expired == -1) { WarmResins[Store].InWarmOperator = ""; WarmResins[Store].WarmType = 0; WarmResins[Store].InWarmTime = ""; WarmResins[Store].ExpiredTime = ""; WarmResins[Store].SlotID = ""; WarmResins[Store].InColdOperator = ""; WarmResins[Store].InColdTime = ""; panel3.Controls["TbWarmResin" + (Store + 1)].Visible = false; panel3.Controls["WarmResin" + (Store + 1)].BackgroundImage.Dispose(); panel3.Controls["WarmResin" + (Store + 1)].BackgroundImage = Properties.Resources.BlackCircle; panel3.Controls["LabelWarmNum" + (Store + 1)].BackColor = Color.FromArgb(100, 100, 100); } #endregion else { var num = Store + 1; StoreMessage Message = Read(Store + 1, "", 2); WarmResins[Store].InWarmTime = Message.InWarmTime; WarmResins[Store].SlotID = Message.SlotID; WarmResins[Store].ExpiredTime = (Convert.ToDateTime(Message.InWarmTime).AddMinutes(Convert.ToInt32(ATS.SystemConfig.WarmTime))).ToString("MM/dd HH:mm"); WarmResins[Store].InWarmOperator = Message.InWarmOperator; panel3.Controls["TbWarmResin" + num].Visible = true; panel3.Controls["TbWarmResin" + num].Text = Message.SlotID; panel3.Controls["WarmResin" + (Store + 1)].BackgroundImage.Dispose(); panel3.Controls["WarmResin" + (Store + 1)].BackgroundImage = Properties.Resources.RedCircle1; panel3.Controls["WarmResin" + (Store + 1)].BackgroundImage.Dispose(); panel3.Controls["WarmResin" + (Store + 1)].BackgroundImage = Expired == 0 ? Properties.Resources.YellowCircle1 : (Expired == 1 ? Properties.Resources.GreenCircle2 : (Expired == 2 ? Properties.Resources.OrangeCircle : (Expired == 3 ? Properties.Resources.RedCircle1 : Properties.Resources.BlackCircle1))); panel3.Controls["LabelWarmNum" + (Store + 1)].BackColor = Expired == 0 ? Color.FromArgb(239, 228, 176) : (Expired == 1 ? Color.FromArgb(188, 230, 29) : (Expired == 2 ? Color.FromArgb(225, 127, 39) : (Expired == 3 ? Color.FromArgb(237, 28, 36) : Color.FromArgb(100, 100, 100)))); } }); } catch (Exception err) { LCSCommon.WriteRunLog(err.Message); } }
private void VmsLogicHandler_OnRecipeListUpdate(object sender, EventArgs e) { ThreadSafeHelper.UIThread(this, () => { foreach (var item in VmsLogicHandler.AllRecipeList) { //Console.WriteLine(item.ToString()); var listViewItem = new ListViewItem(item.ToString()); listViewRecipeList.Items.Add(listViewItem); } }); }
internal static void OpenSafetyDoorAlarmForm(Control ui, object data) { if (!SafetyDoorAlarmFormOpen) { SafetyDoorAlarmFormOpen = true; ThreadSafeHelper.UIThread(ui, () => { var form = new SafetyDoorAlarmForm(); form.Show(); form.FormClosing += (sender, e) => { SafetyDoorAlarmFormOpen = false; }; }); } }
private void PLCStatusChange(bool Status) { ThreadSafeHelper.UIThread(this, () => { if (Status == true) { labelView1Mode.Text = "ONLINE"; } else { labelView1Mode.Text = "OFFLINE"; } }); }
private void RefreshStatus() { ThreadSafeHelper.UIThread(this, () => { var systemStatusKey = Enum.GetName(typeof(ATSData.SystemModeType), ATSData.SystemMode); if (systemStatusKey == "Handmode") { systemStatusKey = "Maintain"; } labelRunModeStatus.Text = systemStatusKey;//"OFFLineMode"; systemStatusKey = Enum.GetName(typeof(ATSData.SystemTaskMode), ATSData.TaskMode); labelView1RecipeStatus.Text = systemStatusKey; }); }
private void WarmTimeEvent(int Location, string WarmHour, string Minutes, int WarmedType)//-1 -> Null 0->Warming , 1->Success, 2->Expired 1st, 3->Expired 2rd { ThreadSafeHelper.UIThread(this, () => { switch (WarmedType) { case -1: WarmCols[Location].PB.Visible = false; WarmCols[Location].Tb.Text = (Location + 1).ToString() + Language.Text("NoResin"); WarmCols[Location].Tb.BackColor = Color.White; break; case 0: WarmCols[Location].PB.Visible = true; WarmCols[Location].PB.Value = (((Convert.ToInt32(WarmHour) * 60) + (Convert.ToInt32(Minutes))) * 100) / Convert.ToInt32(SystemConfig.WarmTime); WarmCols[Location].Tb.Text = (Location + 1).ToString() + Language.Text("Warming"); WarmCols[Location].Tb.BackColor = Color.FromArgb(130, 210, 212); break; case 1: WarmCols[Location].PB.Visible = true; // 130, 210, 212 WarmCols[Location].PB.Value = ((Convert.ToInt32(WarmHour) * 60) + (Convert.ToInt32(Minutes)) * 100) / Convert.ToInt32(SystemConfig.WarmOutTime1); WarmCols[Location].Tb.Text = (Location + 1).ToString() + Language.Text("Warmed"); WarmCols[Location].Tb.BackColor = Color.FromArgb(153, 217, 234); break; case 2: WarmCols[Location].PB.Visible = true; WarmCols[Location].PB.Value = (((Convert.ToInt32(WarmHour) * 60) + (Convert.ToInt32(Minutes))) * 100) / Convert.ToInt32(SystemConfig.WarmOutTime2); WarmCols[Location].Tb.Text = (Location + 1).ToString() + Language.Text("Expired1st"); WarmCols[Location].Tb.BackColor = Color.FromArgb(255, 97, 3); break; case 3: WarmCols[Location].PB.Visible = true; WarmCols[Location].PB.Value = 100; WarmCols[Location].Tb.Text = (Location + 1).ToString() + Language.Text("Expired2rd"); WarmCols[Location].Tb.BackColor = Color.FromArgb(237, 28, 36); break; } }); }
private void WarmTimeEvent(int Store, string Time, int Expired) //0->Warming , 1->Success, 2->Expired 1st, 3->Expired 2rd { ThreadSafeHelper.UIThread(this, () => { #region 無資料 if (Expired == -1) { switch ((Store + 1)) { } } #endregion else { StoreMessage Message = Read(Store + 1, "", 2); switch ((Store + 1)) { } } }); }
private void RefreshButtonText() { ThreadSafeHelper.UIThread(this, () => { var defaultText = Language.Text("TransportPanel.Switch"); var defaultColor = Color.WhiteSmoke; var selectedText = Language.Text("TransportPanel.Selected"); var selectedColor = Color.LightBlue; buttonMixedMode.Text = defaultText; buttonView1Mode.Text = defaultText; buttonView2Mode.Text = defaultText; buttonMixedMode.BackColor = defaultColor; buttonView1Mode.BackColor = defaultColor; buttonView2Mode.BackColor = defaultColor; switch (ATSData.TransportMode) { case ATSData.TransportModeType.MixedMode: buttonMixedMode.Text = selectedText; buttonMixedMode.BackColor = selectedColor; break; case ATSData.TransportModeType.View1Mode: buttonView1Mode.Text = selectedText; buttonView1Mode.BackColor = selectedColor; break; case ATSData.TransportModeType.View2Mode: buttonView2Mode.Text = selectedText; buttonView2Mode.BackColor = selectedColor; break; } labelView1Mode.Text = Language.Text("TransportPanel.View1"); labelView2Mode.Text = Language.Text("TransportPanel.View2"); labelMixedMode.Text = Language.Text("TransportPanel.MixedMode"); UnlockButton(); }); }