Пример #1
0
 public void RequestShow()
 {
     new NSObject().InvokeOnMainThread(() =>
     {
         GuiUtils.ShowWindowWithFocus(this, null);
     });
 }
Пример #2
0
        public void FrontMessage(Json jMessage)
        {
            WindowFrontMessageController w = new WindowFrontMessageController();

            (Engine.Instance as Engine).WindowsOpen.Add(w);
            w.Message = jMessage;
            GuiUtils.ShowWindowWithFocus(w, this);
        }
Пример #3
0
        public void Restore(object sender)
        {
            NSApplication.SharedApplication.ActivateIgnoringOtherApps(true);

            GuiUtils.ShowWindowWithFocus(this, this);
            Window.MakeMainWindow();
            EnabledUI();
        }
Пример #4
0
 public void ShowPreferences()
 {
     if ((windowPreferences == null) || (windowPreferences.Window.IsVisible == false))
     {
         windowPreferences = new WindowPreferencesController();
     }
     GuiUtils.ShowWindowWithFocus(windowPreferences, this);
 }
Пример #5
0
 public void ShowAbout()
 {
     if ((windowAbout == null) || (windowAbout.Window.IsVisible == false))
     {
         windowAbout = new WindowAboutController();
     }
     GuiUtils.ShowWindowWithFocus(windowAbout, this);
 }
Пример #6
0
        public void Restore(object sender)
        {
            NSApplication.SharedApplication.ActivateIgnoringOtherApps(true);

            GuiUtils.ShowWindowWithFocus(this, this);
            Window.MakeMainWindow();
            EnabledUI();

            /*
             * ShowWindow (this);
             * Window.MakeMainWindow ();
             * Window.Deminiaturize (this);
             * EnabledUI ();
             * Window.MakeKeyAndOrderFront (this);
             */
        }
Пример #7
0
        public override void OnSystemReport(string step, string text, int perc)
        {
            base.OnSystemReport(step, text, perc);

            if (MainWindow != null)
            {
                new NSObject().InvokeOnMainThread(() =>
                {
                    if ((m_windowReport == null) || (m_windowReport.Window.IsVisible == false))
                    {
                        m_windowReport = new WindowReportController();
                        GuiUtils.ShowWindowWithFocus(m_windowReport, this.MainWindow);
                    }

                    if (m_windowReport != null)
                    {
                        m_windowReport.SetStep(step, text, perc);
                    }
                });
            }
        }
