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); } }); } } }