示例#1
0
 private void MakeLongList(Fach Fach)
 {
     try
     {
         Grid g = new Grid();
         RowDefinition r = new RowDefinition() { Height = GridLength.Auto };
         g.RowDefinitions.Add(r);
         LongListSelector listBox = new LongListSelector
         {
             IsGroupingEnabled = false,
             ItemTemplate = (DataTemplate)Resources["FachTemplate"],
             
        };
         Button b = new Button();
         b.Content = "zur Übersicht";
         b.Tap += b_Tap;
         b.Margin = new Thickness(0, 30, 0, 80);
         listBox.ListFooter = b;
         if (Fach.noten.Count == 0)
         {
             List<Note> note = new List<Note>() { new Note(true) };
             listBox.ItemsSource = note;
         }
         else
         {
             listBox.ItemsSource = Fach.noten;
         }
         listBox.Tap += listBox_Tap;
         listBox.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Visible);
         listBox.SetValue(TurnstileFeatherEffect.FeatheringIndexProperty, -1);
         longlistselectors.Add(listBox);
         g.Children.Add(listBox);
         ScrollViewer sv = new ScrollViewer();
         sv.Content = g;
         PivotItem pi = new PivotItem();
         TextBlock t = new TextBlock() { Text = Fach.Name };
         pi.Header = t;
         pi.Content = sv;
         Noten.Items.Add(pi);
     }
     catch (Exception e) { MessageBox.Show("Darstellung fehlgeschlagen. Exeption: " + e); }
 }
示例#2
0
 private void Button_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (Variables.activeFach != null)
     {
         Variables.activeFach.color = Farbe.SelectedIndex;
         Variables.activeFach.SetLehrer(null, Lehrperson.Text);
     }
     else
     {
         List<Fach> list = Helper.MakeFachListContrary();
         Fach f = fachpicker.SelectedItem as Fach;
         if (Lehrperson.Text.Trim().Count() == 0)
         {
             Lehrperson.Background = new SolidColorBrush(Colors.Red);
             return;
         }
         else
         {
             Lehrperson.Background = new SolidColorBrush(Colors.White);
         }
         if (f.lektion == Lektion.Anderes && f.customfach == null)
         {
             if (fächer2.Text.Trim() != "")
             {
                 Fach fach = new Fach() { color = Farbe.SelectedIndex, index = 1000, isActive = true, lektion = Lektion.Anderes, customfach = fächer2.Text };
                 fach.SetLehrer(null, Lehrperson.Text);
                 Variables.Fächer.Insert(Variables.Fächer.Count - 1, fach);
                 NavigationService.Navigate(new Uri("/Fachsortieren.xaml?delete=true", UriKind.Relative));
                 return;
             }
             else
             {
                 fächer2.Background = new SolidColorBrush(Colors.Red);
                 return;
             }
         }
         list[fachpicker.SelectedIndex].isActive = true;
         list[fachpicker.SelectedIndex].index = Helper.MakeFachList().Count;
         list[fachpicker.SelectedIndex].color = Farbe.SelectedIndex;
         list[fachpicker.SelectedIndex].SetLehrer(null, Lehrperson.Text);
     }
     NavigationService.Navigate(new Uri("/Fachsortieren.xaml?delete=true", UriKind.Relative));
 }
示例#3
0
 public void SetFach(Fach f)
 {
     for (int i = 0; i < Variables.Fächer.Count; i++)
     {
         if (f == Variables.Fächer[i])
         {
             fach = i;
             return;
         }
     }
 }
示例#4
0
 public FachSaveObject(Fach f)
 {
     this.lehrkraft = f.lehrkraft;
     this.customfach = f.customfach;
     this.lektion = f.lektion;
     this.Schwerpunktfach = f.Schwerpunktfach;
     this.color = f.color;
     this.noten = f.noten;
     this.isActive = f.isActive;
     this.index = f.index;
 }