Пример #1
0
        static void Main(string[] args)
        {
            #region Initialize
            ConsoleMan.Initialize("ScreenTest", new Pixel(ConsoleColor.Black));
            KeyMan.Start();

            ConsoleComponent console = new ConsoleComponent("Text1", DrawableComponentBuilder.MakeConsole());
            TextComponent    text    = new TextComponent("CursorPosition", new
                                                         DrawableComponent("CursorPosition", 20, 1, 20, 20, 0.0f));

            ConsoleMan.Add(console);
            ConsoleMan.Add(text);
            ConsoleMan.Start();
            #endregion

            Console.OutputEncoding = UTF32Encoding.UTF8;

            console.WriteLine("SHIT");
            string x = console.ReadLine();
            console.Write(x);
            while (true)
            {
                text.Text = System.Windows.Forms.Cursor.Position.ToString() + "\u0627";
            }

            ConsoleMan.Stop();
            KeyMan.Stop();

            return;
        }
Пример #2
0
        private static void Main(string[] args)
        {
            ConsoleMan man = new ConsoleMan();
            CheckLoad  mmf = new CheckLoad();

            mmf.CheckLoadMMF();
            dispatcher = new Dispatcher();
            dispatcher.Listen();
            man.WindowList = dispatcher.GetList();
            man.ShowMessage("Bullshit happens");
            man.Keys.AddRange(new MenuKeyInfo[]
            {
                new MenuKeyInfo()
                {
                    Key = "S", Description = "Settings"
                },
                new MenuKeyInfo()
                {
                    Key = "R", Description = "Run file"
                },
                new MenuKeyInfo()
                {
                    Key = "T", Description = "Report"
                },
                new MenuKeyInfo()
                {
                    Key = "K", Description = "Kill"
                }
            });
            const int nameLength = 25;

            man.Columns.AddRange(new string[]
            {
                "PID  ", "Name".PadRight(nameLength), "CPU", "RAM"
            });
            man.KeyPressed += Man_KeyPressed;
            man.Loop();
            dispatcher.Stop();
        }
Пример #3
0
        private static void Man_KeyPressed(KeyPressedEvent e)
        {
            ConsoleMan man = (ConsoleMan)e.Sender;

            if (e.Key == ConsoleKey.S)
            {
                PropertiesConsole properties = new PropertiesConsole();
                if (properties.form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    man.DefaultForeground = properties.DefaultForegroundProperties;
                    man.DefaultBackground = properties.DefaultBackgroundProperties;
                }
            }
            else if (e.Key == ConsoleKey.R)
            {
                FileRun.Run();
            }
            else if (e.Key == ConsoleKey.K)
            {
                dynamic process = man.SelectedItem;
                if (man.ShowDialog($"Are you sure want to kill {process.Name}?") == DialogResult.Yes)
                {
                    if (dispatcher.Kill(man.SelectedIndex))
                    {
                        man.ShowMessage("Success!", ConsoleColor.Green);
                    }
                    else
                    {
                        man.ShowMessage("Couldn't kill process. Maybe it's system process", ConsoleColor.Red);
                    }
                }
            }
            else if (e.Key == ConsoleKey.T)
            {
                Report report = new Report();
                report.DoReport(man.WindowList);
            }
        }
Пример #4
0
 /// <summary>
 /// Unregisters a component.
 /// </summary>
 /// <param name="component"></param>
 protected virtual void UnregisterComponent(Component component)
 {
     ConsoleMan.Remove(component);
 }
Пример #5
0
 /// <summary>
 /// Registers the components herein contained.
 /// </summary>
 /// <param name="component">The component to be registered.</param>
 protected virtual void RegisterComponent(Component component)
 {
     ConsoleMan.Add(component);
 }