Beispiel #1
0
        public override void Do(ActionPerformerArgs actionPerformerArgs)
        {
            PanelSet   panelSet   = (PanelSet)actionPerformerArgs.Sender;
            PopupList  popupList  = new PopupList("Search result:");
            PopupInput popupInput = new PopupInput(panelSet, "Enter the name of a file or directory:", "Search");

            popupInput.Render();
            var userInput = popupInput.UserInputResult;

            popupList.ListView = new ListView <FileSystemInfo>(popupList.OffsetX, popupList.OffsetY, popupList.Height, 0,
                                                               popupList.BackgroundColor, popupList.ForegroundColor);
            popupList.ListView.Focused      = true;
            popupList.ListView.ColumnWidths = new List <int>()
            {
                30, 10, 10
            };
            popupList.ListView.Current = panelSet.FocusedPanel.Current;
            panelSet.Modal             = popupList;

            popupList.ListView.Items = GetAllFilesAndFolders((DirectoryInfo)popupList.ListView.Current).Where(i => i.Item.Name.Contains(userInput)).ToList();

            if (popupList.ListView.Items.Count > 0)
            {
                popupList.ListView.Current = panelSet.Modal.ListView.Items[0].Item;
            }
            else
            {
                return;
            }

            popupList.Render();
        }
Beispiel #2
0
        public override void Do(ActionPerformerArgs actionPerformerArgs)
        {
            PanelSet panelSet = (PanelSet)actionPerformerArgs.Sender;

            FileSystemInfo senderInfo = panelSet.FocusedListView.SelectedItem.Item;
            var            source     = senderInfo.FullName;

            PopupInput popupInput = new PopupInput(panelSet, "Enter new name:");

            popupInput.Render();
            string newName = popupInput.UserInputResult;

            var destination = Path.GetDirectoryName(source) + "\\" + newName;

            if (senderInfo is FileInfo)
            {
                File.Move(source, destination);
            }

            else if (senderInfo is DirectoryInfo)
            {
                Directory.Move(source, destination);
            }

            panelSet.RefreshScreen();
        }
Beispiel #3
0
        public override void Do(ActionPerformerArgs actionPerformerArgs)
        {
            PanelSet panelSet = (PanelSet)actionPerformerArgs.Sender;

            PopupInput popupInput = new PopupInput(panelSet, "Enter new folder name:");

            popupInput.Render();
            string newName = popupInput.UserInputResult;

            var currentPath = panelSet.FocusedListView.Current.FullName + "\\" + newName;

            Directory.CreateDirectory(currentPath);

            panelSet.RefreshFocusedPanel();
        }