private void GetIntensity_Click(object sender, RoutedEventArgs e) { saved = false; count++; string p = Nadklasa.slowo(Rodzic.Rodzic.Tablica[idTab].AskIntensity(idMod), 1); Actual.Text = p + " lm"; }
private void GetDistance_Click(object sender, RoutedEventArgs e) { saved = false; count++; string p = Rodzic.Rodzic.Tablica[idTab].AskDistance(idMod); Actual.Text = Nadklasa.slowo(p, 1); }
public bool CheckConnection() { string adresIP = IP.Text; string port = Port.Text; if (!Nadklasa.Init(adresIP, port)) { return(false); } Console.WriteLine(Nadklasa.SendMessage("HLL\n")); return(true); }
private void SaveIntensity_Click(object sender, RoutedEventArgs e) { string p = Actual.Text; if (p == "NONE") { MessageBox.Show("You Have not measured a thing yet"); return; } if (saved) { MessageBox.Show("You are trying to save the same result twice"); return; } saved = true; Console.WriteLine(p); Dane.Items.Add("Measure nr" + count.ToString() + ": " + Nadklasa.slowo(p, 1) + " lumens"); }
private void GetRGB_Click(object sender, RoutedEventArgs e) { saved = false; count++; string p = Rodzic.Rodzic.Tablica[idTab].AskRGB(idMod); //Console.WriteLine(p); //Console.WriteLine(Nadklasa.slowo(p, 1) + Nadklasa.slowo(p, 2) + Nadklasa.slowo(p, 3)); Actual.Text = Nadklasa.slowo(p, 1) + " " + Nadklasa.slowo(p, 2) + " " + Nadklasa.slowo(p, 3); //Console.WriteLine(Nadklasa.slowo(p, 1)); //Console.WriteLine(Nadklasa.slowo(p, 2)); //Console.WriteLine(Nadklasa.slowo(p, 3)); byte R = Convert.ToByte(Nadklasa.slowo(p, 1)); byte G = Convert.ToByte(Nadklasa.slowo(p, 2)); byte B = Convert.ToByte(Nadklasa.slowo(p, 3)); Actual.Background = new SolidColorBrush(Color.FromArgb(255, R, G, B)); }
public void LoadModules() { //-------Playground Mode-------- /*CheckBox t = new CheckBox(); * t.Content = "RGB"; * dostepne.listBox1.Items.Add(t); * t = new CheckBox(); * t.Content = "Buzzer"; * dostepne.listBox1.Items.Add(t); * t = new CheckBox(); * t.Content = "Humidity"; * dostepne.listBox1.Items.Add(t); * t = new CheckBox(); * t.Content = "Temperature"; * dostepne.listBox1.Items.Add(t); * t = new CheckBox(); * t.Content = "Distance"; * dostepne.listBox1.Items.Add(t); * t = new CheckBox(); * t.Content = "Light"; * dostepne.listBox1.Items.Add(t); * t = new CheckBox(); * t.Content = "Light"; * dostepne.listBox1.Items.Add(t); * return;*/ //------------------------------ string modolki = Nadklasa.SendMessage("ASK\n"); int dl = wyluskaj(modolki); int val = Convert.ToInt32(modolki.Substring(0, dl)); for (int i = 0; i < val; i++) { string nazwa = map[modolki.Substring(dl + 1 + 4 * i, 3)]; CheckBox temp = new CheckBox(); temp.Content = nazwa; dostepne.listBox1.Items.Add(temp); } }
private void Switch_Click(object sender, RoutedEventArgs e) { //-------playground mode ----------- /*if (ON == false) * { * ON = true; * Switch.Content = "Switch OFF"; * } * else * { * ON = false; * Switch.Content = "Switch ON"; * } * return;*/ //---------------------------------- string q = (string)Switch.Content; if (q[0] == 'C') { string pom = Rodzic.Rodzic.Tablica[idTab].AskIntensity(idMod); pom = Nadklasa.slowo(pom, 2); if (pom == "OFF") { Switch.Content = "Turn the\n lamp ON"; LampState.Text = "OFF"; } else { Switch.Content = "Turn the\n lamp OFF"; LampState.Text = "ON"; } return; } if (LampState.Text == "OFF") { string x = Rodzic.Rodzic.Tablica[idTab].SwitchLampkaON(idMod); Console.WriteLine(x); if (x == "OK\n") { Switch.Content = "Switch OFF"; LampState.Text = "ON"; } else { MessageBox.Show("Unexpected problem trying to switch the sensor on"); } } else { string x = Rodzic.Rodzic.Tablica[idTab].SwitchLampkaOFF(idMod); Console.WriteLine(x); if (x == "OK\n") { LampState.Text = "OFF"; Switch.Content = "Switch ON"; } else { MessageBox.Show("Unexpected problem trying to switch the sensor off"); } } }