public ViewTabBase AddNewTab(string tabheader, UserControl content, Uri uriIcon) { ViewTabBase v = new ViewTabBase(tabheader, content, uriIcon); OpenTabs.Add(v); SelectedTab = v; return(v); }
public void CloseTab(ViewTabBase v) { CancelEventArgs e = new CancelEventArgs(); if (v != null) { v.ValidateClose(e); } if (!e.Cancel) { OpenTabs.Remove(v); } }
public ViewTabBase AddNewTab(string tabheader, Type typeContent, bool openExisting, Uri uriIcon) { ViewTabBase v; if (openExisting) { if (typeContent.BaseType.FullName == "System.Windows.Forms.UserControl") { v = GetOpenTabForm(typeContent); if (v == null) { v = new ViewTabBase(tabheader, new WindowsForms_Viewer(Activator.CreateInstance(typeContent) as System.Windows.Forms.UserControl), uriIcon); OpenTabs.Add(v); } } else { v = GetOpenTab(typeContent); if (v == null) { v = new ViewTabBase(tabheader, Activator.CreateInstance(typeContent) as UserControl, uriIcon); OpenTabs.Add(v); } } } else { v = new ViewTabBase(tabheader, (typeContent.BaseType.FullName == "System.Windows.Forms.UserControl" ? new WindowsForms_Viewer(Activator.CreateInstance(typeContent) as System.Windows.Forms.UserControl) : Activator.CreateInstance(typeContent) as UserControl), uriIcon); OpenTabs.Add(v); } SelectedTab = v; return(v); }