private void RemoveFileView(FileViewTab fileView) { bool found = this.FileViewTabs.TabPages.Cast<FileViewTab>().Any(tab => tab == fileView); if(found) this.FileViewTabs.TabPages.Remove(fileView); }
private void RemoveFileView(FileViewTab fileView) { bool found = this.FileViewTabs.TabPages.Cast <FileViewTab>().Any(tab => tab == fileView); if (found) { this.FileViewTabs.TabPages.Remove(fileView); } }
public void AddFileView(FileViewType type, string filePath) { if (!File.Exists(filePath)) { EventDispatcher.Raise(new UserNotificationEvent("File '{0}' not found".FormatWith(filePath), UserNotificationType.Warning)); return; } var tab = new FileViewTab(filePath, new ClassDiagramView(filePath)); tab.ContextMenu = new ContextMenu(new []{new MenuItem("Close", (sender, args) => { MenuItem item = (MenuItem) sender; FileViewTab t = (FileViewTab) item.Tag; RemoveFileView(t); }){Tag = tab} }); this.FileViewTabs.TabPages.Add(tab); this.FileViewTabs.SelectedTab = tab; }
public void AddFileView(FileViewType type, string filePath) { if (!File.Exists(filePath)) { EventDispatcher.Raise(new UserNotificationEvent("File '{0}' not found".FormatWith(filePath), UserNotificationType.Warning)); return; } var tab = new FileViewTab(filePath, new ClassDiagramView(filePath)); tab.ContextMenu = new ContextMenu(new [] { new MenuItem("Close", (sender, args) => { MenuItem item = (MenuItem)sender; FileViewTab t = (FileViewTab)item.Tag; RemoveFileView(t); }) { Tag = tab } }); this.FileViewTabs.TabPages.Add(tab); this.FileViewTabs.SelectedTab = tab; }