diff --git a/View/TechnologicalProcessView.xaml.cs b/View/TechnologicalProcessView.xaml.cs index e608b67..d6bec9c 100644 --- a/View/TechnologicalProcessView.xaml.cs +++ b/View/TechnologicalProcessView.xaml.cs @@ -18,6 +18,7 @@ using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using System.Windows.Threading; using static DyeingComputer.UserClass.SqliteHelper; using static DyeingComputer.Windows.ViewStep; @@ -97,7 +98,7 @@ namespace DyeingComputer.View private void UserControl_Loaded(object sender, RoutedEventArgs e) { // FocusManager.SetFocusedElement(Grid, Grid); - // Grid.DataContext = new MainWindowViewModel(); + // Grid.DataContext = new MainWindowViewModel(); if (workName != null) { Grid.SelectedIndex = 0; @@ -106,6 +107,7 @@ namespace DyeingComputer.View { if (MainWindowViewModel.WORK_RUN != 0) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示 } + CountDown(); } private void UserControl_KeyDown(object sender, KeyEventArgs e) //键盘监控 @@ -118,7 +120,7 @@ namespace DyeingComputer.View { MainWindowViewModel.RUN_DATATABLE = sql.Tables[0];//缓存表 MainWindowViewModel.RUN_STEPID = Convert.ToInt16(ID);//插入步骤号 - MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), Convert.ToDouble(P4), Convert.ToDouble(P5)); + MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), Convert.ToDouble(P4), Convert.ToDouble(P5)); } } } @@ -128,13 +130,13 @@ namespace DyeingComputer.View { if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (ID == null) ID = sql.Tables[0].Rows.Count.ToString(); - ViewStep viewstop = new ViewStep(Numder,P1,P2,P3,P4,P5); + ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); viewstop.data = ID; viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.ShowDialog(); } private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果 - { + { int n = StrToInt.To16Convert10(ID); DataRow dr = sql.Tables[0].Rows[n - 1]; @@ -230,7 +232,7 @@ namespace DyeingComputer.View string P1 = "0", P2 = "0", P3 = "0", P4 = "0", P5 = "0"; private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (MainWindowViewModel.WORK_RUN ==2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示 + if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示 int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量 if (rownum != -1)//判断鼠标定位是否有效 { @@ -244,5 +246,18 @@ namespace DyeingComputer.View } } + public void CountDown() + { + DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick + { + Interval = TimeSpan.FromSeconds(1)//秒 + }; + timer1s.Tick += Tick_Event_1S; + timer1s.Start(); + } + void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S + { + if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示 + } } } diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 9f6f8c7..467a443 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -80,6 +80,7 @@ namespace DyeingComputer.ViewModel private int MT38;//高水位 private int MT39;//中水位 private int MT40;//低水位 + private int MT41;//安全水位 private static int MT90;//呼叫操作员 private int S16;//机型 @@ -111,6 +112,7 @@ namespace DyeingComputer.ViewModel MT38 = Convert.ToInt16(Selet_con("MT38"));// MT39 = Convert.ToInt16(Selet_con("MT39"));// MT40 = Convert.ToInt16(Selet_con("MT40"));// + MT41 = Convert.ToInt16(Selet_con("MT41"));// MT90 = Convert.ToInt16(Selet_con("MT90"));//呼叫操作员 S16 = Convert.ToInt16(Selet_sys("S16"));//工作信息 @@ -226,7 +228,7 @@ namespace DyeingComputer.ViewModel STEP_RUN(); LOG_view(); - // IO_view(); + IO_view(); if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString(); } @@ -242,7 +244,7 @@ namespace DyeingComputer.ViewModel { if (LINK_OK) Modbus_link(); if (LINK_OK) IO_data(); - IO_view(); + if (!string.IsNullOrEmpty(Name_err.ToString()) && (!ERR_JOG)) //有故障信息,无故障保持 { ERR_JOG = true; @@ -268,7 +270,6 @@ namespace DyeingComputer.ViewModel private static int THL_mode = 0; //温控模式 0保温 1加热 2降 private static double TEMP_co = 0; //计算温度 private static double TEMP_tar = 16.5; //目标温度 - private bool Pump_M = false;//主泵状态 private bool Alert_yellow = false; //警报黄灯 private bool Alert_red = false; //警报红灯 private bool Alert_bell = false; //警报铃声 @@ -287,7 +288,7 @@ namespace DyeingComputer.ViewModel if (STEP_P1 > t_t) { THL_mode = 1; } else if (STEP_P1 < t_t) { THL_mode = 2; } TEMP_co = t_t; - updata_dtm("1003", STEP_P2 / 600); + Updata_dtm("1003", STEP_P2 / 600); STEP_TIME = Convert.ToInt16(STEP_P3) * 60; WORK_RUN = 2; SETP_runtime = true; @@ -380,13 +381,23 @@ namespace DyeingComputer.ViewModel break;//主缸减压 case "054": - + STEP_P1 = Convert.ToDouble(P1); + STEP_P2 = Convert.ToDouble(P2); + STEP_P3 = Convert.ToDouble(P3); + WORK_RUN = 2; + SETP_runtime = true; + STEP_finish = false; break;//主泵/风机速度 case "055": - + STEP_TIME = 10; + WORK_RUN = 2; + SETP_runtime = true; + STEP_finish = false; break;//主泵启动 case "056": - + WORK_RUN = 2; + SETP_runtime = true; + STEP_finish = false; break;//主泵停止 case "064": @@ -506,17 +517,17 @@ namespace DyeingComputer.ViewModel } } } - updata_dtm("1004", TO); - updata_dtm("1005", TEMP_co); + Updata_dtm("1004", TO); + Updata_dtm("1005", TEMP_co); if (MT12 == 1)//输出类型0开关1模拟 { if (THL_mode == 2) { - updata_dta("5002", Convert.ToInt16(TO)); + Updata_dta("5002", Convert.ToInt16(TO)); } else { - updata_dta("5001", Convert.ToInt16(TO)); + Updata_dta("5001", Convert.ToInt16(TO)); } } else @@ -525,57 +536,57 @@ namespace DyeingComputer.ViewModel if (THL_mode == 2) { if ((temp_time10s <= Convert.ToInt16(TO)/100)) - { updata_dtd("3010", true); } - else { updata_dtd("3010", false); }//降温 + { Updata_dtd("3010", true); } + else { Updata_dtd("3010", false); }//降温 } else { if ((temp_time10s <= Convert.ToInt16(TO)/100)) - { updata_dtd("3009", true); } - else { updata_dtd("3009", false); }//升温 + { Updata_dtd("3009", true); } + else { Updata_dtd("3009", false); }//升温 } } break;//功能模块001温度控制 case "007": if (STEP_P1.ToString() == "1") { - updata_dtd("3012", true); - updata_dtd("3013", false); - updata_dtd("3014", false); - updata_dtd("3015", false); + Updata_dtd("3012", true); + Updata_dtd("3013", false); + Updata_dtd("3014", false); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1"; } else if (STEP_P1.ToString() == "2") { - updata_dtd("3012", false); - updata_dtd("3013", true); - updata_dtd("3014", false); - updata_dtd("3015", false); + Updata_dtd("3012", false); + Updata_dtd("3013", true); + Updata_dtd("3014", false); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2"; } else if (STEP_P1.ToString() == "3") { - updata_dtd("3012", false); - updata_dtd("3013", false); - updata_dtd("3014", true); - updata_dtd("3015", false); + Updata_dtd("3012", false); + Updata_dtd("3013", false); + Updata_dtd("3014", true); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3"; } else if (STEP_P1.ToString() == "4") { - updata_dtd("3012", false); - updata_dtd("3013", false); - updata_dtd("3014", false); - updata_dtd("3015", true); + Updata_dtd("3012", false); + Updata_dtd("3013", false); + Updata_dtd("3014", false); + Updata_dtd("3015", true); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4"; } if (Selet_dtm("1015") >= STEP_P2) //到达水位 { - updata_dtd("3012", false); - updata_dtd("3013", false); - updata_dtd("3014", false); - updata_dtd("3015", false); + Updata_dtd("3012", false); + Updata_dtd("3013", false); + Updata_dtd("3014", false); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.Finish; STEP_finish = true; } @@ -583,44 +594,44 @@ namespace DyeingComputer.ViewModel case "008": if (STEP_P1.ToString() == "1") { - updata_dtd("3012", true); - updata_dtd("3013", false); - updata_dtd("3014", false); - updata_dtd("3015", false); + Updata_dtd("3012", true); + Updata_dtd("3013", false); + Updata_dtd("3014", false); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "1"; } else if (STEP_P1.ToString() == "2") { - updata_dtd("3012", false); - updata_dtd("3013", true); - updata_dtd("3014", false); - updata_dtd("3015", false); + Updata_dtd("3012", false); + Updata_dtd("3013", true); + Updata_dtd("3014", false); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "2"; } else if (STEP_P1.ToString() == "3") { - updata_dtd("3012", false); - updata_dtd("3013", false); - updata_dtd("3014", true); - updata_dtd("3015", false); + Updata_dtd("3012", false); + Updata_dtd("3013", false); + Updata_dtd("3014", true); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "3"; } else if (STEP_P1.ToString() == "4") { - updata_dtd("3012", false); - updata_dtd("3013", false); - updata_dtd("3014", false); - updata_dtd("3015", true); + Updata_dtd("3012", false); + Updata_dtd("3013", false); + Updata_dtd("3014", false); + Updata_dtd("3015", true); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.AddWater + "4"; } if (Selet_dtm("1016") >= STEP_P2) //到达水量 { - updata_dtd("3012", false); - updata_dtd("3013", false); - updata_dtd("3014", false); - updata_dtd("3015", false); + Updata_dtd("3012", false); + Updata_dtd("3013", false); + Updata_dtd("3014", false); + Updata_dtd("3015", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.AddWater + ":" + Resources.Finish; STEP_finish = true; } @@ -637,24 +648,24 @@ namespace DyeingComputer.ViewModel case "020": if (STEP_P1.ToString() == "1") { - updata_dtd("3016", true); - updata_dtd("3017", false); - updata_dtd("3018", false); + Updata_dtd("3016", true); + Updata_dtd("3017", false); + Updata_dtd("3018", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1"; } else if (STEP_P1.ToString() == "2") { - updata_dtd("3016", false); - updata_dtd("3017", true); - updata_dtd("3018", false); + Updata_dtd("3016", false); + Updata_dtd("3017", true); + Updata_dtd("3018", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2"; } else if (STEP_P1.ToString() == "3") { - updata_dtd("3016", false); - updata_dtd("3017", false); - updata_dtd("3018", true); + Updata_dtd("3016", false); + Updata_dtd("3017", false); + Updata_dtd("3018", true); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3"; } @@ -662,9 +673,9 @@ namespace DyeingComputer.ViewModel { if (STEP_TIME == 0)//排水延时 { - updata_dtd("3016", false); - updata_dtd("3017", false); - updata_dtd("3018", false); + Updata_dtd("3016", false); + Updata_dtd("3017", false); + Updata_dtd("3018", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Finish; STEP_finish = true; } @@ -678,36 +689,36 @@ namespace DyeingComputer.ViewModel case "022": if (STEP_P1.ToString() == "1") { - updata_dtd("3016", true); - updata_dtd("3017", false); - updata_dtd("3018", false); + Updata_dtd("3016", true); + Updata_dtd("3017", false); + Updata_dtd("3018", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "1"; } else if (STEP_P1.ToString() == "2") { - updata_dtd("3016", false); - updata_dtd("3017", true); - updata_dtd("3018", false); + Updata_dtd("3016", false); + Updata_dtd("3017", true); + Updata_dtd("3018", false); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "2"; } else if (STEP_P1.ToString() == "3") { - updata_dtd("3016", false); - updata_dtd("3017", false); - updata_dtd("3018", true); + Updata_dtd("3016", false); + Updata_dtd("3017", false); + Updata_dtd("3018", true); if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3"; } - updata_dtd("3019", true);//开排水泵 + Updata_dtd("3019", true);//开排水泵 if (Selet_dtm("1015") <= STEP_P2) //排水状态完成 { if (STEP_TIME == 0)//排水延时 { - updata_dtd("3016", false); - updata_dtd("3017", false); - updata_dtd("3018", false); - updata_dtd("3019", false);//开排水泵 + Updata_dtd("3016", false); + Updata_dtd("3017", false); + Updata_dtd("3018", false); + Updata_dtd("3019", false);//开排水泵 if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Drainage + ":" + Resources.Finish; STEP_finish = true; } @@ -816,7 +827,6 @@ namespace DyeingComputer.ViewModel if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.Sampling; break;//取样 case "041": - STEP_finish = true; if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.End; break;//结束 @@ -848,13 +858,34 @@ namespace DyeingComputer.ViewModel break;//主缸减压 case "054": - + Updata_dtm("1020", STEP_P1); + Updata_dtm("1021", STEP_P2); + Updata_dtm("1008", STEP_P3); + STEP_finish = true; break;//主泵/风机速度 case "055": - + if (Selet_dtm("1015") > MT41) + { + Updata_dtd("3011", true);//主泵启动 + if (S16 == 1) Updata_dtd("3012", true);//风机启动 + STEP_TIME--; + if (STEP_TIME == 0) + { + STEP_finish = true; + } + if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.PumpStart + "("+ STEP_TIME + "S)"; + } + else + { + Updata_dtd("3011", false); + Updata_dtd("3012", false); + if (string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Resources.MasterCylinder + Resources.Low_waterlevel; + } break;//主泵启动 case "056": - + Updata_dtd("3011", false);//主泵 + if (S16 == 1) Updata_dtd("3012", false);//风机 + STEP_finish = true; break;//主泵停止 case "064": @@ -910,8 +941,6 @@ namespace DyeingComputer.ViewModel } else if (WORK_RUN == 1) { - for (ushort i = 0; i < 100; i++) { updata_dtd((i + 3011).ToString(), false); } - SETP_runtime = false; STEP_finish = false; Status_Str = Resources.Paused; @@ -919,6 +948,15 @@ namespace DyeingComputer.ViewModel else if (WORK_RUN == 0) { + if (Status_Str == Resources.Paused) + { + Updata_dtm("1004", 0); + Updata_dtm("1005", Selet_dtm("1010")); + for (int i = 1; i <128; i++) + { + Updata_dtd((3000+i).ToString(), false); + } + }//清除输出状态 if (string.IsNullOrEmpty(Name_err.ToString())) { int TIMEH = DIDETime / 3600; @@ -1007,10 +1045,10 @@ namespace DyeingComputer.ViewModel { Sys_log = Sys_log + "\n" + Resources.MasterCylinder + Resources.WaterLevel + " : " + string.Format("{0:D4}", IO1015) + "L =>[" + Resources.High_waterlevel + "]";//显示水位 } - if (Pump_M) //主泵状态 + if (Selet_dtd("3011")) //主泵状态 { Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStart + "]";//主泵状态 - } + }//主泵状态 else { Sys_log = Sys_log + "\n" + Resources.PumpSpeed + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1020"))) + "% => [" + Resources.PumpStops + "]";//主泵状态 @@ -1045,14 +1083,13 @@ namespace DyeingComputer.ViewModel }//溢流/o型 else if (S16 == 1) //气流 { - Sys_log = Sys_log + "\n" + Resources.DifferentialPressure + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1021"))) + "%"; - Sys_log = Sys_log + "\n" + Resources.Blower + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1044"))) + "%"; + Sys_log = Sys_log + "\n" + Resources.DifferentialPressure + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1044"))) + "%"; + Sys_log = Sys_log + "\n" + Resources.Blower + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1021"))) + "%"; Sys_log = Sys_log + "\n" + Resources.GuidingWheel + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1046"))) + "M/min"; Sys_log = Sys_log + "\n" + Resources.Nozzle + Resources.Flowmeter + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1045"))) + "L/min"; } else if (S16 == 2) //桶纱 { } - Sys_log = Sys_log + "\n-------------------------------------------------------"; if (SM01 == 1) { @@ -1096,19 +1133,18 @@ namespace DyeingComputer.ViewModel } private async void IO_data()//刷新 { - - updata_dtm("1001", LINK_RUN); - updata_dtm("1002", LINK_ERR); - updata_dtm("1010", (Convert.ToDouble(Selet_dta("4001")) + MT33)/10); - updata_dtm("1006", Selet_dta("4006")); - updata_dtm("1015", Selet_dta("4007")); - updata_dtm("1016", Selet_dta("4006") * MT16); + Updata_dtm("1001", LINK_RUN); + Updata_dtm("1002", LINK_ERR); + Updata_dtm("1010", (Convert.ToDouble(Selet_dta("4001")) + MT33)/10); + Updata_dtm("1006", Selet_dta("4006")); + Updata_dtm("1015", Selet_dta("4007")); + Updata_dtm("1016", Selet_dta("4006") * MT16); await Task.Run(() => { - for (ushort i = 0; i < DO_L; i++) { updata_dtd((i + 2001).ToString(), DO[i]); } + for (ushort i = 0; i < DO_L; i++) { Updata_dtd((i + 2001).ToString(), DO[i]); } for (ushort i = 0; i < DQ_L; i++) { DQ[i] = Selet_dtd((i + 3001).ToString()); } - for (ushort i = 0; i < RW_L; i++) { updata_dta((i + 4001).ToString(), RW[i]); } + for (ushort i = 0; i < RW_L; i++) { Updata_dta((i + 4001).ToString(), RW[i]); } for (ushort i = 0; i < DW_L; i++) { DW[i] = Convert.ToUInt16(Selet_dta((i + 5001).ToString())); } }); } @@ -1192,7 +1228,7 @@ namespace DyeingComputer.ViewModel return -1; } } - public static void updata_dtm(string key,double Value)//更新M寄存器 + public static void Updata_dtm(string key,double Value)//更新M寄存器 { try { @@ -1212,7 +1248,7 @@ namespace DyeingComputer.ViewModel } } - public static void updata_dtd(string key, bool Value)//更新D寄存器 + public static void Updata_dtd(string key, bool Value)//更新D寄存器 { try { @@ -1231,7 +1267,7 @@ namespace DyeingComputer.ViewModel LogGing.LogGingDATA("UDTD:" + ex.ToString()); } } - public static void updata_dta(string key, int Value)//更新A寄存器 + public static void Updata_dta(string key, int Value)//更新A寄存器 { try { diff --git a/Windows/ViewStep.xaml.cs b/Windows/ViewStep.xaml.cs index d387626..9c44c98 100644 --- a/Windows/ViewStep.xaml.cs +++ b/Windows/ViewStep.xaml.cs @@ -363,19 +363,17 @@ namespace DyeingComputer.Windows case 17: P1N.Text = Properties.Resources.PumpSpeed; P2N.Text = Properties.Resources.Blower; - P3N.Text = Properties.Resources.Pressure; - P4N.Text = Properties.Resources.Nozzle; - P5N.Text = Properties.Resources.Wiggle; + P3N.Text = Properties.Resources.Nozzle; P1.Visibility = Visibility.Visible; P1N.Visibility = Visibility.Visible; P2.Visibility = Visibility.Visible; P2N.Visibility = Visibility.Visible; P3.Visibility = Visibility.Visible; P3N.Visibility = Visibility.Visible; - P4.Visibility = Visibility.Visible; - P4N.Visibility = Visibility.Visible; - P5.Visibility = Visibility.Visible; - P5N.Visibility = Visibility.Visible; + P4.Visibility = Visibility.Collapsed; + P4N.Visibility = Visibility.Collapsed; + P5.Visibility = Visibility.Collapsed; + P5N.Visibility = Visibility.Collapsed; break; case 20: P1N.Text = Properties.Resources.Medicine + Properties.Resources.Tank;