private void EditStage(MouseButtonEventArgs e) { e.Handled = true; LineUpBeheerViewModel vm = null; LineUpBeheerStagesViewModel stageVm = null; if (LineUpBeheerViewModel.ViewModel.Window.IsVisible) { vm = LineUpBeheerViewModel.ViewModel; stageVm = LineUpBeheerStagesViewModel.ViewModel; vm.CurrentPage = stageVm; try { stageVm.SelectedItem = (e.Source as FrameworkElement).DataContext as Stage; } catch (Exception) { } LineUpBeheerViewModel.ViewModel.Window.Activate(); return; } BeheerWindow = new LineUpBeheer(); vm = LineUpBeheerViewModel.ViewModel; stageVm = LineUpBeheerStagesViewModel.ViewModel; vm.CurrentPage = stageVm; try { stageVm.SelectedItem = (e.Source as FrameworkElement).DataContext as Stage; } catch (Exception) { } BeheerWindow.Show(); }//on mousedown of a stage, navigate to the beheer of that stage
} //binded to a mouseup event of a performance in the lineup control private void EditPerformance(MouseButtonEventArgs e) { e.Handled = true; LineUpBeheerViewModel vm = null; LineUpBeheerOptredensViewModel vmOptredens = null; if (LineUpBeheerViewModel.ViewModel.Window.IsVisible) { vm = LineUpBeheerViewModel.ViewModel; vmOptredens = LineUpBeheerOptredensViewModel.ViewModel; vm.CurrentPage = vmOptredens; try { vmOptredens.SelectedItem = (e.Source as Grid).DataContext as Optreden; } catch (Exception) { } LineUpBeheerViewModel.ViewModel.Window.Activate(); return; } BeheerWindow = new LineUpBeheer(); vm = LineUpBeheerViewModel.ViewModel; vmOptredens = LineUpBeheerOptredensViewModel.ViewModel; vm.CurrentPage = vmOptredens; try { vmOptredens.SelectedItem = (e.Source as Grid).DataContext as Optreden; }catch (Exception) {} BeheerWindow.Show(); }
private void OpenBeheerOp(string name) { BeheerWindow = new LineUpBeheer(); BeheerWindow.Show(); LineUpBeheerViewModel vm = LineUpBeheerViewModel.ViewModel; switch (name) { case "Stages": vm.CurrentPage = LineUpBeheerStagesViewModel.ViewModel; break; case "Bands": vm.CurrentPage = LineUpBeheerBandsViewModel.ViewModel; break; case "Optredens": vm.CurrentPage = LineUpBeheerOptredensViewModel.ViewModel; break; } }//opens the beheer window on a specified page, this is used for the mouseup event on the stages,bands and performances textblocks in the uihint
static LineUpBeheerViewModel() { ViewModel = new LineUpBeheerViewModel(); }