private void initStdplan() { col1.Binding = new Binding("Montag"); col2.Binding = new Binding("Dienstag"); col3.Binding = new Binding("Mittwoch"); col4.Binding = new Binding("Donnerstag"); col5.Binding = new Binding("Freitag"); Stunde s = new Stunde("mon", "1", "hui"); Stunde s2 = new Stunde("di", "2", "tui"); Stunde s3 = new Stunde("mit", "3", "aa1"); Stunde s4 = new Stunde("don", "4", "aaa"); Stunde s5 = new Stunde("frei", "5", "444"); Stundenplan st = new Stundenplan { Montag = s, Dienstag = s2, Mittwoch = s3, Donnerstag = s4, Freitag = s }; Stundenplan st2 = new Stundenplan { Montag = s2, Dienstag = s, Mittwoch = s3, Donnerstag = s5, Freitag = s4 }; //Stunde data = new Stunde { Montag = "Harry Potter", Dienstag = "J. K. Rollings", Mittwoch = "Mistery", Donnerstag = "H-I", Freitag = " 3 " }; // Stunde data2 = new Stunde { Montag = "Deutsch", Dienstag = "Mathe", Mittwoch = "Pos", Donnerstag = "Deutsch", Freitag = " E" }; //dataGrid.Items.Add(data); dataGrid.Items.Add(st); dataGrid.Items.Add(st2); }
private void button_Click_1(object sender, RoutedEventArgs e) { Stundenplan sp = (Stundenplan)dataGrid.SelectedCells[0].Item; string s = dataGrid.SelectedCells[0].Column.Header.ToString(); switch (s) { case "Montag": MessageBox.Show(sp.Montag.ToString()); break; case "Dienstag": MessageBox.Show(sp.Dienstag.ToString()); break; case "Mittwoch": MessageBox.Show(sp.Mittwoch.ToString()); break; case "Donnerstag": MessageBox.Show(sp.Donnerstag.ToString()); break; case "Freitag": MessageBox.Show(sp.Freitag.ToString()); break; } }
private void initStdplan() { // string json = c.Get(@"http://*****:*****@"http://localhost:8080/WebServiceSchoopy/webresources/lessons/114b")); List <Lesson> deserializedProduct = JsonConvert.DeserializeObject <List <Lesson> >(json); col1.Binding = new Binding("Montag"); col2.Binding = new Binding("Dienstag"); col3.Binding = new Binding("Mittwoch"); col4.Binding = new Binding("Donnerstag"); col5.Binding = new Binding("Freitag"); for (int i = 0; i < deserializedProduct.Count; i++) { Stundenplan curSP = new Stundenplan(); Lesson l = deserializedProduct[i]; if (l.schoolHour == i + 1) { switch (l.weekday) { case Weekday.MONDAY: curSP.Montag = l; break; case Weekday.TUESDAY: curSP.Dienstag = l; break; case Weekday.WEDNESDAY: curSP.Mittwoch = l; break; case Weekday.THURSDAY: curSP.Donnerstag = l; break; case Weekday.FRIDAY: curSP.Freitag = l; break; default: break; } } dataGrid.Items.Add(curSP); } }
private void button_Click_1(object sender, RoutedEventArgs e) { try { Stundenplan sp = (Stundenplan)dataGrid.SelectedCells[0].Item; string s = dataGrid.SelectedCells[0].Column.Header.ToString(); switch (s) { case "Montag": LessonDetail win2 = new LessonDetail(sp.Montag); win2.Show(); break; case "Dienstag": LessonDetail win3 = new LessonDetail(sp.Dienstag); win3.Show(); break; case "Mittwoch": LessonDetail win4 = new LessonDetail(sp.Mittwoch); win4.Show(); break; case "Donnerstag": LessonDetail win5 = new LessonDetail(sp.Donnerstag); win5.Show(); break; case "Freitag": LessonDetail win6 = new LessonDetail(sp.Freitag); win6.Show(); break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }