Example #1
0
        int DiskSelecterKeys()
        {
            if (!Enabled)
            {
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Enabled = false;
                return(-1);
            }

            if (MaKeys.Get(ConsoleKey.LeftArrow))
            {
                Indexer.Do(1, 1);
                return(0);
            }
            if (MaKeys.Get(ConsoleKey.RightArrow))
            {
                Indexer.Do(1, 0);
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Enter))
            {
                NewPath = Drives[Indexer.Get()].Name;
                Enabled = false;
                return(1);
            }

            return(0);
        }
Example #2
0
        public bool HandleKeys()
        {
            if (!Enabled)
            {
                return(false);
            }

            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Enabled = false;
                if (Data != null)
                {
                    Data.Clear();
                }
                return(false);
            }

            //Смещение маркера вверх или вниз
            if (MaKeys.Get(ConsoleKey.DownArrow))
            {
                Scroller001.OffSet(1);
                return(true);
            }
            if (MaKeys.Get(ConsoleKey.UpArrow))
            {
                Scroller001.OffSet(-1);
                return(true);;
            }

            //Постраничное смещение
            if (MaKeys.Get(ConsoleKey.PageDown))
            {
                Scroller001.OffSet(2);
                return(true);;
            }
            if (MaKeys.Get(ConsoleKey.PageUp))
            {
                Scroller001.OffSet(-2);
                return(true);;
            }

            //Перемещение в начало или конец
            if (MaKeys.Get(ConsoleKey.End))
            {
                Scroller001.OffSet(3);
                return(true);;
            }
            if (MaKeys.Get(ConsoleKey.Home))
            {
                Scroller001.OffSet(-3);
            }
            return(true);
        }
Example #3
0
        int OKCANCELKeys()
        {
            if (!Enabled)
            {
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Enabled = false;
                return(-1);
            }

            if (MaKeys.Get(ConsoleKey.LeftArrow))
            {
                Indexer.Do(1, 1);
                return(0);
            }
            if (MaKeys.Get(ConsoleKey.RightArrow))
            {
                Indexer.Do(1, 0);
                return(0);
            }

            if (MaKeys.Get(ConsoleKey.Enter))
            {
                if (Indexer.Get() == 0)
                {
                    Enabled = false;
                    return(1);
                }
                if (Indexer.Get() == 1)
                {
                    Enabled = false;
                    return(-1);
                }
            }

            return(0);
        }
Example #4
0
        public void HandleKeys()
        {
            //Смещение маркера вверх или вниз
            if (MaKeys.Get(ConsoleKey.DownArrow))
            {
                VertIndex.Do(1, 0);
                VisIndex.Do(1, 0);

                if (VisIndex.IsMax())
                {
                    BorderUp.Do(1, 0);
                    BorderDown.Do(1, 0);
                }
                return;
            }
            if (MaKeys.Get(ConsoleKey.UpArrow))
            {
                VertIndex.Do(1, 1);
                VisIndex.Do(1, 1);
                if (VisIndex.IsMin())
                {
                    BorderUp.Do(1, 1);
                    BorderDown.Do(1, 1);
                }
                return;
            }

            //Постраничное смещение
            if (MaKeys.Get(ConsoleKey.PageDown))
            {
                VertIndex.Do(VertStep, 0);
                VisIndex.Do(VertStep, 0);

                BorderUp.Do(VertStep, 0);
                BorderDown.Do(VertStep, 0);
                return;
            }
            if (MaKeys.Get(ConsoleKey.PageUp))
            {
                VertIndex.Do(VertStep, 1);
                VisIndex.Do(VertStep, 1);

                BorderUp.Do(VertStep, 1);
                BorderDown.Do(VertStep, 1);
                return;
            }

            //Перемещение в начало или конец списка
            if (MaKeys.Get(ConsoleKey.End))
            {
                VertIndex.Maximalize();
                VisIndex.Maximalize();
                BorderUp.Maximalize();
                BorderDown.Maximalize();
                return;
            }
            if (MaKeys.Get(ConsoleKey.Home))
            {
                VertIndex.Minimalize();
                VisIndex.Minimalize();
                BorderUp.Minimalize();
                BorderDown.Minimalize();
            }
        }
Example #5
0
        public void HandleKeys()
        {
            if (!Active)
            {
                return;
            }
            Global.Attention.Show("");

            //Отмена выделений
            if (MaKeys.Get(ConsoleKey.Escape))
            {
                Global.ResetTextPainter();
                return;
            }

            //Переход по уровням директорий
            if (MaKeys.Get(ConsoleKey.Enter))
            {
                Global.ResetTextPainter();
                ListFullNames.Clear();
                ListNames.Clear();
                ListTypes.Clear();

                if (CurrentContent.GetType(MainMarker.GetIndex()) == Global.Types.LevelUp)
                {
                    MainMarker.SetDirection(true);
                    MaWalker.LevelUp();
                    PrepareDirectory();
                    return;
                }
                if (CurrentContent.GetType(MainMarker.GetIndex()) == Global.Types.Directory)
                {
                    MainMarker.SetDirection(false);
                    if (MaWalker.LevelDown(CurrentContent.GetName(MainMarker.GetIndex())))
                    {
                        PrepareDirectory();
                    }
                    return;
                }
            }

            if (MaKeys.Get(ConsoleKey.Backspace))
            {
                Global.ResetTextPainter();

                MainMarker.SetDirection(true);
                MaWalker.LevelUp();
                PrepareDirectory();
                return;

                /*
                 * if(!MaWalker.IsMinimum())
                 * {
                 *
                 * }   **/
            }

            if (MaKeys.Get(ConsoleKey.Spacebar))
            {
                Global.AddTextPainterKoords(MainMarker.GetIndex(), TableContent.GetKoords().Secundus + 1, MainMarker.GetHorizKoords());
                //ListFullNames.Add(MaWalker.GetPath() + '\\' + CurrentContent.GetName(MainMarker.GetIndex()));
                ListFullNames.Add(Path.Combine(MaWalker.GetPath(), CurrentContent.GetName(MainMarker.GetIndex())));
                ListNames.Add(CurrentContent.GetName(MainMarker.GetIndex()));
                ListTypes.Add(CurrentContent.GetType(MainMarker.GetIndex()));
                return;
            }

            MainMarker.HandleKeys();
        }
