Esempio n. 1
0
 public void UnClickAll()
 {
     for (int i = 0; i < SelectedFiles.GetNames().Length; i++)
     {
         int index = files.IndexOfKey(SelectedFiles.GetNames()[i].ToString());
         if (index < 0)
         {
             return;
         }
         ((File)files.GetByIndex(index)).UnSelectFile();
     }
     SelectedFiles.Clear();
 }
Esempio n. 2
0
        private void CreateContextMenu()
        {
            m_open   = new MenuItem("Open");
            m_cut    = new MenuItem("Cut");
            m_copy   = new MenuItem("Copy");
            m_delete = new MenuItem("Delete");
            m_paste  = new MenuItem("Paste");
            m_rename = new MenuItem("Rename");
            m_prop   = new MenuItem("Properties");

            m_open.Click += (o, e) => {
                FileDoubleClicked();
            };

            m_cut.Click += (o, e) => {
                b.CutClicked = true;
                b.pn_flow.ContextMenu.MenuItems[2].Enabled = true;
                SelectedFiles.SetCopyBuffer();
            };

            m_copy.Click += (o, e) => {
                b.CopyClicked = true;
                b.pn_flow.ContextMenu.MenuItems[2].Enabled = true;
                SelectedFiles.SetCopyBuffer();
            };

            m_delete.Click += (o, e) => {
                try {
                    FileOperation.DeleteFiles(SelectedFiles.GetNames());
                    b.LoadFiles(b.CurrentLocation);
                } catch (Exception ex) { MessageBox.Show(ex.Message); UnSelectFile(); }
            };


            m_paste.Click += (o, e) => {
                b.PasteFiles();
            };

            m_rename.Click += (o, e) => {
                RenameFile();
            };

            m_prop.Click += (o, e) => {
                FileProperties();
            };

            ContextMenu menu = new ContextMenu(new MenuItem[] { m_open, m_cut, m_copy, m_delete, m_rename, m_prop });

            fl_file.ContextMenu = menu;

            fl_file.ContextMenu.Popup += (o, ev) => {
                if (b.CutClicked || b.CopyClicked)
                {
                    if (!fl_file.ContextMenu.MenuItems.Contains(m_paste))
                    {
                        fl_file.ContextMenu.MenuItems.Add(4, m_paste);
                    }
                }
                else if (fl_file.ContextMenu.MenuItems.Contains(m_paste))
                {
                    fl_file.ContextMenu.MenuItems.Remove(m_paste);
                }
            };
        }