Exemplo n.º 1
0
        public bool doNonMovingCmd(Keys k)
        {
            bool iskeepcmd = true;  // 2021-01-23;

            // check function group-1,
            if (k == Keys.G)
            {
                return(false);
            }

            // quick note window;
            if (k == Keys.H)
            {
                QuickNoteMan.mthis.ShowWindow();
                return(false);
            }
            //else if (k==Keys.N)   // distable this, too dangeous!! 2021-01-23;
            //{
            //    QuickNoteMan.mthis.ResetWindow();
            //    return false;
            //}

            // date & time string;
            if (k == Keys.Y)  //.T)
            {
                DateTime dt  = DateTime.Now;
                string   str = dt.ToString("yyyy-MM-dd");
                Console.WriteLine(str);
                KeyHelper.SentString(str);

                return(false);
            }
            else if (k == Keys.P) //.Y) 2021-02-19,
            {
                DateTime dt1  = DateTime.Now;
                string   str1 = dt1.ToString("hh:mm tt");
                //Console.WriteLine(str);
                KeyHelper.SentString(str1);
                return(false);
            }

            // window management, 20150621;
            if (menWindow)
            {
                if (k == Keys.V)//.B)           //
                {
                    WinMon.mthis.stBottom();

                    return(false);
                }
                else if (k == Keys.C)//.V)     //.C)
                {
                    WinMon.mthis.restore();

                    return(false);
                }
                else if (k == Keys.B)//.N)    //.V)
                {
                    WinMon.mthis.minNow();
                    return(false);
                }
            }

            // search function;
            if (mensearch)
            {
                if (k == Keys.P)            // 20160503, keyword search;
                {
                    LsKeyword kw = LsKeyword.getThis();
                    kw.onSearchKey(true);

                    return(false);
                }
                else if (k == Keys.M)//2021-01-22;N:
                {
                    LsKeyword kw2 = LsKeyword.getThis();
                    kw2.onSearchKey(false);

                    return(false);
                }
            }

            return(iskeepcmd);
        }
Exemplo n.º 2
0
        // ---on cmd keys; ---
        public int onCmdKey(Keys key)
        {
            int eatkey = 0;

            // check function group-1,
            switch (key)
            {
            case Keys.G:
                setCmdMode(false);
                eatkey = 1;
                break;
            }

            // 2021-01-22; quick note window;
            if (key == Keys.H)
            {
                QuickNoteMan.mthis.ShowWindow();
                setCmdMode(false);
                eatkey = 1;
            }
            else if (key == Keys.N)
            {
                QuickNoteMan.mthis.ResetWindow();
                setCmdMode(false);
                eatkey = 1;
            }

            if (key == Keys.T) // 2021-01-22, sent date time
            {
                DateTime dt  = DateTime.Now;
                string   str = dt.ToString("yyyy-MM-dd");
                Console.WriteLine(str);
                KeyHelper.SentString(str);
                setCmdMode(false);
                eatkey = 1;
            }
            else if (key == Keys.Y)
            {
                DateTime dt  = DateTime.Now;
                string   str = dt.ToString("hh:mm tt");
                //Console.WriteLine(str);
                KeyHelper.SentString(str);

                //KeyHandler.SentString("abc");
                setCmdMode(false);
                eatkey = 1;
                //return eatkey;
            }
            //Console.WriteLine(getCmdMode().ToString());
            //Console.WriteLine(key.ToString());

            // window operation,
            if (eatkey == 0 && menWindow)
            {
                switch (key)
                {
                case Keys.B:                // 20150621;
                    WinMon.mthis.stBottom();
                    setCmdMode(false);
                    eatkey = 1;
                    break;

                case Keys.T:
                    WinMon.mthis.restore();
                    setCmdMode(false);
                    eatkey = 1;
                    break;

                case Keys.Y:
                    WinMon.mthis.minNow();
                    setCmdMode(false);
                    eatkey = 1;
                    break;
                }
            }

            // search dialog,
            if (eatkey == 0 && mensearch)
            {
                switch (key)
                {
                case Keys.P:                // 20160503, keyword search;
                    setCmdMode(false);
                    eatkey = 1;
                    LsKeyword kw = LsKeyword.getThis();
                    kw.onSearchKey(true);
                    break;

                case Keys.M:    //2021-01-22;N:
                    setCmdMode(false);
                    eatkey = 1;
                    LsKeyword kw2 = LsKeyword.getThis();
                    kw2.onSearchKey(false);
                    break;
                }
            }

            // moving control,
            if (0 == eatkey)
            {
                eatkey = mcommandmode.onKey(key);
            }

            // exit cmd mode if non-function chars pressed,2020-04-16,
            if (0 == eatkey)
            {
                UInt16 d = (UInt16)key;
                if (d >= 0x41 && d <= 0x5A)
                {
                    eatkey = 0;
                    setCmdMode(false);
                }
            }

            return(eatkey);
        }