Ejemplo n.º 1
0
        public void EditDiscipline(object snd, RoutedEventArgs s)
        {
            ModifyDiscipline modifyDiscipline = new ModifyDiscipline(DisciplineText, AssignedColor, ColorOfDiscipline);
            bool?            result           = modifyDiscipline.ShowDialog();

            if (result.HasValue)
            {
                KeyValuePair <string, SolidColorBrush> temporary = (KeyValuePair <string, SolidColorBrush>)modifyDiscipline.disciplineCombo.SelectedItem;
                if ((bool)result)
                {
                    DisciplineChange change = new DisciplineChange
                    {
                        NewColor          = temporary.Value,
                        OldDisciplineName = DisciplineText,
                        NewColorName      = temporary.Key,
                        NewDiscipline     = modifyDiscipline.disciplineComboLabel.Text.ToUpper(),
                        DeleteDiscipline  = false,
                        Identity          = ID
                    };
                    disciplineComboLabel.Background = temporary.Value;
                    AssignedColor             = (KeyValuePair <string, SolidColorBrush>)modifyDiscipline.disciplineCombo.SelectedItem;
                    disciplineComboLabel.Text = modifyDiscipline.disciplineComboLabel.Text.ToUpper();
                    DisciplineText            = modifyDiscipline.disciplineComboLabel.Text.ToUpper();
                    ColorIsChanging(change);
                }
                else
                {
                    if (modifyDiscipline.DeleteOrCancel)
                    {
                        DisciplineChange change = new DisciplineChange
                        {
                            NewColor          = temporary.Value,
                            OldDisciplineName = DisciplineText,
                            NewColorName      = temporary.Key,
                            NewDiscipline     = modifyDiscipline.disciplineComboLabel.Text.ToUpper(),
                            DeleteDiscipline  = true,
                            Identity          = ID
                        };
                        ColorIsChanging(change);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 protected virtual void ColorIsChanging(DisciplineChange args)
 {
     ChangingColor?.Invoke(this, args);
 }