Exemple #1
0
        public void chooseOutputFolder(D options, ObjectRPC.PayloadDelegate reply)
        {
            var dialog = new System.Windows.Forms.FolderBrowserDialog();

            string initial = (string)options["initial"];

            if (initial != null)
            {
                dialog.SelectedPath = initial;
            }

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                reply(new D {
                    { "ok", true }, { "path", dialog.SelectedPath }
                });
            }
            else
            {
                reply(new D {
                    { "ok", false }
                });
            }
        }
Exemple #2
0
        private void HandleNodeMessageEvent(string nodeLine)
        {
            var    b           = (object[])fastJSON.JSON.Instance.ToObject(nodeLine);
            string messageType = (string)b[0];

            if (messageType == "app.displayCriticalError")
            {
                var arg = (Dictionary <string, object>)b[1];

                var title  = (string)arg["title"];
                var text   = (string)arg["text"];
                var url    = (string)arg["url"];
                var button = (string)arg["button"];

                MessageBox.Show(text, title, MessageBoxButton.OK, MessageBoxImage.Error);
                App.Current.Shutdown();
            }
            else if (messageType == "rpc")
            {
                var arg = (Dictionary <string, object>)b[1];

                ObjectRPC.PayloadDelegate reply = null;
                if (b.Length > 2)
                {
                    string callback = (string)b[2];
                    reply = (payload => SendCommand(callback, payload));
                }

                rpcRoot.ProcessIncomingUpdate(arg, reply);
            }
        }