示例#1
0
        private void View_Renamed(object sender, EventArgs eventArgs)
        {
            ListView       listView     = (ListView)sender;
            string         userInpur    = _modal.ShowModalWindow("Enter new file Name");
            var            selectedItem = listView.GetSelectedItem();
            FileSystemInfo state        = (FileSystemInfo)listView.GetSelectedItem().State;
            string         newPath      = Path.GetDirectoryName(state.FullName) + "\\" + userInpur;

            if (selectedItem.State is FileInfo)
            {
                File.Move(state.FullName, newPath);
            }
            else
            {
                Directory.Move(state.FullName, newPath);
            }
            UpdateView();
        }
示例#2
0
        static void Main()
        {
            Console.CursorVisible = false;
            ListViewGenerator listViewGenerator = new ListViewGenerator();
            FocusManager      focusManager      = new FocusManager();
            List <ListView>   listViews         = listViewGenerator.GenerateListViews(DrivesList.GetDrivesPathes());

            Console.WriteLine(Utils.CommandsInformation);

            foreach (ListView listView in listViews)
            {
                listView.Render();
            }

            while (true)
            {
                try
                {
                    var listViewtoUpdate = listViews.Find(i => i.Focused == true);

                    while (listViewtoUpdate.Focused == true)
                    {
                        ConsoleKeyInfo key = Console.ReadKey();
                        if (key.Key == ConsoleKey.LeftArrow || key.Key == ConsoleKey.RightArrow)
                        {
                            listViews = focusManager.ChangeFocus(listViews, key);
                            listViewtoUpdate.Update(key);
                        }
                        else
                        {
                            listViewtoUpdate.Update(key);
                        }
                        if (listViewtoUpdate.IsDrives != true)
                        {
                            listViewtoUpdate.Render();
                        }
                    }
                }
                catch
                {
                    ModalWindow modal = new ModalWindow();
                    modal.ShowModalWindow("THE EXCEPTION IS HERE");
                    Console.Clear();
                    Console.WriteLine(Utils.CommandsInformation);
                    listViews = listViewGenerator.GenerateListViews(DrivesList.GetDrivesPathes());
                    foreach (ListView listView in listViews)
                    {
                        listView.Render();
                    }
                }
            }
        }