예제 #1
0
        public void PopulateAppLauncher(LauncherItem[] items)
        {
            apps.DropDownItems.Clear();

            foreach (var kv in items)
            {
                var item = new ToolStripMenuItem();
                item.Text   = kv.DisplayData.Name;
                item.Click += (o, a) =>
                {
                    Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
                };
                apps.DropDownItems.Add(item);
            }

            if (Shiftorium.UpgradeInstalled("al_shutdown"))
            {
                apps.DropDownItems.Add(new ToolStripSeparator());
                var item = new ToolStripMenuItem();
                item.Text   = Localization.Parse("{SHUTDOWN}");
                item.Click += (o, a) =>
                {
                    TerminalBackend.InvokeCommand("sos.shutdown");
                };
                apps.DropDownItems.Add(item);
            }
        }
예제 #2
0
 private void btnshutdown_Click(object sender, EventArgs e)
 {
     userRequestClose = false;
     shuttingdown     = true;
     this.Close();
     SaveSystem.CurrentUser = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == "root");
     TerminalBackend.InvokeCommand("sos.shutdown");
 }
예제 #3
0
        public void PopulateAppLauncher()
        {
            appsmenu.Children.Clear();

            double biggestWidth = 0;

            appsmenu.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush();

            foreach (var kv in AppLauncherDaemon.Available())
            {
                var item = new Button();
                if (kv.LaunchType.BaseType == typeof(System.Windows.Forms.UserControl))
                {
                    item.Content = kv.DisplayData.Name + " (Legacy)";
                }
                else
                {
                    item.Content = kv.DisplayData.Name;
                }
                item.Margin = new Thickness(2);
                double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
                if (measure > biggestWidth)
                {
                    biggestWidth = measure;
                }
                item.Click += (o, a) =>
                {
                    AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
                    appsmenu.Visibility = Visibility.Hidden;
                };
                item.HorizontalAlignment = HorizontalAlignment.Stretch;
                appsmenu.Children.Add(item);
            }

            if (Shiftorium.UpgradeInstalled("al_shutdown"))
            {
                var item = new Button();
                item.Content = ShiftOS.Engine.Localization.Parse("{SHUTDOWN}");
                item.Margin  = new Thickness(2);
                double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
                if (measure > biggestWidth)
                {
                    biggestWidth = measure;
                }


                item.Click += (o, a) =>
                {
                    TerminalBackend.InvokeCommand("sos.shutdown");
                };
                appsmenu.Children.Add(item);
            }

            appsmenu.Width = biggestWidth + 50;

            SkinAppLauncher();
        }
예제 #4
0
        public void MessageReceived(ServerMessage msg)
        {
            var rtsMessage = JsonConvert.DeserializeObject <RTSMessage>(msg.Contents);

            if (msg.Name == "disconnected")
            {
                if (Applications.Terminal.IsInRemoteSystem == true)
                {
                    if (Applications.Terminal.RemoteSystemName == rtsMessage.SenderSystemName)
                    {
                        if (Applications.Terminal.RemoteUser == rtsMessage.Username)
                        {
                            if (Applications.Terminal.RemotePass == rtsMessage.Password)
                            {
                                Applications.Terminal.IsInRemoteSystem = false;
                                Applications.Terminal.RemoteSystemName = "";
                                Applications.Terminal.RemoteUser       = "";
                                Applications.Terminal.RemotePass       = "";
                                TerminalBackend.PrefixEnabled          = true;
                                TerminalBackend.PrintPrompt();
                            }
                        }
                    }
                }
                return;
            }

            string currentUserName = SaveSystem.CurrentUser.Username;

            var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == rtsMessage.Username && x.Password == rtsMessage.Password);

            if (user == null)
            {
                ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 0, "Access denied.", "The username and password you have provided was denied.");
                return;
            }
            else
            {
                SaveSystem.CurrentUser = user;

                string cmd = rtsMessage.Namespace + "." + rtsMessage.Command + JsonConvert.SerializeObject(rtsMessage.Arguments);
                TerminalBackend.InvokeCommand(cmd, true);
                ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 1, "writeline", TerminalBackend.LastCommandBuffer);
                ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 1, "write", $"{rtsMessage.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");

                SaveSystem.CurrentUser = SaveSystem.Users.FirstOrDefault(x => x.Username == currentUserName);
            }
        }
