private void OnFileSave(object sender, string path) { FolderViewer folderViewer = sender as FolderViewer; if (SaveFile != null) { SaveFile(sender, folderViewer.UserInfo, path); } }
/// Append User Folder Viewer public int Append(UserInfo userInfo, string label) { FolderViewer folderViewer = LookupPage(userInfo); int npage; // Page Already Exists if (folderViewer != null) { npage = PageNum(folderViewer); // Set New Page as Current Page CurrentPage = npage; } else { // Initialize Tab Label TabLabel tabLabel = new TabLabel(label); tabLabel.Button.Clicked += new EventHandler(OnCloseTab); // Initialize Folder Viewer folderViewer = new FolderViewer(userInfo); folderViewer.SaveFile += new StringEventHandler(OnFileSave); folderViewer.FileSend += new FileSendEventHandler(OnFileSend); folderViewer.DirChanged += new BoolEventHandler(OnBoolEventHandler); folderViewer.FolderRefresh += new StringEventHandler(OnFolderRefresh); folderViewer.DirectoryAdded += new ObjectEventHandler(OnStoreDirAdded); folderViewer.FileAdded += new ObjectEventHandler(OnStoreFileAdded); // Refresh Folder Viewer folderViewer.Refresh(); // Add TabLabel -> UserInfo this.tabs.Add(tabLabel.Button, userInfo); // Add UserInfo -> FolderViewer this.pages.Add(userInfo, folderViewer); // Append Page To Notebook npage = AppendPage(folderViewer, tabLabel); } // Show All (Refresh Notebook Viewer) this.ShowAll(); return(npage); }
/// Remove User Folder Viewer public void Remove(UserInfo userInfo) { FolderViewer folderViewer = LookupPage(userInfo); if (folderViewer != null) { // Remove Folder Viewer Event folderViewer.SaveFile -= new StringEventHandler(OnFileSave); folderViewer.FileSend -= new FileSendEventHandler(OnFileSend); folderViewer.DirChanged -= new BoolEventHandler(OnBoolEventHandler); folderViewer.FolderRefresh -= new StringEventHandler(OnFolderRefresh); folderViewer.DirectoryAdded -= new ObjectEventHandler(OnStoreDirAdded); folderViewer.FileAdded -= new ObjectEventHandler(OnStoreFileAdded); // Remove TabLabel -> UserInfo TabLabel tabLabel = (TabLabel)GetTabLabel(folderViewer); tabLabel.Button.Clicked -= new EventHandler(OnCloseTab); this.tabs.Remove(tabLabel.Button); // Remove UserInfo -> FolderViewer this.pages.Remove(userInfo); // Remove Folder Viewer int npage = PageNum(folderViewer); RemovePage(npage); // Remove Tab Event if (TabRemoved != null) { TabRemoved(this, folderViewer); } // Show All (Refresh Notebook Viewer) this.ShowAll(); } }