コード例 #1
0
        public AddSubject()
        {
            this.InitializeComponent();
            var parent = this.Parent;

            list_of_colors = SubjectColorManager.GetList();
        }
コード例 #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter != null)
            {
                subject = SubjectManager.GetSubject((e.Parameter as Subject).id);
                tbx_Name_AddSubject.Text                = subject.subject_name;
                tbx_Teacher_AddSubject.Text             = subject.teacher;
                gvw_ColorPicker_AddSubject.SelectedItem = SubjectColorManager.GetList().Find(x => x.name == subject.color.name);

                edit = true;
            }
        }
コード例 #3
0
        private void btn_DoneAddSubject_Click(object sender, RoutedEventArgs e)
        {
            bool erfolgreich = true;

            if (edit)
            {
                SubjectManager.EditSubject(subject.id, tbx_Name_AddSubject.Text, tbx_Teacher_AddSubject.Text, SubjectColorManager.GetList().Find(x => x.name == (gvw_ColorPicker_AddSubject.SelectedItem as SubjectColor).name));
            }
            else
            {
                erfolgreich = SubjectManager.AddSubject(tbx_Name_AddSubject.Text, tbx_Teacher_AddSubject.Text, (SubjectColor)gvw_ColorPicker_AddSubject.SelectedItem);
            }
            if (erfolgreich == true)
            {
                Frame.GoBack();
            }
        }