Exemple #1
0
        public override void FinishedLaunching(NSObject notification)
        {
            Engine.Instance.TerminateEvent += delegate() {
                new NSObject ().InvokeOnMainThread (() => {
                    //NSApplication.SharedApplication.ReplyToApplicationShouldTerminate (true);
                    NSApplication.SharedApplication.Terminate(new NSObject ());
                });
            };

            UpdateInterfaceStyle ();

            mainWindowController = new MainWindowController ();

            bool startVisible = Engine.Instance.Storage.GetBool("gui.osx.visible");
            if (startVisible) {
                mainWindowController.Window.MakeKeyAndOrderFront (this);
            } else {
                mainWindowController.Window.IsVisible = false;
            }
            NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);

            NSProcessInfo.ProcessInfo.DisableSuddenTermination (); // Already disabled by default

            MenuEvents ();
        }
Exemple #2
0
        public override void OnDeInit2()
        {
            base.OnDeInit2 ();

            if (MainWindow != null) {
                new NSObject ().InvokeOnMainThread (() => {
                    MainWindow.Close ();
                    MainWindow = null; // 2.10.2
                });
            }
        }
 public MainWindowDelegate(MainWindowController main)
 {
     m_main = main;
 }
Exemple #4
0
 public TableServersDelegate(MainWindowController main)
 {
     m_main = main;
 }
Exemple #5
0
 public MainWindowDelegate(MainWindowController main)
 {
     m_main = main;
 }
Exemple #6
0
 public TableProvidersDelegate(MainWindowController main)
 {
     m_main = main;
 }
 public TableAreasDelegate(MainWindowController main)
 {
     m_main = main;
 }
Exemple #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(() =>
                {
                    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(() =>
                    {
                        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(() =>
                    {
                        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(() =>
                    {
                        MainWindow.SetMainStatus(appIcon, appColor, actionIcon, actionCommand, actionText);
                    });
                }
            }
            else if (cmd == "ui.updater.available")
            {
                new NSObject().InvokeOnMainThread(() =>
                {
                    MainWindow.ShowUpdater();
                });
            }
            else if (cmd == "ui.frontmessage")
            {
                new NSObject().InvokeOnMainThread(() =>
                {
                    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(() =>
                    {
                        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);
                        }
                    });
                }
            }
        }
 public TableServersDelegate(MainWindowController main)
 {
     m_main = main;
 }
 public TableAreasDelegate(MainWindowController main)
 {
     m_main = main;
 }