Пример #1
0
        private void m_pToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem.Tag == null)
            {
                return;
            }

            if (e.ClickedItem.Tag.ToString() == "add")
            {
                wfrm_Folders_UsersDefaultFolders_Folder frm = new wfrm_Folders_UsersDefaultFolders_Folder(m_pVirtualServer);
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    LoadFolders(frm.FolderName);
                }
            }
            else if (e.ClickedItem.Tag.ToString() == "delete")
            {
                UsersDefaultFolder folder = (UsersDefaultFolder)m_pFolders.SelectedItems[0].Tag;

                if (folder.FolderName.ToLower() == "inbox")
                {
                    MessageBox.Show(this, "Inbox is permanent system folder and can't be deleted ! '", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (MessageBox.Show(this, "Are you sure you want to delete Users Default Folder '" + folder.FolderName + "' !", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    folder.Owner.Remove(folder);
                    LoadFolders("");
                }
            }
        }
        private void m_pToolbar_ItemClicked(object sender,ToolStripItemClickedEventArgs e)
        {
            if(e.ClickedItem.Tag == null){
                return;
            }

            if(e.ClickedItem.Tag.ToString() == "add"){
                wfrm_Folders_UsersDefaultFolders_Folder frm = new wfrm_Folders_UsersDefaultFolders_Folder(m_pVirtualServer);
                if(frm.ShowDialog(this) == DialogResult.OK){
                    LoadFolders(frm.FolderName);
                }
            }
            else if(e.ClickedItem.Tag.ToString() == "delete"){
                UsersDefaultFolder folder = (UsersDefaultFolder)m_pFolders.SelectedItems[0].Tag;

                if(folder.FolderName.ToLower() == "inbox"){
                    MessageBox.Show(this,"Inbox is permanent system folder and can't be deleted ! '","Error:",MessageBoxButtons.OK,MessageBoxIcon.Error);
                    return;
                }

                if(MessageBox.Show(this,"Are you sure you want to delete Users Default Folder '" + folder.FolderName + "' !","Confirm Delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.Yes){
                    folder.Owner.Remove(folder);
                    LoadFolders("");
                }
            }
        }