Example #1
0
        private void EditProgramMethod()
        {
            TV_ProgramDTO EditedProgram = new TV_ProgramDTO
            {
                Actors           = SelectedProgram.Actors,
                AvatarSourcePath = SelectedProgram.AvatarSourcePath,
                Description      = SelectedProgram.Description,
                Name             = SelectedProgram.Name,
                YearEstablished  = SelectedProgram.YearEstablished
            };

            EditProgramWindow editWindow = new EditProgramWindow(EditedProgram);

            if (editWindow.ShowDialog() == true)
            {
                SelectedProgram.Actors           = EditedProgram.Actors;
                SelectedProgram.AvatarSourcePath = EditedProgram.AvatarSourcePath;
                SelectedProgram.Description      = EditedProgram.Description;
                SelectedProgram.Name             = EditedProgram.Name;
                SelectedProgram.YearEstablished  = EditedProgram.YearEstablished;
                _dataProvider.EditProgram(oldValue: SelectedProgram, newValue: EditedProgram);
                if (OnSelectedProgramChanged != null)
                {
                    OnSelectedProgramChanged.Invoke();
                }
                CardsWrapPanel.ReloadCard(SelectedProgram);
            }
        }
Example #2
0
        private void AddNewProgram_Click(object sender, RoutedEventArgs e)
        {
            TV_ProgramDTO     EditedProgram = new TV_ProgramDTO();
            EditProgramWindow editWindow    = new EditProgramWindow(EditedProgram);

            if (editWindow.ShowDialog() == true)
            {
                _dataProvider.AddProgram(EditedProgram);
                AllPrograms.Add(EditedProgram);
            }

            if (SelectedProgram == null)
            {
                CardsWrapPanel.SelectedItem = AllPrograms[0];
            }
        }