예제 #5
0
        public void OpenFile(string file)
        {
            int    lastline     = 0;
            string lastlinetext = "";

            try
            {
                var lines = new List <string>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(file).Split(new[] { Environment.NewLine.ToString() }, StringSplitOptions.RemoveEmptyEntries));
                AppearanceManager.SetupWindow(this);
                var parser = CommandParser.GenerateSample();
                foreach (var line in lines)
                {
                    lastline     = lines.IndexOf(line) + 1;
                    lastlinetext = line;
                    var command = parser.ParseCommand(line);
                    TerminalBackend.InvokeCommand(command.Key, command.Value);
                }
            }
            catch (Exception ex)
            {
                ConsoleEx.ForegroundColor = ConsoleColor.Red;
                ConsoleEx.Bold            = true;
                Console.WriteLine("Script exception");
                ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
                ConsoleEx.Bold            = false;
                ConsoleEx.Italic          = true;
#if DEBUG
                Console.WriteLine(ex.Message);
#endif
                Console.WriteLine(ex.StackTrace);
                if (lastline > 0)
                {
                    Console.WriteLine(" at " + lastlinetext + " (line " + lastline + ") in " + file);
                }
            }
            TerminalBackend.PrintPrompt();
        }
예제 #6
0
        public static void MakeWidget(Controls.TerminalBox txt)
        {
            AppearanceManager.StartConsoleOut();
            txt.GotFocus += (o, a) =>
            {
                AppearanceManager.ConsoleOut = txt;
            };
            txt.KeyDown += (o, a) =>
            {
                if (a.Control == true || a.Alt == true)
                {
                    a.SuppressKeyPress = true;
                    return;
                }

                if (a.KeyCode == Keys.Enter)
                {
                    try
                    {
                        if (!TerminalBackend.InStory)
                        {
                            a.SuppressKeyPress = false;
                        }
                        if (!TerminalBackend.PrefixEnabled)
                        {
                            string textraw = txt.Lines[txt.Lines.Length - 1];
                            TextSent?.Invoke(textraw);
                            TerminalBackend.SendText(textraw);
                            return;
                        }
                        var text  = txt.Lines.ToArray();
                        var text2 = text[text.Length - 1];
                        var text3 = "";
                        txt.AppendText(Environment.NewLine);
                        var text4 = Regex.Replace(text2, @"\t|\n|\r", "");

                        if (IsInRemoteSystem == true)
                        {
                            ServerManager.SendMessage("trm_invcmd", JsonConvert.SerializeObject(new
                            {
                                guid    = RemoteGuid,
                                command = text4
                            }));
                        }
                        else
                        {
                            if (TerminalBackend.PrefixEnabled)
                            {
                                text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
                            }
                            TerminalBackend.LastCommand = text3;
                            TextSent?.Invoke(text4);
                            TerminalBackend.SendText(text4);
                            if (TerminalBackend.InStory == false)
                            {
                                if (text3 == "stop theme")
                                {
                                    CurrentCommandParser.parser = null;
                                }
                                else
                                {
                                    var result = SkinEngine.LoadedSkin.CurrentParser.ParseCommand(text3);

                                    if (result.Equals(default(KeyValuePair <string, Dictionary <string, string> >)))
                                    {
                                        Console.WriteLine("{ERR_SYNTAXERROR}");
                                    }
                                    else
                                    {
                                        TerminalBackend.InvokeCommand(result.Key, result.Value);
                                    }
                                }
                            }
                            if (TerminalBackend.PrefixEnabled)
                            {
                                TerminalBackend.PrintPrompt();
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                else if (a.KeyCode == Keys.Back)
                {
                    try
                    {
                        var tostring3   = txt.Lines[txt.Lines.Length - 1];
                        var tostringlen = tostring3.Length + 1;
                        var workaround  = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                        var derp        = workaround.Length + 1;
                        if (tostringlen != derp)
                        {
                            AppearanceManager.CurrentPosition--;
                        }
                        else
                        {
                            a.SuppressKeyPress = true;
                        }
                    }
                    catch
                    {
                        Debug.WriteLine("Drunky alert in terminal.");
                    }
                }
                else if (a.KeyCode == Keys.Left)
                {
                    if (SaveSystem.CurrentSave != null)
                    {
                        var getstring = txt.Lines[txt.Lines.Length - 1];
                        var stringlen = getstring.Length + 1;
                        var header    = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                        var headerlen = header.Length + 1;
                        var selstart  = txt.SelectionStart;
                        var remstrlen = txt.TextLength - stringlen;
                        var finalnum  = selstart - remstrlen;

                        if (finalnum != headerlen)
                        {
                            AppearanceManager.CurrentPosition--;
                        }
                        else
                        {
                            a.SuppressKeyPress = true;
                        }
                    }
                }
                else if (a.KeyCode == Keys.Up)
                {
                    var tostring3 = txt.Lines[txt.Lines.Length - 1];
                    if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
                    {
                        Console.Write(TerminalBackend.LastCommand);
                    }
                    ConsoleEx.OnFlush?.Invoke();
                    a.SuppressKeyPress = true;
                }
                else
                {
                    if (TerminalBackend.InStory)
                    {
                        a.SuppressKeyPress = true;
                    }
                    AppearanceManager.CurrentPosition++;
                }
            };

            AppearanceManager.ConsoleOut = txt;

            txt.Focus();

            txt.Font      = LoadedSkin.TerminalFont;
            txt.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC);
            txt.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC);
        }
예제 #7
0
 public static void InvokeCommand(string text)
 {
     TerminalBackend.InvokeCommand(text);
 }
예제 #8
0
        public void SetupBuildUpdate(ShiftOS.Objects.Unite.Download download)
        {
            string devUpdate = "";

            if (!string.IsNullOrEmpty(download.DevUpdateId))
            {
                devUpdate = $@"## Development update

<iframe src=""http://youtube.com/embed/{download.DevUpdateId}"" allowfullscreen width=""720"" height=""480""></iframe>
";
            }

            string screenshot = "";

            if (!string.IsNullOrEmpty(download.ScreenshotUrl))
            {
                screenshot = $"<img src=\"http://getshiftos.ml{download.ScreenshotUrl}\" style=\"max-width:720px;width:auto;height:auto;\"/>";
            }

            lbupdatetitle.Text = download.Name;
            string markdown = $@"**Built on {download.PostDate}**

{devUpdate}

{screenshot}

## Changelog

{download.Changelog}";

            ConstructHtml(markdown);

            pgdownload.Value = 0;
            pgdownload.Text  = "Waiting.";
            btnaction.Text   = "Update";
            btnaction.Show();
            OnActionButtonClick = () =>
            {
                pgdownload.Show();
                var wc = new WebClient();
                wc.DownloadProgressChanged += (o, a) =>
                {
                    this.Invoke(new Action(() =>
                    {
                        pgdownload.Text  = "Downloading " + download.Name + "...";
                        pgdownload.Value = a.ProgressPercentage;
                    }));
                };

                wc.DownloadDataCompleted += (o, a) =>
                {
                    if (Directory.Exists("updater-work"))
                    {
                        Directory.Delete("updater-work", true);
                    }
                    Directory.CreateDirectory("updater-work");

                    string temp_guid = Guid.NewGuid().ToString();

                    File.WriteAllBytes($"{temp_guid}.zip", a.Result);

                    ZipFile.ExtractToDirectory($"{temp_guid}.zip", "updater-work");

                    File.Delete($"{temp_guid}.zip");

                    //Start the updater helper.
                    System.Diagnostics.Process.Start("ShiftOS.Updater.exe");

                    //Now we stop the engine.
                    TerminalBackend.InvokeCommand("sos.shutdown");
                };

                wc.DownloadDataAsync(new Uri($"http://getshiftos.ml{download.DownloadUrl}"));
            };
        }
예제 #9
0
 private void pnlminimize_Click(object sender, EventArgs e)
 {
     TerminalBackend.InvokeCommand($"win.mini{{id:{this.ParentForm.GetHashCode()}}}");
 }
예제 #10
0
 public void shutdown()
 {
     TerminalBackend.InvokeCommand("sys.shutdown");
 }
예제 #11
0
 public void executeCommand(string cmd)
 {
     TerminalBackend.InvokeCommand(cmd);
 }
예제 #12
0
        public static void MakeWidget(Controls.TerminalBox txt)
        {
            AppearanceManager.StartConsoleOut();
            txt.GotFocus += (o, a) => {
                AppearanceManager.ConsoleOut = txt;
            };
            txt.KeyDown += (o, a) => {
                if (a.KeyCode == Keys.Enter)
                {
                    try {
                        a.SuppressKeyPress = true;
                        Console.WriteLine("");
                        var text  = txt.Lines.ToArray();
                        var text2 = text[text.Length - 2];
                        var text3 = "";
                        var text4 = Regex.Replace(text2, @"\t|\n|\r", "");

                        if (TerminalBackend.PrefixEnabled)
                        {
                            text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
                        }
                        TerminalBackend.LastCommand = text3;
                        TextSent?.Invoke(text4);
                        if (TerminalBackend.InStory == false)
                        {
                            TerminalBackend.InvokeCommand(text3);
                        }
                        if (TerminalBackend.PrefixEnabled)
                        {
                            Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
                        }
                    } catch {
                    }
                }
                else if (a.KeyCode == Keys.Back)
                {
                    var tostring3   = txt.Lines[txt.Lines.Length - 1];
                    var tostringlen = tostring3.Length + 1;
                    var workaround  = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                    var derp        = workaround.Length + 1;
                    if (tostringlen != derp)
                    {
                        AppearanceManager.CurrentPosition--;
                    }
                    else
                    {
                        a.SuppressKeyPress = true;
                    }
                }
                else if (a.KeyCode == Keys.Left)
                {
                    var getstring = txt.Lines[txt.Lines.Length - 1];
                    var stringlen = getstring.Length + 1;
                    var header    = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                    var headerlen = header.Length + 1;
                    var selstart  = txt.SelectionStart;
                    var remstrlen = txt.TextLength - stringlen;
                    var finalnum  = selstart - remstrlen;

                    if (finalnum != headerlen)
                    {
                        AppearanceManager.CurrentPosition--;
                    }
                    else
                    {
                        a.SuppressKeyPress = true;
                    }
                }
                //( ͡° ͜ʖ ͡° ) You found the lennyface without looking at the commit message. Message Michael in the #shiftos channel on Discord saying "ladouceur" somewhere in your message if you see this.
                else if (a.KeyCode == Keys.Up)
                {
                    var tostring3 = txt.Lines[txt.Lines.Length - 1];
                    if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
                    {
                        Console.Write(TerminalBackend.LastCommand);
                    }
                    a.SuppressKeyPress = true;
                }
                else
                {
                    if (TerminalBackend.InStory)
                    {
                        a.SuppressKeyPress = true;
                    }
                    AppearanceManager.CurrentPosition++;
                }
            };

            AppearanceManager.ConsoleOut = txt;

            txt.Focus();

            txt.Font      = LoadedSkin.TerminalFont;
            txt.ForeColor = LoadedSkin.TerminalForeColor;
            txt.BackColor = LoadedSkin.TerminalBackColor;
        }
예제 #13
0
        /// <summary>
        /// Populates the app launcher.
        /// </summary>
        /// <returns>The app launcher.</returns>
        /// <param name="items">Items.</param>
        public void PopulateAppLauncher(LauncherItem[] items)
        {
            if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
            {
                pnladvancedal.Visible        = false;
                flapps.BackColor             = LoadedSkin.Menu_ToolStripDropDownBackground;
                flcategories.BackColor       = LoadedSkin.Menu_ToolStripDropDownBackground;
                pnlalsystemactions.BackColor = LoadedSkin.SystemPanelBackground;
                lbalstatus.BackColor         = LoadedSkin.ALStatusPanelBackColor;
                //Fonts
                lbalstatus.Font      = LoadedSkin.ALStatusPanelFont;
                lbalstatus.ForeColor = LoadedSkin.ALStatusPanelTextColor;
                btnshutdown.Font     = LoadedSkin.ShutdownFont;

                //Upgrades
                btnshutdown.Visible = Shiftorium.UpgradeInstalled("al_shutdown");

                //Alignments and positions.
                lbalstatus.TextAlign = LoadedSkin.ALStatusPanelAlignment;
                if (LoadedSkin.ShutdownButtonStyle == 2)
                {
                    btnshutdown.Hide();
                }
                else if (LoadedSkin.ShutdownButtonStyle == 1)
                {
                    btnshutdown.Parent = pnlstatus;
                    btnshutdown.BringToFront();
                }
                else
                {
                    btnshutdown.Parent = pnlalsystemactions;
                }
                if (LoadedSkin.ShutdownOnLeft)
                {
                    btnshutdown.Location = LoadedSkin.ShutdownButtonFromSide;
                }
                else
                {
                    btnshutdown.Left = (btnshutdown.Parent.Width - btnshutdown.Width) - LoadedSkin.ShutdownButtonFromSide.X;
                    btnshutdown.Top  = LoadedSkin.ShutdownButtonFromSide.Y;
                }

                //Images
                lbalstatus.BackgroundImage       = GetImage("al_bg_status");
                lbalstatus.BackgroundImageLayout = GetImageLayout("al_bg_status");

                pnlalsystemactions.BackgroundImage       = GetImage("al_bg_system");
                pnlalsystemactions.BackgroundImageLayout = GetImageLayout("al_bg_system");
                if (pnlalsystemactions.BackgroundImage != null)
                {
                    btnshutdown.BackColor = Color.Transparent;
                }

                btnshutdown.Font      = LoadedSkin.ShutdownFont;
                btnshutdown.ForeColor = LoadedSkin.ShutdownForeColor;

                pnladvancedal.Size = LoadedSkin.AALSize;

                pnlalsystemactions.Height = LoadedSkin.ALSystemActionHeight;
                pnlstatus.Height          = LoadedSkin.ALSystemStatusHeight;

                flcategories.Width = LoadedSkin.AALCategoryViewWidth;
                this.flapps.Width  = LoadedSkin.AALItemViewWidth;
            }


            if (DesktopFunctions.ShowDefaultElements == true)
            {
                apps.DropDownItems.Clear();

                Dictionary <string, List <ToolStripMenuItem> > sortedItems = new Dictionary <string, List <ToolStripMenuItem> >();

                flcategories.Controls.Clear();

                LauncherItemList.Clear();


                foreach (var kv in items)
                {
                    var item = new ToolStripMenuItem();
                    item.Text   = (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType);
                    item.Image  = (kv.LaunchType == null) ? null : SkinEngine.GetIcon(kv.LaunchType.Name);
                    item.Click += (o, a) =>
                    {
                        if (kv is LuaLauncherItem)
                        {
                            var interpreter = new Engine.Scripting.LuaInterpreter();
                            interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath);
                        }
                        else
                        {
                            Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
                        }
                    };
                    if (sortedItems.ContainsKey(kv.DisplayData.Category))
                    {
                        sortedItems[kv.DisplayData.Category].Add(item);
                        LauncherItemList[kv.DisplayData.Category].Add(kv);
                    }
                    else
                    {
                        sortedItems.Add(kv.DisplayData.Category, new List <ToolStripMenuItem>());
                        sortedItems[kv.DisplayData.Category].Add(item);
                        LauncherItemList.Add(kv.DisplayData.Category, new List <LauncherItem> {
                            kv
                        });
                    }
                }

                foreach (var kv in sortedItems)
                {
                    if (Shiftorium.IsInitiated == true)
                    {
                        if (Shiftorium.UpgradeInstalled("app_launcher_categories"))
                        {
                            var cat = GetALCategoryWithName(kv.Key);
                            foreach (var subItem in kv.Value)
                            {
                                cat.DropDownItems.Add(subItem);
                            }
                            if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
                            {
                                var catbtn = new Button();
                                catbtn.Font      = LoadedSkin.AdvALItemFont;
                                catbtn.FlatStyle = FlatStyle.Flat;
                                catbtn.FlatAppearance.BorderSize         = 0;
                                catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected;
                                catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin;
                                catbtn.BackColor   = LoadedSkin.Menu_ToolStripDropDownBackground;
                                catbtn.TextAlign   = ContentAlignment.MiddleLeft;
                                catbtn.ForeColor   = LoadedSkin.Menu_TextColor;
                                catbtn.MouseEnter += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor;
                                };
                                catbtn.MouseLeave += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_TextColor;
                                };
                                catbtn.Text   = kv.Key;
                                catbtn.Width  = flcategories.Width;
                                catbtn.Height = 24;
                                flcategories.Controls.Add(catbtn);
                                catbtn.Show();
                                catbtn.Click += (o, a) => SetupAdvancedCategory(catbtn.Text);
                            }
                        }

                        else
                        {
                            foreach (var subItem in kv.Value)
                            {
                                apps.DropDownItems.Add(subItem);
                            }
                        }
                    }
                }

                if (Shiftorium.IsInitiated == true)
                {
                    if (Shiftorium.UpgradeInstalled("al_shutdown"))
                    {
                        apps.DropDownItems.Add(new ToolStripSeparator());
                        var item = new ToolStripMenuItem();
                        item.Text   = Localization.Parse("{SHUTDOWN}");
                        item.Click += (o, a) =>
                        {
                            TerminalBackend.InvokeCommand("shutdown");
                        };
                        apps.DropDownItems.Add(item);
                        if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
                        {
                            if (LoadedSkin.ShutdownButtonStyle == 2)
                            {
                                var catbtn = new Button();
                                catbtn.Font      = LoadedSkin.AdvALItemFont;
                                catbtn.FlatStyle = FlatStyle.Flat;
                                catbtn.FlatAppearance.BorderSize         = 0;
                                catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected;
                                catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin;
                                catbtn.BackColor   = LoadedSkin.Menu_ToolStripDropDownBackground;
                                catbtn.ForeColor   = LoadedSkin.Menu_TextColor;
                                catbtn.MouseEnter += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor;
                                };
                                catbtn.MouseLeave += (o, a) =>
                                {
                                    catbtn.ForeColor = LoadedSkin.Menu_TextColor;
                                };

                                catbtn.TextAlign = ContentAlignment.MiddleLeft;
                                catbtn.Text      = "Shutdown";
                                catbtn.Width     = flcategories.Width;
                                catbtn.Height    = 24;
                                flcategories.Controls.Add(catbtn);
                                catbtn.Show();
                                catbtn.Click += (o, a) => TerminalBackend.InvokeCommand("shutdown");
                            }
                        }
                    }
                }
            }
            LuaInterpreter.RaiseEvent("on_al_populate", items);
        }
예제 #14
0
 private void btnshutdown_Click(object sender, EventArgs e)
 {
     TerminalBackend.InvokeCommand("shutdown");
 }