当前位置: 首页>>代码示例>>C#>>正文


C# Window.Clear方法代码示例

本文整理汇总了C#中Window.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Clear方法的具体用法?C# Window.Clear怎么用?C# Window.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Window的用法示例。


在下文中一共展示了Window.Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CounterConsole

        public static string CounterConsole()
        {
            CounterConsoleWin = new Window(2, ScreenInfo.WindowWidth, ScreenInfo.WindowHeight - 2, 0);
            Actions act = new Actions();
            CounterConsoleWin.Keypad = true;
            Curses.Echo = false;

            int splitCount = 3;
            string command = "";
            string message = "";
            int charCount = 0;
            int buttonPress = 0;
            int bufferPosition = 0;
            char[] splitter = { ' ' };

            do
            {
                CounterConsoleWin.Clear();

                if (command.StartsWith("/"))
                {
                    try
                    {
                        message = command.Split(splitter, splitCount)[2];
                        CounterConsoleWin = DrawConsoleNum(CounterConsoleWin, message.Length);
                    }
                    catch (IndexOutOfRangeException)
                    {
                        CounterConsoleWin = DrawConsoleNum(CounterConsoleWin, message.Length);
                    }
                }
                else
                {
                    CounterConsoleWin = DrawConsoleNum(CounterConsoleWin, charCount);
                }

                CounterConsoleWin.Add(command);
                CounterConsoleWin.Refresh();

                buttonPress = CounterConsoleWin.GetChar();
                if (Settings.NoShortcuts == false)
                {
                    if (act.DealWithShortcuts(buttonPress))
                    {
                        buttonPress = 57344; /* So it's ignored */
                    }
                }

                if (buttonPress == 8) /* 8 is backspace */
                {
                    if (charCount != 0)
                    {
                        command = command.Remove(command.Length - 1, 1);
                        charCount--;
                    }
                    else
                    {
                        Curses.Beep();
                    }
                }
                else
                {
                    if (buttonPress == Keys.DOWN)
                    {
                        if (bufferPosition == 0) /* Nothing happens if you're already at the latest command possible */
                        {
                            Curses.Beep();
                        }
                        else
                        {
                            try
                            {
                                bufferPosition--;
                                command = CommandHistory.GetCommand(bufferPosition);
                                charCount = command.Length;
                            }
                            catch (ArgumentOutOfRangeException)
                            {
                                Curses.Beep();
                            }
                        }
                    }
                    else if (buttonPress == Keys.UP) /* Handles going to earlier points in the history */
                    {
                        if (bufferPosition == 0)
                        {
                            if (CommandHistory.MaxIndex() != bufferPosition || CommandHistory.MaxIndex() == 0)
                            {
                                try
                                {
                                    CommandHistory.Add(command);
                                    bufferPosition++;
                                    command = CommandHistory.GetCommand(bufferPosition);
                                    charCount = command.Length;
                                }
                                catch (ArgumentOutOfRangeException)
                                {
                                    Curses.Beep();
                                }
                            }
//.........这里部分代码省略.........
开发者ID:wallnutkraken,项目名称:Clutter-Feed,代码行数:101,代码来源:User.cs

示例2: Main

        public static void Main(string[] args)
        {
            Console.WindowWidth = 100;
            Curses.InitScr();
            Curses.StartColor();
            Curses.InitPair(1, Colors.WHITE, Colors.BLACK);
            mainDisplay = new Window(Console.WindowHeight, Console.WindowWidth, 0, 0);
            mainDisplay.EnableScroll = true;
            Window commandInput = new Window(1, Console.WindowWidth, Console.WindowHeight - 1, 0);
            commandInput.Color = 1;
            mainDisplay.Color = 1;
            mCore.Init(EventHandler);
            CommandHandler.Initialize();

            while (true)
            {
                commandInput.Clear();
                commandInput.Add(">");
                String command = commandInput.GetString();
                CommandHandler.HandleCommand(command);
                commandInput.Refresh();

            }
        }
开发者ID:fuad86,项目名称:m-client,代码行数:24,代码来源:mConsole.cs

示例3: ProfileSelection

        /// <summary>
        /// A menu and logic to select/add/remove profiles
        /// </summary>
        private void ProfileSelection()
        {
            int pressedKey;
            int selection = 0;
            menu = new Window(User.profiles.Count + 10, ScreenInfo.WindowWidth, (ScreenInfo.WindowHeight / 2) - 2, 0);
            do
            {
                menu.Clear();
                menu.Keypad = true;
                menu.Color = 11;
                MenuDrawInMiddle("What would you like to do?\n", 0);
                if (selection == 0)
                {
                    menu.Color = 21;
                }
                MenuDrawInMiddle("Add profile");
                menu.Color = 11;
                menu.Add("\n");

                if (selection == 1)
                {
                    menu.Color = 21;
                }
                MenuDrawInMiddle("Remove a profile");
                menu.Add("\n");
                menu.Color = 11;

                if (selection == 2)
                {
                    menu.Color = 21;
                }
                MenuDrawInMiddle("Switch profiles");
                menu.Add("\n");
                menu.Color = 11;

                if (selection == 3)
                {
                    menu.Color = 21;
                }
                menu.Refresh();
                MenuDrawInMiddle("Select default profile");
                menu.Add("\n");
                menu.Color = 11;

                if (selection == 4)
                {
                    menu.Color = 21;
                }
                MenuDrawInMiddle("Go back");
                menu.Color = 11;
                menu.Refresh();

                pressedKey = menu.GetChar();
                if (pressedKey == Keys.UP)
                {
                    if (selection == 0)
                    {
                        Curses.Beep();
                    }
                    else
                    {
                        selection--;
                    }
                }
                else if (pressedKey == Keys.DOWN)
                {
                    if (selection == 4)
                    {
                        Curses.Beep();
                    }
                    else
                    {
                        selection++;
                    }
                }
            } while (pressedKey != 10);

            menu.Clear();
            menu.Refresh();
            if (selection == 0)
            {
                getUser.AddProfile();
            }
            else if (selection == 1)
            {
                Profile deletingProfile = drawing.SelectUser();
                int minorSelection = 0;
                int pressedChar;
                do
                {
                    menu.Clear();
                    menu.Color = 11;
                    MenuDrawInMiddle("Are you sure you want to remove " + deletingProfile.Name + "?", 0);
                    if (minorSelection == 0)
                    {
                        menu.Color = 21;
                        MenuDrawInMiddle("Yes", 2);
//.........这里部分代码省略.........
开发者ID:wallnutkraken,项目名称:Clutter-Feed,代码行数:101,代码来源:Actions.cs


注:本文中的Window.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。