Example #6
0
        public void HandleKeys()
        {
            switch (CurrentState)
            {
            case 0:
                MainKeys();
                break;

            case 1:
                if (MaKeys.Get(ConsoleKey.F1))
                {
                    Helper.Enabled = false;
                    ChangeActivity(1);
                    CurrentState = 0;
                    return;
                }
                if (MaKeys.Get(ConsoleKey.Escape))
                {
                    Helper.Enabled = false;
                    ChangeActivity(1);
                    CurrentState = 0;
                    return;
                }
                break;

            case 2:
                switch (DiskSelecter.HandleKeys())
                {
                case -1:
                    //Partes[NumberPart.Get()].Reset();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;

                case 0:
                    break;

                case 1:
                    Partes[NumberPart.Get()].SetNewPath(DiskSelecter.GetNewPath());
                    Partes[NumberPart.Get()].PrepareDirectory();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;
                }
                break;

            case 3:
                if (!MaShouwar.HandleKeys())
                {
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;

            case 4:
                break;

            case 5:
                switch (Confirmer.HandleKeys())
                {
                case -1:
                    Partes[NumberPart.Get()].Reset();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;

                case 0:
                    break;

                case 1:
                    Copy();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;
                }
                break;

            case 6:
                if (MakeFile())
                {
                    Partes[NumberPart.Get()].PrepareDirectory();
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;

            case 7:
                if (MakeDir())
                {
                    Partes[NumberPart.Get()].PrepareDirectory();
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;

            case 8:
                switch (Confirmer.HandleKeys())
                {
                case -1:
                    Partes[NumberPart.Get()].Reset();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;

                case 0:
                    break;

                case 1:
                    Delete();
                    ChangeActivity(1);
                    CurrentState = 0;
                    break;
                }
                break;

            case 9:
                if (!MaShouwar.HandleKeys())
                {
                    ChangeActivity(1);
                    CurrentState = 0;
                }
                break;
                //case 10:
                //Partes[0].Save();
                //Partes[1].Save();
                //Ended = true;
                //break;
            }
        }
Example #7
0
        void MainKeys()
        {
            if (MaKeys.Get(ConsoleKey.Tab))
            {
                Partes[NumberPart.Get()].Reset();
                Partes[0].Active = !Partes[0].Active;
                Partes[1].Active = !Partes[1].Active;
                NumberPart.Do(1, 1);
                return;
            }


            if (MaKeys.Get(ConsoleKey.F1))
            {
                CurrentState   = 1;
                Helper.Enabled = true;
                ChangeActivity(0);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F2))
            {
                CurrentState = 2;
                ChangeActivity(0);

                DiskSelecter.Enabled = true;
                return;
            }
            if (MaKeys.Get(ConsoleKey.F3))
            {
                MakeFileReader();
                return;
            }
            if (MaKeys.Get(ConsoleKey.F5))
            {
                CurrentState = 5;
                ChangeActivity(0);

                Confirmer.Enabled = true;
                Confirmer.SetLabel(" Do you Realy want to COPY? ", 1);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F6))
            {
                CurrentState = 6;
                ChangeActivity(0);

                NameEnterer.SetLabel(MyFunc.Set(2, 0), " Enter a name for the new File ");
                SetNewFile          = true;
                NameEnterer.Enabled = true;
                MaKeys.ReadText(MyFunc.Set(NameEnterer.GetKoords().Primis + 2, NameEnterer.GetKoords().Secundus + 1), true);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F7))
            {
                CurrentState = 7;
                ChangeActivity(0);

                NameEnterer.SetLabel(MyFunc.Set(2, 0), " Enter a name for the new Directory ");
                SetNewDirectory     = true;
                NameEnterer.Enabled = true;
                MaKeys.ReadText(MyFunc.Set(NameEnterer.GetKoords().Primis + 2, NameEnterer.GetKoords().Secundus + 1), true);
            }
            if (MaKeys.Get(ConsoleKey.F8))
            {
                CurrentState = 8;
                ChangeActivity(0);

                Confirmer.Enabled = true;
                Confirmer.SetLabel(" Do you Realy want to DELETE? ", 1);
                return;
            }
            if (MaKeys.Get(ConsoleKey.F9))
            {
                MakeTreeViewer();
                return;
            }
            if (MaKeys.Get(ConsoleKey.F10))
            {
                Partes[0].Save();
                Partes[1].Save();
                Ended = true;
                //CurrentState = 10;
                //ChangeActivity(0);
                return;
            }

            Partes[0].HandleKeys();
            Partes[1].HandleKeys();
        }