Beispiel #1
0
        public override Json OnCommand(Json data)
        {
            string command = data["command"].Value as string;

            if (command == "test2")
            {
                Forms.WindowMan w = new Forms.WindowMan();                 // ClodoTemp
                w.ShowDialog();
            }
            else if (command == "ui.color")
            {
                if (FormMain != null)
                {
                    FormMain.SetColor(data["color"].Value as string);
                }
            }
            else if (command == "ui.status")
            {
                string textFull  = data["full"].Value as string;
                string textShort = textFull;
                if (data.HasKey("short"))
                {
                    textShort = data["short"].Value as string;
                }
                if (FormMain != null)
                {
                    FormMain.SetStatus(textFull, textShort);
                }
            }

            return(base.OnCommand(data));
        }
Beispiel #2
0
        public override void OnReceive(Json data)
        {
            base.OnReceive(data);

            // Engine.Instance.Logs.LogVerbose("OnReceive:" + data.ToJson()); // TOCLEAN

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

            if (cmd == "test2")
            {
                Forms.WindowMan w = new Forms.WindowMan();                 // ClodoTemp
                w.ShowDialog();
            }
            else if (cmd == "ui.notification")
            {
                if (FormMain != null)
                {
                    FormMain.ShowWindowsNotification(data["level"].Value as string, data["message"].Value as string);
                }
            }
            else if (cmd == "ui.color")
            {
                if (FormMain != null)
                {
                    FormMain.SetColor(data["color"].Value as string);
                }
            }
            else if (cmd == "ui.status")
            {
                string textFull  = data["full"].Value as string;
                string textShort = textFull;
                if (data.HasKey("short"))
                {
                    textShort = data["short"].Value as string;
                }
                if (FormMain != null)
                {
                    FormMain.SetStatus(textFull, textShort);
                }
            }
            else if (cmd == "ui.updater.available")
            {
                FormMain.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 (FormMain != null)
                {
                    FormMain.OnSystemReport(step, text, perc);
                }
            }
        }
Beispiel #3
0
        public override void OnReceive(Json data)
        {
            base.OnReceive(data);

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

            if (cmd == "test2")
            {
                Forms.WindowMan w = new Forms.WindowMan();                 // ClodoTemp
                w.ShowDialog();
            }
            else if (cmd == "log")
            {
                if (data["type"].Value as string == "fatal")
                {
                    if (SplashWindow != null)
                    {
                        SplashWindow.OnMessageError(data["message"].Value as string);
                    }
                    else if (MainWindow != null)
                    {
                        MainWindow.OnMessageError(data["message"].Value as string);
                    }
                    else
                    {
                        GuiUtils.MessageBoxError(null, 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")
            {
                Form.Skin.ClearFontCache();                 // Splash loaded before options

                SplashWindow.RequestMain();
            }
            else if (cmd == "ui.restarted")
            {
                // Hide Splash when waiting elevated subprocess
                SplashWindow.RequestClose();
            }
            else if (cmd == "ui.notification")
            {
                if (MainWindow != null)
                {
                    MainWindow.ShowWindowsNotification(data["level"].Value as string, data["message"].Value as string);
                }
            }
            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)
                {
                    MainWindow.SetMainStatus(appIcon, appColor, actionIcon, actionCommand, actionText);
                }
            }
            else if (cmd == "ui.status")
            {
                string textFull  = data["full"].Value as string;
                string textShort = textFull;
                if (data.HasKey("short"))
                {
                    textShort = data["short"].Value as string;
                }
                if (MainWindow != null)
                {
                    MainWindow.SetStatus(textFull, textShort);
                }
            }
            else if (cmd == "ui.updater.available")
            {
                MainWindow.ShowUpdater();
            }
            else if (cmd == "ui.frontmessage")
            {
                if (UiClient.Instance.MainWindow != null)
                {
                    UiClient.Instance.MainWindow.OnFrontMessage(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)
                {
                    MainWindow.OnSystemReport(step, text, perc);
                }
            }
        }