public StartPage() { Serializer = new Serializer(); InitializeComponent(); Serializer.GetSettings(); Serializer.TermList.Clear(); if (Serializer.Settings.ListOfSubjects.Count == 0) { WelcomeWindow welcomeWindow = new WelcomeWindow(); welcomeWindow.ShowDialog(); GetSubjList(welcomeWindow); } else { _listOfSubjects = Serializer.Settings.ListOfSubjects; } foreach (var subject in _listOfSubjects) { ComboBoxSubject.Items.Add(subject); } if (Serializer.Settings.Class != 0) { ComboBoxGrade.SelectedIndex = Serializer.Settings.Class - 1; } if (ComboBoxSubject.Items.Contains(Serializer.Settings.Subject)) { ComboBoxSubject.SelectedIndex = ComboBoxSubject.Items.IndexOf(Serializer.Settings.Subject); } }
private void GetSubjList(WelcomeWindow welcomeWindow) { if (welcomeWindow.CheckedList.Count > 0) { Serializer.Settings.ListOfSubjects = new List <string>(welcomeWindow.CheckedList); _listOfSubjects = welcomeWindow.CheckedList; Serializer.SaveSettings(); } else { _listOfSubjects = _standartListOfSubjects; } }
private void ButtonEditSubjList_OnClick(object sender, RoutedEventArgs e) { WelcomeWindow changeSubjWelcomeWindow = new WelcomeWindow(); changeSubjWelcomeWindow.lblFirstTime.Content = "Выберите нужные предметы"; changeSubjWelcomeWindow.lblFirstTime.HorizontalContentAlignment = HorizontalAlignment.Center; changeSubjWelcomeWindow.imgCherry.Visibility = Visibility.Hidden; changeSubjWelcomeWindow.lblAppName.Visibility = Visibility.Hidden; changeSubjWelcomeWindow.lblQMark.Visibility = Visibility.Hidden; changeSubjWelcomeWindow.ShowDialog(); GetSubjList(changeSubjWelcomeWindow); ComboBoxSubject.Items.Clear(); foreach (var subject in _listOfSubjects) { ComboBoxSubject.Items.Add(subject); } }