private void m_pToolbar_ButtonClick(object sender,ToolBarButtonClickEventArgs e)
 {
     if(e.Button.Tag.ToString() == "add"){
         if(m_pFolders.SelectedNode == null){
             wfrm_sys_Folder frm = new wfrm_sys_Folder(true,"",false);
             if(frm.ShowDialog(this) == DialogResult.OK){
                 m_pVirtualServer.Users.GetUserByName(m_pUser.Text).Folders.Add(frm.Folder);
                 LoadFolders(frm.Folder);
             }
         }
         else{
             wfrm_sys_Folder frm = new wfrm_sys_Folder(true,"",false);
             if(frm.ShowDialog(this) == DialogResult.OK){
                 UserFolder folder = (UserFolder)m_pFolders.SelectedNode.Tag;
                 folder.ChildFolders.Add(frm.Folder);
                 LoadFolders(frm.Folder);
             }
         }
     }
     else if(e.Button.Tag.ToString() == "edit" && m_pFolders.SelectedNode != null){
         wfrm_sys_Folder frm = new wfrm_sys_Folder(false,m_pFolders.SelectedNode.FullPath,true);
         if(frm.ShowDialog(this) == DialogResult.OK && m_pFolders.SelectedNode.FullPath != frm.Folder){
             UserFolder folder = (UserFolder)m_pFolders.SelectedNode.Tag;
             folder.Rename(frm.Folder);
             LoadFolders(frm.Folder);
         }
     }
     else if(e.Button.Tag.ToString() == "delete" && m_pFolders.SelectedNode != null){
         UserFolder folder = (UserFolder)m_pFolders.SelectedNode.Tag;
         if(MessageBox.Show(this,"Are you sure you want to delete Folder '" + folder.FolderFullPath + "' ?","Confirm delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes){
             folder.Owner.Remove(folder);
             LoadFolders("");
         }
     }
     else if(e.Button.Tag.ToString() == "properties" && m_pFolders.SelectedNode != null){
         UserFolder folder = (UserFolder)m_pFolders.SelectedNode.Tag;
         wfrm_User_FolderProperties frm = new wfrm_User_FolderProperties(m_pVirtualServer,folder);
         frm.ShowDialog(this);             
     }
 }
示例#2
0
 private void m_pTab_Folders_Toolbar_ItemClicked(object sender,ToolStripItemClickedEventArgs e)
 {
     if(e.ClickedItem.Tag == null){
         return;
     }
                 
     if(e.ClickedItem.Tag.ToString() == "add"){
         if(m_pTab_Folders_Folders.SelectedNode == null){
             wfrm_sys_Folder frm = new wfrm_sys_Folder(true,"",false);
             if(frm.ShowDialog(this) == DialogResult.OK){
                 m_pUser.Folders.Add(frm.Folder);
                 LoadFolders(frm.Folder);
             }
         }
         else{
             wfrm_sys_Folder frm = new wfrm_sys_Folder(true,"",false);
             if(frm.ShowDialog(this) == DialogResult.OK){
                 UserFolder folder = (UserFolder)m_pTab_Folders_Folders.SelectedNode.Tag;
                 folder.ChildFolders.Add(frm.Folder);
                 LoadFolders(frm.Folder);
             }
         }
     }
     else if(e.ClickedItem.Tag.ToString() == "edit" && m_pTab_Folders_Folders.SelectedNode != null){
         wfrm_sys_Folder frm = new wfrm_sys_Folder(false,m_pTab_Folders_Folders.SelectedNode.FullPath,true);
         if(frm.ShowDialog(this) == DialogResult.OK && m_pTab_Folders_Folders.SelectedNode.FullPath != frm.Folder){
             UserFolder folder = (UserFolder)m_pTab_Folders_Folders.SelectedNode.Tag;
             folder.Rename(frm.Folder);
             LoadFolders(frm.Folder);
         }
     }
     else if(e.ClickedItem.Tag.ToString() == "delete" && m_pTab_Folders_Folders.SelectedNode != null){
         UserFolder folder = (UserFolder)m_pTab_Folders_Folders.SelectedNode.Tag;
         if(MessageBox.Show(this,"Are you sure you want to delete Folder '" + folder.FolderFullPath + "' ?","Confirm delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes){
             folder.Owner.Remove(folder);
             LoadFolders("");
         }
     }
     else if(e.ClickedItem.Tag.ToString() == "properties" && m_pTab_Folders_Folders.SelectedNode != null){
         UserFolder folder = (UserFolder)m_pTab_Folders_Folders.SelectedNode.Tag;
         wfrm_User_FolderProperties frm = new wfrm_User_FolderProperties(m_pVirtualServer,folder);
         frm.ShowDialog(this);             
     }
     else if(e.ClickedItem.Tag.ToString() == "viewmessages" && m_pTab_Folders_Folders.SelectedNode != null){
         UserFolder folder = (UserFolder)m_pTab_Folders_Folders.SelectedNode.Tag;
         wfrm_User_FolderMessages frm = new wfrm_User_FolderMessages(m_pVirtualServer,folder);
         frm.ShowDialog(this);
     }
     else if(e.ClickedItem.Tag.ToString() == "recyclebin"){
         wfrm_User_Recyclebin frm = new wfrm_User_Recyclebin(m_pVirtualServer,m_pUser);
         frm.ShowDialog(this);
     }
     else if(e.ClickedItem.Tag.ToString() == "transfer"){
         wfrm_utils_MessagesTransferer frm = new wfrm_utils_MessagesTransferer(m_pUser);
         frm.ShowDialog();
     }
 }