private void AddEmptyPage() { if (pageCollection.Count > 0) { var pageVM = new AdvancedPageViewModel("empty"); var page = pageCollection[pageCollection.Count - 1] as AdvancedPageView; if (page != null) { var previousPageVM = page.DataContext as AdvancedPageViewModel; if (previousPageVM != null) { previousPageVM.CurrentPanel.NextPanel = pageVM.CurrentPanel; } } pageCollection.Add(new AdvancedPageView { DataContext = pageVM }); } else { var pageVM = new AdvancedPageViewModel("test"); pageCollection.Add(new AdvancedPageView { DataContext = pageVM }); } }
public PageViewModel(ScoreLayout.AbstractScorePage page) { AdvancedPageViewContent = new AdvancedPageViewModel("asd"); TestCommand = new RelayCommand(OnTestCommand); PageWidth = page.Width; PageHeight = page.Height; scorePage = page; var sPage = page as ScoreLayout.StandardScorePage; if (sPage != null) { sPage.AddListener(ScorePagePropertyChanged); } var canvas = page.GetContent() as Canvas; if (canvas != null) { canvas.Background = Brushes.WhiteSmoke; } PageCanvas.Add(canvas); }
private void AddAdvancedEmptyPage() { if (pageCollection.Count > 0) { var pageVM = new AdvancedPageViewModel(1); pagesVM.Add(pageVM); var page = pageCollection[pageCollection.Count - 1] as AdvancedPageView; if (page != null) { var previousPageVM = page.DataContext as AdvancedPageViewModel; if (previousPageVM != null) { previousPageVM.CurrentPanel.NextPanel = pageVM.CurrentPanel; } } pageCollection.Add(new AdvancedPageView { DataContext = pageVM }); } else { var pageVM = new AdvancedPageViewModel(0); pagesVM.Add(pageVM); var cMenu = new ContextMenu(); var item = new MenuItem() { Header = "Add Next Measure", Command = new RelayCommand(OnAddNextMeasure) }; var item2 = new MenuItem() { Header = "Add All Measures", Command = new RelayCommand(OnAddAllMeasures) }; cMenu.Items.Add(item); cMenu.Items.Add(item2); pageVM.ContextMenu = cMenu; pageCollection.Add(new AdvancedPageView { DataContext = pageVM }); } }