private void button1_Click(object sender, EventArgs e) { //Доска int a = 1; int b = a++; int c = ++a; int d = b++; this.listBox1.Items.Add($"Values: a={a}, b={b}, c={c}, d={d}"); this.listBox1.Items.Add(string.Empty); //Телеграм Temp temp = new Temp("1", 0, "Один"); temp.Count += 10; // Temp temp1 = new Temp("2", 0, "Два"); // Temp2 tempV = temp; // //this.textBox1.Text = Temp.SetStatVar(); //this.textBox1.Text = tempV.Method2(); //this.textBox1.Text = tempV.Method1().ToString(); //this.textBox1.Text = temp.Method1().ToString(); //this.textBox1.Text = temp1.GetDate(); // this.listBox1.Items.Add($"Object Equals = {temp.Equals(temp1)}"); this.listBox1.Items.Add(string.Empty); // ((ITemp)temp).GetValues(); this.listBox1.Items.Add($"1 Interface Method Result= {temp.Count}"); this.listBox1.Items.Add(string.Empty); // ((ITemp2)temp).GetValues(); this.listBox1.Items.Add($"2 Interface Method Result = {temp.Count}"); this.listBox1.Items.Add(string.Empty); // try { MyException ex = new MyException("My exception!!!"); throw ex; } catch (MyException ex) { this.listBox1.Items.Add($"Exception: {ex.Message}"); this.listBox1.Items.Add(string.Empty); } this.listBox1.Items.Add($"Day (Number) = {(int)DayOfWeek.Friday}"); this.listBox1.Items.Add(string.Empty); // this.listBox1.Items.Add($"Day (Name) = {DayOfWeek.Friday}"); //this.textBox1.Text = DayOfWeek.Friday.ToString(); this.listBox1.Items.Add(string.Empty); }
private void ChangeNameForCopyBase(string LinkDysk, string Link, string Date) { string Temp1; string Temp2; Temp1 = LinkDysk + Link; Temp2 = LinkDysk + Link; Temp2 = Temp2.Remove(Temp2.Length - 4); Temp2 += Date; File.Move(Temp1, Temp2); }
public frmNuevoTemp(int id, bool mod) { Id = id; InitializeComponent(); Farmacia contexto = new Farmacia(); Temp2 temp = contexto.Temp2.Where(x => x.ID_TEMP == id).FirstOrDefault(); txtNombre.Text = temp.NOMBRE; txtComponentes.Text = temp.COMPONENTES; txtPrecio.Text = temp.PRECIO.ToString(); cmbPresentacion.Items.Insert(0, "Seleccionar"); cmbPresentacion.SelectedIndex = 0; button1.Text = "Modificar"; if (!mod) { button1.Text = "Cerrar"; txtComponentes.Enabled = false; txtNombre.Enabled = false; cmbPresentacion.Enabled = false; txtPrecio.Enabled = false; } }
public string GetValue(string selectedSetting) { CookerSettings setting = (CookerSettings)Enum.Parse(typeof(CookerSettings), selectedSetting, true); switch (setting) { case CookerSettings.Temp1: return(Temp1.ToString()); case CookerSettings.Temp2: return(Temp2.ToString()); case CookerSettings.Temp3: return(Temp3.ToString()); case CookerSettings.Temp4: return(Temp4.ToString()); default: return(""); } }
private void ParsingData(string rxData) { int Temp1, Temp2; string nodeID = ""; string groupID = ""; string command = ""; string temperature = ""; string humidity = ""; string co2 = ""; string movement = ""; string datalength = ""; string device = ""; DateTime t = DateTime.Now; string format = "yyyy-MM-dd HH:mm:ss"; try { nodeID = rxData.Substring(5, 4); groupID = rxData.Substring(10, 4); datalength = rxData.Substring(15, 2); device = rxData.Substring(17, 2); command = rxData.Substring(19, 2); } catch (Exception ex) { Console.WriteLine(ex.Message); } if (device == "11") // Device Check { if (command == "10" || command == "11") { // 설정 정보 요청/변경 || 설정 정보 응답 if (datalength == "07") // Length Check { } else { Console.WriteLine("Setting Info Data ERROR!!"); } } else if (command == "21") { // 센서 정보 응답 if (datalength == "0A") // Length Check { // Temperature Temp1 = Convert.ToInt32(rxData.Substring(21, 2), 16); Temp2 = Convert.ToInt32(rxData.Substring(23, 2), 16); temperature = Temp1.ToString() + "." + Temp2.ToString(); // Humidity Setting Temp1 = Convert.ToInt32(rxData.Substring(25, 2), 16); Temp2 = Convert.ToInt32(rxData.Substring(27, 2), 16); humidity = Temp1.ToString() + "." + Temp2.ToString(); // CO2 Setting Temp1 = Convert.ToInt32(rxData.Substring(29, 4), 16); co2 = Temp1.ToString(); // Movement Setting movement = rxData.Substring(33, 2); /* * if (rxData.Substring(33, 2) == "01") * { * movement = "Motion Detected"; * } * else * { * movement = "No Motion Detected"; * }*/ // DataBase Insert insertData(t.ToString(format), nodeID, groupID, temperature, humidity, co2, movement); } else { Console.WriteLine("Sensor Info Data ERROR!!"); } } else if (command == "31") { // 움직임 정보 푸시 if (datalength == "04") // Length Check { if (rxData.Substring(21, 2) == "00") { Console.WriteLine("No Motion Detected"); } else { Console.WriteLine("Motion Detected"); } } else { Console.WriteLine("Movement Info Data ERROR!!"); } } else if (command == "E0") { // 리포트 설정 if (datalength == "08") // Length Check { } else { Console.WriteLine("Report Info Data ERROR!!"); } } } }