Пример #1
0
        /// <summary>
        /// Instructs Blish HUD to unload and exit.
        /// </summary>
        public void Exit()
        {
            (new Thread(() => {
                Thread.Sleep(FORCE_EXIT_TIMEOUT);
                Logger.Warn("Unload took too long. Forcing exit.");
                Environment.Exit(0);
            })
            {
                IsBackground = true
            }).Start();

            ActiveBlishHud.Exit();
        }
Пример #2
0
        /// <summary>
        /// Instructs Blish HUD to unload and then restart.
        /// </summary>
        public void Restart()
        {
            this.BeginExit(0);

            // REF: https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Application.cs,1447

            var arguments = Environment.GetCommandLineArgs()
                            .Skip(1)
                            .Where(arg => !string.Equals(arg, $"--{ApplicationSettings.OPTION_RESTARTSKIPMUTEX}", StringComparison.OrdinalIgnoreCase))
                            .Append($"--{ApplicationSettings.OPTION_RESTARTSKIPMUTEX}")
                            .Select(arg => $"\"{arg}\"");

            var currentStartInfo = Process.GetCurrentProcess().StartInfo;

            currentStartInfo.FileName  = Application.ExecutablePath;
            currentStartInfo.Arguments = string.Join(" ", arguments);

            Process.Start(currentStartInfo);

            ActiveBlishHud.Exit();
        }
Пример #3
0
        protected override void Load()
        {
            this.BlishMenuIcon = new CornerIcon()
            {
                Icon             = Content.GetTexture("logo"),
                HoverIcon        = Content.GetTexture("logo-big"),
                Menu             = new ContextMenuStrip(),
                BasicTooltipText = Properties.Strings.General_BlishHUD,
                Priority         = int.MaxValue,
                Parent           = Graphics.SpriteScreen,
            };

            this.BlishContextMenu = this.BlishMenuIcon.Menu;
            this.BlishContextMenu.AddMenuItem($"{Properties.Strings.General_Close} {Properties.Strings.General_BlishHUD}").Click += delegate { ActiveBlishHud.Exit(); };

            this.BlishHudWindow = new TabbedWindow()
            {
                Parent = Graphics.SpriteScreen,
                Title  = Properties.Strings.General_BlishHUD,
                Emblem = Content.GetTexture("test-window-icon9")
            };

            this.BlishMenuIcon.LeftMouseButtonReleased += delegate {
                this.BlishHudWindow.ToggleWindow();
            };

            // Center the window so that you don't have to drag it over every single time (which is really annoying)
            // TODO: Save window positions to settings so that they remember where they were last
            Graphics.SpriteScreen.Resized += delegate {
                if (!this.BlishHudWindow.Visible)
                {
                    this.BlishHudWindow.Location = new Point(Graphics.WindowWidth / 2 - this.BlishHudWindow.Width / 2, Graphics.WindowHeight / 2 - this.BlishHudWindow.Height / 2);
                }
            };

            this.BlishHudWindow.AddTab(Properties.Strings.Service_DirectorService_Tab_Home, Content.GetTexture("255369"), BuildHomePanel(this.BlishHudWindow), int.MinValue);
        }
Пример #4
0
        /// <summary>
        /// Instructs Blish HUD to unload and exit.
        /// </summary>
        public void Exit()
        {
            this.BeginExit(FORCE_EXIT_TIMEOUT);

            ActiveBlishHud.Exit();
        }