private void MoveSessionButton_Click(object sender, RoutedEventArgs e) { if (!(DataContext is SchedulerViewModel schedulerVM)) { return; } if (sender is Button button && button.Tag != null) { var editWindow = new ModalOkCancelWindow(); editWindow.Width = 300; editWindow.Height = 200; var content = new UserControl(); var grid = new Grid(); var textBlock = new TextBlock(); textBlock.Inlines.Add("Dies ist ein Text"); grid.Children.Add(textBlock); editWindow.Title = "Select Schedule"; if (!(button.Tag is SessionViewModel sessionVM)) { return; } var currentScheduleVM = sessionVM.Schedule; var stackPanel = new StackPanel { Orientation = Orientation.Vertical }; var description = new TextBlock(); description.Inlines.Add("Select target Schedule"); stackPanel.Children.Add(description); var schedules = schedulerVM.Schedules.Where(x => x.ScheduleId != currentScheduleVM.ScheduleId); var comboBox = new ComboBox { ItemsSource = schedules, SelectedIndex = 0, DisplayMemberPath = "Name" }; stackPanel.Children.Add(comboBox); content.Content = stackPanel; editWindow.ModalContent = content; //editWindow.Content = content; if (editWindow.ShowDialog() == true) { var targetSchedule = comboBox.SelectedItem as ScheduleViewModel; schedulerVM.MoveSessionToSchedule(sessionVM.Model, currentScheduleVM.Model, targetSchedule.Model); } } }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { if (sender is Hyperlink link && ViewModel != null) { var createWindow = new ModalOkCancelWindow(); createWindow.Height = 300; createWindow.Width = 300; createWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; var content = new RegisterUserControl(); if (content.DataContext is CreateUserViewModel createUserVM) { createWindow.Content = content; if (createWindow.ShowDialog() == true) { ViewModel.UserName = createUserVM.UserName; ViewModel.SetPassword(null); PasswordTextBox.Clear(); } } } }