public override Json OnCommand(Json 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); }); } } return(base.OnCommand(data)); }
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); } }); } } }