public DesignerVM() { // trigger the MedcinData static constructor; yeah, it's a hack Console.WriteLine("Loading MedcinTerms ({0}) ...", Terms.ToString()); // instantiate the resource tab this.resourceTab = new DesignerTabVM(this); // first page of template; we leave the resource tab out // so it doesn't interfere with assigning the collection to the tabcontrol later Tabs.Add(new DesignerTabVM(this)); Tabs.Add(new DesignerTabVM(this)); Tabs[0].Name = "Tab 1"; Tabs[1].Name = "Tab 2"; ActiveTab = Tabs[0]; // Register MyCommands AddTabCommand = new MyCommand(ExecuteAddTabCommand); RemoveTabCommand = new MyCommand(ExecuteRemoveTabCommand); CreateNewFormTemplateCommand = new MyCommand(ExecuteCreateNewFormTemplateCommand); ExportTemplateCommand = new MyCommand(ExecuteExportTemplateCommand); Mediator.Instance.Register(this); }
private void ExecuteRemoveTabCommand(object parameter) { if (parameter is DesignerTabVM) { DesignerTabVM tab = (DesignerTabVM)parameter; tabs.Remove(tab); } }
private void ExecuteAddTabCommand(object parameter) { if (parameter is DesignerTabVM) { DesignerTabVM tab = (DesignerTabVM)parameter; tab.ParentForm = this; tabs.Add(tab); } }