/****************/ /* CloseTabItem */ /****************/ public void CloseTabItem( ClosableTab theTabItem) { if (theTabItem.Content is AgendaBrowser) { agendaBrowserManager.RemoveBrowser((AgendaBrowser)theTabItem.Content); ((AgendaBrowser)theTabItem.Content).DetachIDE(); } if (theTabItem.Content is EntityBrowser) { EntityBrowser theBrowser = theTabItem.Content as EntityBrowser; if (factBrowserManager.ManagesBrowser(theBrowser)) { factBrowserManager.RemoveBrowser(theBrowser); } else if (instanceBrowserManager.ManagesBrowser(theBrowser)) { instanceBrowserManager.RemoveBrowser(theBrowser); } theBrowser.DetachIDE(); } windowCount--; theTabItem.TabClosedEvent -= CloseTabItem; if (windowCount == 0) { this.mainGrid.RowDefinitions[3].Height = new GridLength(0); this.dialog.Focus(); } }
/****************************/ /* InstanceBrowser_Executed */ /****************************/ private void InstanceBrowser_Executed( object sender, ExecutedRoutedEventArgs e) { if (instanceBrowserManager.BrowserCount() == 0) { ClosableTab theTabItem = new ClosableTab(); theTabItem.Title = "Instances"; OpenTabItem(theTabItem); EntityBrowser theBrowser = instanceBrowserManager.CreateBrowser(); theBrowser.entityDataGridView.Columns[0].Header = "Name"; theBrowser.entityDataGridView.Columns[1].Header = "Class"; theTabItem.Content = theBrowser; } else { foreach (ClosableTab theTabItem in this.debugTabControl.Items) { if (theTabItem.Content is EntityBrowser) { EntityBrowser theBrowser = theTabItem.Content as EntityBrowser; if (instanceBrowserManager.ManagesBrowser(theBrowser)) { OpenExistingTabItem(theTabItem); return; } } } } }
/**************************/ /* AgendaBrowser_Executed */ /**************************/ private void AgendaBrowser_Executed( object sender, ExecutedRoutedEventArgs e) { if (agendaBrowserManager.BrowserCount() == 0) { ClosableTab theTabItem = new ClosableTab(); theTabItem.Title = "Agenda"; OpenTabItem(theTabItem); AgendaBrowser theBrowser = agendaBrowserManager.CreateBrowser(); theTabItem.Content = theBrowser; } else { foreach (ClosableTab theTabItem in this.debugTabControl.Items) { if (theTabItem.Content is AgendaBrowser) { AgendaBrowser theBrowser = theTabItem.Content as AgendaBrowser; if (agendaBrowserManager.ManagesBrowser(theBrowser)) { OpenExistingTabItem(theTabItem); return; } } } } }
/***********************/ /* OpenExistingTabItem */ /***********************/ public void OpenExistingTabItem( ClosableTab theTabItem) { if (this.mainGrid.RowDefinitions[3].Height.Value == 0.0) { this.mainGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star); this.mainGrid.RowDefinitions[3].Height = new GridLength(1, GridUnitType.Star); } theTabItem.Focus(); }
/***************/ /* OpenTabItem */ /***************/ public void OpenTabItem( ClosableTab theTabItem) { if (this.mainGrid.RowDefinitions[3].Height.Value == 0.0) { this.mainGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star); this.mainGrid.RowDefinitions[3].Height = new GridLength(1, GridUnitType.Star); } theTabItem.TabClosedEvent += new TabClosedDelegate(CloseTabItem); this.debugTabControl.Items.Add(theTabItem); windowCount++; theTabItem.Focus(); }