private TabItem GetPageTabItem(IPropertyPage page) { if (page == null) return null; if (page.IsCloseable) { ClosableTab theTabItem = new ClosableTab(); theTabItem.Height = LookAndFeel.TabItemHeight; theTabItem.Title = ((IPropertyPage)page).PageTitle; theTabItem.Content = page; return theTabItem; } else { TabItem tabItem = new TabItem(); tabItem.Height = LookAndFeel.TabItemHeight; tabItem.Header = ((IPropertyPage)page).PageTitle; tabItem.Foreground = Brushes.Red; tabItem.Content = page; return tabItem; } }
public void SetParentTabControl(ClosableTab parentTabControl) { _parentTabControl = parentTabControl; _parentTabControl.TabClosing += _parentTabControl_TabClosing; }
public static void LoadVehicleInfoWindow(VehicleAdminObject vehicle, VehicleInfoWindow.VehicleInfoWindowTabs startTab) { try { if (vehicle == null) { throw new NullReferenceException("Load vehicle info window requires non null vehicle"); } else { IAdminItemCache tempCache = vehicle.Cache; //THIS FORCES VEHICLE TO REFRESH //vehicle = new VehicleAdminObject(vehicle.ObjectId); vehicle.Cache = tempCache; VehicleInfoWindow window = new VehicleInfoWindow(vehicle, startTab); if (CacheManager.MainTabControl == null) { throw new NotImplementedException("MainTabControl == null"); } ClosableTab tabItem = new ClosableTab(); tabItem.BackGroundColor = LookAndFeel.VehicleTabColor; window.SetParentTabControl(tabItem); tabItem.Height = LookAndFeel.TabItemHeight; tabItem.Title = vehicle.Year + ": " + vehicle.Make + " " + vehicle.Model; tabItem.Content = window; CacheManager.MainTabControl.Items.Add(tabItem); tabItem.Focus(); //window.Show(); //CacheManager.ActiveUser.AddPage(window); } } catch (Exception ex) { MessageBox.Show("ERROR: Try to load LoadVehicleInfoWindow again\n" + ex.StackTrace); } }