Esempio n. 1
0
 public bool ParseCommand(string Subject, Comands Command, MyConsoleKeyInfo KeyInfo)
 {
     if (!this.Controls.ContainsKey(Subject))
     {
         throw new ArgumentOutOfRangeException("Subject");
     }
     ActiveComponent = this.Controls[Subject];
     return(ParseCommand(Command, KeyInfo));
 }
Esempio n. 2
0
        public virtual bool NewInput(MyConsoleKeyInfo KeyInfo)
        {
            switch (KeyInfo.KeyChar)
            {
            case (char)SpecialAsciiKeys.Tab:
                OnTab?.Invoke(this, DateTime.Now);
                return(true);

            case '\n':
                OnAccept?.Invoke(this, DateTime.Now);
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public override bool NewInput(MyConsoleKeyInfo KeyInfo)
        {
            if (mAcceptedCharacters.Any(i => i == KeyInfo.KeyChar))
            {
                InsertCharInText(mCursorTop, mCursorLeft, KeyInfo.KeyChar);

                return(true);
            }
            else
            {
                switch (KeyInfo.KeyChar)
                {
                case (char)SpecialAsciiKeys.Backspace:
                    RemoveCharFormText(1);
                    return(true);

                case (char)SpecialAsciiKeys.Del:
                    RemoveCharFormText(-1);
                    return(true);

                case (char)SpecialAsciiKeys.ArrowUp:
                    MoveCursureVertical(1);
                    return(true);

                case (char)SpecialAsciiKeys.ArrowDown:
                    MoveCursureVertical(-1);
                    return(true);

                case (char)SpecialAsciiKeys.ArrowRight:
                    MoveCursureHorisontal(1);
                    return(true);

                case (char)SpecialAsciiKeys.ArrowLeft:
                    MoveCursureHorisontal(-1);
                    return(true);
                }
            }
            return(base.NewInput(KeyInfo));
        }
Esempio n. 4
0
 public override bool NewInput(MyConsoleKeyInfo c)
 {
     return(base.NewInput(c));
 }
Esempio n. 5
0
 public bool ParseCommand(Component Subject, Comands Command, MyConsoleKeyInfo KeyInfo)
 {
     ActiveComponent = Subject;
     return(ParseCommand(Command, KeyInfo));
 }
Esempio n. 6
0
        public bool ParseCommand(Comands Command, MyConsoleKeyInfo KeyInfo)
        {
            switch (InputMode)
            {
            case InputMode.ControlOnly:
                try
                {
                    Comand[Command](CommandControls.InvokedBaseCommand[Command]);
                    return(true);
                }
                catch (Exception ex)
                {
                    EnqueMessage(ex);
                    return(false);
                }

            case InputMode.ControlFirst:
                try
                {
                    Comand[Command](CommandControls.InvokedBaseCommand[Command]);
                    return(true);
                }
                catch
                {
                    if (UIComponents.ParseCommand(KeyInfo))
                    {
                        if (this.Name == Active.Peek().Name)
                        {
                            ScreenChange();
                        }
                        return(true);
                    }
                    return(false);
                }

            case InputMode.InputOnly:
                if (UIComponents.ParseCommand(KeyInfo))
                {
                    if (this.Name == Active.Peek().Name)
                    {
                        ScreenChange();
                    }
                    return(true);
                }
                return(false);

            case InputMode.InputFirst:
                if (!UIComponents.ParseCommand(KeyInfo))
                {
                    try
                    {
                        Comand[Command](CommandControls.InvokedBaseCommand[Command]);
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        EnqueMessage(ex);
                        return(false);
                    }
                }
                else if (this.Name == Active.Peek().Name)
                {
                    ScreenChange();
                }
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
 public bool ParseCommand(MyConsoleKeyInfo KeyInfo)
 {
     return((bool)CurrentActive?.NewInput(KeyInfo));
 }