Beispiel #1
0
        public void PasteItem()
        {
            buffer.Paste(directory.ReturnStringPath());
            buffer = new MyBuffer();

            Items      = GetItems(directory.ReturnStringPath());
            wasPainted = false;
        }
        public DirectoryectoryCommander(int windowHeight)
        {
            buffer = new MyBuffer();

            this.windowHeight = windowHeight;
            windows           = new ListView[] {
                new ListView(5, 2, windowHeight, buffer),
                new ListView(Console.WindowWidth / 2 + 5, 2, windowHeight, buffer)
            };
            onFocusedElement = 0;

            activeColor    = ConsoleColor.Black;
            nonActiveColor = ConsoleColor.DarkGray;
        }
Beispiel #3
0
        public ListView(int x, int y, int height, MyBuffer buffer)
        {
            this.x      = x;
            this.y      = y;
            this.height = height;
            directory   = new PathView();

            this.buffer = buffer;

            ColumnsWidth = new List <int> {
                Console.WindowWidth / 2 - 30, 13, 13
            };
            Items = GetItems(directory.Getdirectoryectory());

            Selected += View_Selected;
            Up       += UpDirectory;
        }
Beispiel #4
0
 public void CutItem(bool isCut)
 {
     try
     {
         var view = Items[selectedIndex].State;
         if (view is FileInfo)
         {
             var info = view as FileInfo;
             buffer = new MyBuffer(info.Directory.FullName, info.Name, isCut);
         }
         else if (view is DirectoryInfo)
         {
             var info = view as DirectoryInfo;
             buffer = new MyBuffer(info.Parent.FullName, info.Name, isCut);
         }
     }
     catch
     {
         throw new InvalidOperationException("There is no item to choose");
     }
 }