Ejemplo n.º 1
0
        private void btnEditShow_Click(object sender, RoutedEventArgs e)
        {
            if (mvm.SelectedShow != null)
            {
                AddEditShowDialog cd = new AddEditShowDialog();
                cd.Title = "Redigér forestilling";
                cd.dpShowDate.SelectedDate = mvm.SelectedShow.ShowDateTime;
                cd.tbShowTime.Text         = $"{mvm.SelectedShow.ShowDateTime.Hour}:{mvm.SelectedShow.ShowDateTime.Minute}";

                if ((bool)cd.ShowDialog())
                {
                    if (mvm.SelectedShow.ShowDateTime != cd.ShowDateTime)
                    {
                        mvm.UpdateShow(mvm.SelectedShow, cd.ShowDateTime);
                    }
                }
            }
            else
            {
                MessageBox.Show($"Ingen forestilling er valgt. Vælg først en.", "Kan ikke redigere forestilling", MessageBoxButton.OK);
            }
        }
Ejemplo n.º 2
0
        private void btnAddShow_Click(object sender, RoutedEventArgs e)
        {
            AddEditShowDialog cd = new AddEditShowDialog();

            cd.Title = "Tilføj ny forestilling";

            if ((bool)cd.ShowDialog())
            {
                try
                {
                    mvm.AddShow(cd.ShowDateTime);
                }
                catch (NotImplementedException)
                {
                    MessageBox.Show("Denne funktionalitet er endnu ikke implementeret!", "Kan ikke tilføje forestilling", MessageBoxButton.OK);
                }
                catch (Exception)
                {
                    MessageBox.Show($"Forestillingen {cd.ShowDateTime} eksisterer allerede. Prøv igen.", "Kan ikke tilføje forestilling", MessageBoxButton.OK);
                }
            }
        }