Пример #8
0
        public override void OnReceive(Json data)
        {
            base.OnReceive(data);

            string cmd = data["command"].Value as string;

            if (cmd == "log")
            {
                if (data["type"].Value as string == "fatal")
                {
                    if (SplashWindow != null)
                    {
                        SplashWindow.MessageError(data["message"].Value as string);
                    }
                    else if (MainWindow != null)
                    {
                        MainWindow.MessageError(data["message"].Value as string);
                    }
                    else
                    {
                        GuiUtils.MessageBoxError(data["message"].Value as string);
                    }
                }
            }
            else if (cmd == "init.step")
            {
                if (SplashWindow != null)
                {
                    SplashWindow.SetStatus(data["message"].Value as string);
                }
            }
            else if (cmd == "engine.ui")
            {
                SplashWindow.SetStatus("Loading UI");

                //UpdateInterfaceStyle();

                new NSObject().InvokeOnMainThread(() => // BeginInvokeOnMainThread
                {
                    MainWindow        = new MainWindowController();
                    bool startVisible = Engine.Storage.GetBool("gui.osx.visible");
                    if (startVisible)
                    {
                        MainWindow.Window.MakeKeyAndOrderFront(null);
                    }
                    else
                    {
                        MainWindow.Window.IsVisible = false;
                    }
                    UiClient.Instance.SplashWindow.RequestCloseForReady();
                });
            }
            else if (cmd == "ui.notification")
            {
                if (MainWindow != null)
                {
                    new NSObject().InvokeOnMainThread(() => // BeginInvokeOnMainThread
                    {
                        MainWindow.ShowNotification(data["message"].Value as string, data["level"].Value as string);
                    });
                }
            }
            else if (cmd == "ui.status")
            {
                if (MainWindow != null)
                {
                    string textFull  = data["full"].Value as string;
                    string textShort = textFull;
                    if (data.HasKey("short"))
                    {
                        textShort = data["short"].Value as string;
                    }

                    new NSObject().InvokeOnMainThread(() => // BeginInvokeOnMainThread
                    {
                        MainWindow.SetStatus(textFull, textShort);
                    });
                }
            }
            else if (cmd == "ui.main-status")
            {
                string appIcon       = data["app_icon"].Value as string;
                string appColor      = data["app_color"].Value as string;
                string actionIcon    = data["action_icon"].Value as string;
                string actionCommand = data["action_command"].Value as string;
                string actionText    = data["action_text"].Value as string;

                if (MainWindow != null)
                {
                    new NSObject().InvokeOnMainThread(() => // BeginInvokeOnMainThread
                    {
                        MainWindow.SetMainStatus(appIcon, appColor, actionIcon, actionCommand, actionText);
                    });
                }
            }
            else if (cmd == "ui.updater.available")
            {
                new NSObject().InvokeOnMainThread(() => // BeginInvokeOnMainThread
                {
                    MainWindow.ShowUpdater();
                });
            }
            else if (cmd == "ui.frontmessage")
            {
                new NSObject().InvokeOnMainThread(() => // BeginInvokeOnMainThread
                {
                    MainWindow.FrontMessage(data["message"].Value as Json);
                });
            }
            else if (cmd == "system.report.progress")
            {
                string step = data["step"].Value as string;
                string text = data["body"].Value as string;
                int    perc = Conversions.ToInt32(data["perc"].Value, 0);

                if (MainWindow != null)
                {
                    new NSObject().InvokeOnMainThread(() => // BeginInvokeOnMainThread
                    {
                        if ((m_windowReport == null) || (m_windowReport.Window.IsVisible == false))
                        {
                            m_windowReport = new WindowReportController();
                            GuiUtils.ShowWindowWithFocus(m_windowReport, this.MainWindow);
                        }

                        if (m_windowReport != null)
                        {
                            m_windowReport.SetStep(step, text, perc);
                        }
                    });
                }
            }
        }
Пример #9
0
        public override void OnReceive(Json data)
        {
            base.OnReceive(data);

            string cmd = data["command"].Value as string;

            if (cmd == "ui.notification")
            {
                if (MainWindow != null)
                {
                    new NSObject().InvokeOnMainThread(() =>
                    {
                        MainWindow.ShowNotification(data["message"].Value as string);
                    });
                }
            }
            else if (cmd == "ui.color")
            {
                if (MainWindow != null)
                {
                    new NSObject().InvokeOnMainThread(() =>
                    {
                        MainWindow.SetColor(data["color"].Value as string);
                    });
                }
            }
            else if (cmd == "ui.status")
            {
                if (MainWindow != null)
                {
                    string textFull  = data["full"].Value as string;
                    string textShort = textFull;
                    if (data.HasKey("short"))
                    {
                        textShort = data["short"].Value as string;
                    }

                    new NSObject().InvokeOnMainThread(() =>
                    {
                        MainWindow.SetStatus(textFull, textShort);
                    });
                }
            }
            else if (cmd == "ui.updater.available")
            {
                new NSObject().InvokeOnMainThread(() =>
                {
                    MainWindow.ShowUpdater();
                });
            }
            else if (cmd == "system.report.progress")
            {
                string step = data["step"].Value as string;
                string text = data["body"].Value as string;
                int    perc = Conversions.ToInt32(data["perc"].Value, 0);

                if (MainWindow != null)
                {
                    new NSObject().InvokeOnMainThread(() =>
                    {
                        if ((m_windowReport == null) || (m_windowReport.Window.IsVisible == false))
                        {
                            m_windowReport = new WindowReportController();
                            GuiUtils.ShowWindowWithFocus(m_windowReport, this.MainWindow);
                        }

                        if (m_windowReport != null)
                        {
                            m_windowReport.SetStep(step, text, perc);
                        }
                    });
                }
            }
        }