Exemplo n.º 1
0
        private void Add(string Type)
        {
            string             FullJid            = this.Concentrator?.FullJid;
            ConcentratorClient ConcentratorClient = this.ConcentratorClient;

            if (ConcentratorClient != null && !string.IsNullOrEmpty(FullJid))
            {
                Mouse.OverrideCursor = Cursors.Wait;

                ConcentratorClient.GetParametersForNewNode(FullJid, this.nodeInfo, Type, "en", string.Empty, string.Empty, string.Empty, (sender, Form) =>
                {
                    MainWindow.MouseDefault();

                    MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() =>
                    {
                        ParameterDialog Dialog = new ParameterDialog(Form);
                        Dialog.ShowDialog();
                    }));
                }, (sender, e) =>
                {
                    if (e.Ok)
                    {
                        this.Add(new Node(this, e.NodeInformation));
                    }
                }, null);
            }
        }
Exemplo n.º 2
0
        private void Add(string Type)
        {
            string             FullJid            = this.Concentrator?.FullJid;
            ConcentratorClient ConcentratorClient = this.ConcentratorClient;

            if (ConcentratorClient != null && !string.IsNullOrEmpty(FullJid))
            {
                Mouse.OverrideCursor = Cursors.Wait;

                ConcentratorClient.GetParametersForNewNode(FullJid, this.nodeInfo, Type, "en", string.Empty, string.Empty, string.Empty, (sender, Form) =>
                {
                    MainWindow.MouseDefault();

                    MainWindow.UpdateGui(() =>
                    {
                        ParameterDialog Dialog = new ParameterDialog(Form);
                        Dialog.ShowDialog();
                    });

                    return(Task.CompletedTask);
                }, (sender, e) =>
                {
                    if (e.Ok)
                    {
                        this.Add(new Node(this, e.NodeInformation));
                    }

                    return(Task.CompletedTask);
                }, null);
            }
        }
Exemplo n.º 3
0
        public override void Edit()
        {
            Mouse.OverrideCursor = Cursors.Wait;

            this.PubSubClient.GetNodeConfiguration(this.node, (sender, e) =>
            {
                MainWindow.MouseDefault();

                if (e.Ok)
                {
                    DataForm Form = null;

                    Form = new DataForm(this.PubSubClient.Client,
                                        (sender2, e2) =>
                    {
                        Mouse.OverrideCursor = Cursors.Wait;

                        this.PubSubClient.ConfigureNode(this.node, e.Form, (sender3, e3) =>
                        {
                            MainWindow.MouseDefault();

                            if (e3.Ok)
                            {
                                this.name = Form["pubsub#title"]?.ValueString ?? string.Empty;

                                if (!Enum.TryParse <NodeType>(Form["pubsub#node_type"]?.ValueString ?? string.Empty, out this.nodeType))
                                {
                                    this.nodeType = NodeType.leaf;
                                }

                                this.SetParameters();
                                this.OnUpdated();
                            }
                            else
                            {
                                MainWindow.ErrorBox("Unable to update node: " + e3.ErrorText);
                            }
                        }, null);
                    },
                                        (sender2, e2) =>
                    {
                        // Do nothing.
                    }, string.Empty, string.Empty, e.Form.Fields);

                    ParameterDialog Dialog = new ParameterDialog(Form);

                    MainWindow.UpdateGui(() =>
                    {
                        Dialog.ShowDialog();
                    });
                }
                else
                {
                    MainWindow.ErrorBox("Unable to get node properties: " + e.ErrorText);
                }
            }, null);
        }
Exemplo n.º 4
0
        public override void Add()
        {
            DataForm        Form   = null;
            ParameterDialog Dialog = null;

            Form = new DataForm(this.Service.PubSubClient.Client,
                                (sender2, e2) =>
            {
                string Payload = Form["Payload"].ValueString;
                string ItemId  = Form["ItemId"].ValueString;

                try
                {
                    XmlDocument Xml = new XmlDocument();
                    Xml.LoadXml(Payload);
                }
                catch (Exception ex)
                {
                    Form["Payload"].Error = ex.Message;

                    MainWindow.UpdateGui(() =>
                    {
                        Dialog = new ParameterDialog(Form);
                        Dialog.ShowDialog();
                    });

                    return;
                }

                Mouse.OverrideCursor = Cursors.Wait;

                this.Service.PubSubClient.Publish(this.node, ItemId, Payload, (sender3, e3) =>
                {
                    MainWindow.MouseDefault();

                    if (!e3.Ok)
                    {
                        MainWindow.ErrorBox("Unable to add item: " + e3.ErrorText);
                    }
                }, null);
            },
                                (sender2, e2) =>
            {
                // Do nothing.
            }, string.Empty, string.Empty,
                                new TextSingleField(null, "ItemId", "Item ID:", false, new string[] { string.Empty }, null, "ID of item to create. If not provided, one will be generated for you.",
                                                    StringDataType.Instance, null, string.Empty, false, false, false),
                                new TextMultiField(null, "Payload", "XML:", false, new string[] { string.Empty }, null, "XML payload of item.",
                                                   StringDataType.Instance, null, string.Empty, false, false, false));

            Dialog = new ParameterDialog(Form);

            MainWindow.UpdateGui(() =>
            {
                Dialog.ShowDialog();
            });
        }
Exemplo n.º 5
0
 public override void Run()
 {
     if (model.ReportSettings.ParameterCollection != null && model.ReportSettings.ParameterCollection.Count > 0)
     {
         using (ParameterDialog dlg = new ParameterDialog(model.ReportSettings.ParameterCollection)){
             dlg.ShowDialog();
         }
     }
 }
Exemplo n.º 6
0
        private Task MucClient_OccupantRequest(object Sender, MessageFormEventArgs e)
        {
            MainWindow.UpdateGui(() =>
            {
                ParameterDialog Dialog = new ParameterDialog(e.Form);
                Dialog.ShowDialog();
            });

            return(Task.CompletedTask);
        }
Exemplo n.º 7
0
        private DataSet ExecuteStoredProc(SharpQueryProcedure procedure)
        {
            SharpQuerySchemaClassCollection tmp = procedure.GetSchemaParameters();

            this.sqlParamsCollection = new ParameterCollection();
            SqlParameterConverter converter = new SqlParameterConverter();

            if (converter.CanConvertFrom(typeof(SharpQuerySchemaClassCollection)))
            {
                if (converter.CanConvertTo(null, typeof(ParameterCollection)))
                {
                    sqlParamsCollection = (ParameterCollection)converter.ConvertTo(null,
                                                                                   CultureInfo.InstalledUICulture,
                                                                                   tmp,
                                                                                   typeof(ParameterCollection));
                }
            }

            if (sqlParamsCollection.Count > 0)
            {
                using (ParameterDialog inputform = new ParameterDialog(sqlParamsCollection)) {
                    if (inputform.ShowDialog() != DialogResult.OK)
                    {
                        return(null);
                    }
                    else
                    {
                        IDbCommand    command = this.BuildCommand();
                        DbDataAdapter adapter = this.BuildAdapter();
                        DataSet       dataSet = ResultPanel.CreateDataSet();
                        try {
                            SqlDataAccessStrategy.BuildQueryParameters(command, sqlParamsCollection);
                            adapter.SelectCommand = (DbCommand)command;

                            adapter.Fill(dataSet);
                            return(dataSet);
                        } catch (Exception e) {
                            MessageService.ShowError(e.Message);
                        } finally {
                            if (adapter.SelectCommand.Connection.State == ConnectionState.Open)
                            {
                                adapter.SelectCommand.Connection.Close();
                            }
                        }
                    }
                }
            }
            return(null);
        }
Exemplo n.º 8
0
		public override void Run()
		{
			if (reportSettings.SqlParameters.Count > 0) {
				using (var paramDialog = new ParameterDialog(reportSettings.SqlParameters))
				{
					paramDialog.ShowDialog();
					if (paramDialog.DialogResult == System.Windows.Forms.DialogResult.OK) {
						foreach (SqlParameter bp in paramDialog.SqlParameterCollection)
						{
							var p = reportSettings.SqlParameters.Find (bp.ParameterName);
							p.ParameterValue = bp.ParameterValue;
						}
					}
				}
			}
		}
Exemplo n.º 9
0
        private void ShowForm(object P)
        {
            Mouse.OverrideCursor = null;

            DataForm Form = (DataForm)P;

            /*string Xml = File.ReadAllText("../../../../Networking/Waher.Networking.XMPP.Test/Data/TestForm.xml");
             * XmlDocument Doc = new XmlDocument();
             * Doc.LoadXml(Xml);
             * Form = new DataForm(Form.Client, Doc.DocumentElement, null, null, Form.From, Form.To);*/

            ParameterDialog Dialog = new ParameterDialog(Form)
            {
                Owner = this
            };

            Dialog.ShowDialog();
        }
Exemplo n.º 10
0
 public override void Run()
 {
     if (model.ReportSettings.SqlParameters.Count > 0)
     {
         using (ParameterDialog paramDialog = new ParameterDialog(model.ReportSettings.SqlParameters))
         {
             paramDialog.ShowDialog();
             if (paramDialog.DialogResult == System.Windows.Forms.DialogResult.OK)
             {
                 foreach (SqlParameter bp in paramDialog.SqlParameterCollection)
                 {
                     var p = model.ReportSettings.SqlParameters.Find(bp.ParameterName);
                     p.ParameterValue = bp.ParameterValue;
                 }
             }
         }
     }
 }
Exemplo n.º 11
0
        private void Add(string Type)
        {
            string             FullJid            = this.Concentrator?.FullJid;
            ConcentratorClient ConcentratorClient = this.ConcentratorClient;

            if (ConcentratorClient != null && !string.IsNullOrEmpty(FullJid))
            {
                Mouse.OverrideCursor = Cursors.Wait;

                ConcentratorClient.GetParametersForNewNode(FullJid, this.nodeInfo, Type, "en", string.Empty, string.Empty, string.Empty, (sender, Form) =>
                {
                    MainWindow.MouseDefault();

                    MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() =>
                    {
                        ParameterDialog Dialog = new ParameterDialog(Form);
                        Dialog.ShowDialog();
                    }));
                }, (sender, e) =>
                {
                    if (e.Ok)
                    {
                        if (!this.loadingChildren && (this.children == null || this.children.Count != 1 || !this.children.ContainsKey(string.Empty)))
                        {
                            SortedDictionary <string, TreeNode> Children = new SortedDictionary <string, TreeNode>();

                            if (this.children != null)
                            {
                                foreach (KeyValuePair <string, TreeNode> P in this.children)
                                {
                                    Children[P.Key] = P.Value;
                                }
                            }

                            Children[e.NodeInformation.NodeId] = new Node(this, e.NodeInformation);
                            this.children = Children;

                            this.OnUpdated();
                            this.Concentrator?.NodesAdded(Children.Values, this);
                        }
                    }
                }, null);
            }
        }
Exemplo n.º 12
0
		public override void Run()
		{
			ReportExplorerPad pad = this.Owner as ReportExplorerPad;
			if (pad != null) {
				using (ParameterDialog paramDialog = new ParameterDialog(pad.ReportModel.ReportSettings.SqlParameters)) {
					paramDialog.ShowDialog();
					if (paramDialog.DialogResult == System.Windows.Forms.DialogResult.OK) {
						foreach (SqlParameter bp in paramDialog.SqlParameterCollection)
						{
							if (bp.ParameterName != null)
							{
								pad.ReportModel.ReportSettings.SqlParameters.Add (bp);
							}
						}
						pad.RefreshParameters();
					}
				}
			}
		}
Exemplo n.º 13
0
        public override void Search()
        {
            this.Account?.Client?.SendSearchFormRequest(null, this.jid, (sender, e) =>
            {
                if (e.Ok)
                {
                    MainWindow.currentInstance.Dispatcher.Invoke(() =>
                    {
                        ParameterDialog Dialog = new ParameterDialog(e.SearchForm);
                        Dialog.ShowDialog();
                    });
                }
                else
                {
                    MainWindow.currentInstance.Dispatcher.Invoke(() => MessageBox.Show(MainWindow.currentInstance,
                                                                                       string.IsNullOrEmpty(e.ErrorText) ? "Unable to get search form." : e.ErrorText, "Error",
                                                                                       MessageBoxButton.OK, MessageBoxImage.Error));
                }
            }, (sender, e) =>
            {
                if (e.Ok)
                {
                    MainWindow.currentInstance.Dispatcher.Invoke(() =>
                    {
                        TabItem TabItem = new TabItem();
                        MainWindow.currentInstance.Tabs.Items.Add(TabItem);

                        SearchResultView View = new SearchResultView(e.Headers, e.Records);

                        TabItem.Header  = "Search Result";
                        TabItem.Content = View;

                        MainWindow.currentInstance.Tabs.SelectedItem = TabItem;
                    });
                }
                else
                {
                    MainWindow.currentInstance.Dispatcher.Invoke(() => MessageBox.Show(MainWindow.currentInstance,
                                                                                       string.IsNullOrEmpty(e.ErrorText) ? "Unable to perform search." : e.ErrorText, "Error",
                                                                                       MessageBoxButton.OK, MessageBoxImage.Error));
                }
            }, null);
        }
Exemplo n.º 14
0
        public override void Search()
        {
            this.Account?.Client?.SendSearchFormRequest(null, this.jid, (sender, e) =>
            {
                if (e.Ok)
                {
                    MainWindow.UpdateGui(() =>
                    {
                        ParameterDialog Dialog = new ParameterDialog(e.SearchForm);
                        Dialog.ShowDialog();
                    });
                }
                else
                {
                    MainWindow.ErrorBox(string.IsNullOrEmpty(e.ErrorText) ? "Unable to get search form." : e.ErrorText);
                }

                return(Task.CompletedTask);
            }, (sender, e) =>
            {
                if (e.Ok)
                {
                    MainWindow.UpdateGui(() =>
                    {
                        TabItem TabItem = MainWindow.NewTab("Search Result");
                        MainWindow.currentInstance.Tabs.Items.Add(TabItem);

                        SearchResultView View = new SearchResultView(e.Headers, e.Records);
                        TabItem.Content       = View;

                        MainWindow.currentInstance.Tabs.SelectedItem = TabItem;
                    });
                }
                else
                {
                    MainWindow.ErrorBox(string.IsNullOrEmpty(e.ErrorText) ? "Unable to perform search." : e.ErrorText);
                }

                return(Task.CompletedTask);
            }, null);
        }
Exemplo n.º 15
0
        public override void Edit()
        {
            string             FullJid            = this.Concentrator?.FullJid;
            ConcentratorClient ConcentratorClient = this.ConcentratorClient;
            string             OldKey             = this.Key;

            if (ConcentratorClient != null && !string.IsNullOrEmpty(FullJid))
            {
                Mouse.OverrideCursor = Cursors.Wait;

                ConcentratorClient.GetNodeParametersForEdit(FullJid, this.nodeInfo, "en", string.Empty, string.Empty, string.Empty, (sender, Form) =>
                {
                    MainWindow.MouseDefault();

                    MainWindow.UpdateGui(() =>
                    {
                        ParameterDialog Dialog = new ParameterDialog(Form);
                        Dialog.ShowDialog();
                    });

                    return(Task.CompletedTask);
                }, (sender, e) =>
                {
                    if (e.Ok)
                    {
                        this.nodeInfo = e.NodeInformation;
                        this.OnUpdated();

                        string NewKey   = this.Key;
                        TreeNode Parent = this.Parent;

                        if (NewKey != OldKey && Parent != null)
                        {
                            Parent.RenameChild(OldKey, NewKey, this);
                        }
                    }

                    return(Task.CompletedTask);
                }, null);
            }
        }
Exemplo n.º 16
0
        public override void Run()
        {
            ReportExplorerPad r = this.Owner as ReportExplorerPad;

            if (r != null)
            {
                ParameterCollection par = r.ReportModel.ReportSettings.ParameterCollection;

                using (ParameterDialog e = new ParameterDialog(par)) {
                    e.ShowDialog();
                    if (e.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        foreach (BasicParameter bp in e.Collection as ParameterCollection)
                        {
                            r.ReportModel.ReportSettings.ParameterCollection.Add(bp);
                        }
                        r.RefreshParameters();
                    }
                }
            }
        }
Exemplo n.º 17
0
        private void RegisterWithRoom_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;

            this.MucClient.GetRoomRegistrationForm(this.roomId, this.domain, (sender2, e2) =>
            {
                MainWindow.MouseDefault();

                if (e2.Ok)
                {
                    if (e2.AlreadyRegistered)
                    {
                        if (this.nickName != e2.UserName)
                        {
                            string Prefix = this.MucClient.Client.BareJID + "." + this.roomId + "@" + this.domain;

                            this.nickName = e2.UserName;
                            RuntimeSettings.Set(Prefix + ".Nick", this.nickName);

                            this.EnterIfNotAlready(true);
                        }

                        MainWindow.MessageBox("You are already registered in the room with nick-name '" + e2.UserName + "'.",
                                              "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        MainWindow.UpdateGui(() =>
                        {
                            ParameterDialog Dialog = new ParameterDialog(e2.Form);
                            Dialog.ShowDialog();
                        });
                    }
                }
                else
                {
                    MainWindow.ErrorBox(string.IsNullOrEmpty(e2.ErrorText) ? "Unable to get room registration form." : e2.ErrorText);
                }
            }, null);
        }
Exemplo n.º 18
0
        public override void Run()
        {
            ReportExplorerPad pad = this.Owner as ReportExplorerPad;

            if (pad != null)
            {
                using (ParameterDialog paramDialog = new ParameterDialog(pad.ReportModel.ReportSettings.SqlParameters)) {
                    paramDialog.ShowDialog();
                    if (paramDialog.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        foreach (SqlParameter bp in paramDialog.SqlParameterCollection)
                        {
                            if (bp.ParameterName != null)
                            {
                                pad.ReportModel.ReportSettings.SqlParameters.Add(bp);
                            }
                        }
                        pad.RefreshParameters();
                    }
                }
            }
        }
Exemplo n.º 19
0
        public override void Add()
        {
            Mouse.OverrideCursor = Cursors.Wait;

            this.pubSubClient.GetDefaultNodeConfiguration((sender, e) =>
            {
                MainWindow.MouseDefault();

                if (e.Ok)
                {
                    int c          = e.Form.Fields.Length;
                    Field[] Fields = new Field[c + 1];
                    DataForm Form  = null;

                    Array.Copy(e.Form.Fields, 0, Fields, 1, c);
                    Fields[0] = new TextSingleField(null, "Node", "Node Name:", true, new string[] { string.Empty }, null, "Name of the node to create.",
                                                    StringDataType.Instance, null, string.Empty, false, false, false);

                    Form = new DataForm(this.pubSubClient.Client,
                                        (sender2, e2) =>
                    {
                        string NodeName = Form["Node"].ValueString;
                        string Title    = Form["pubsub#title"]?.ValueString ?? string.Empty;

                        if (!Enum.TryParse <NodeType>(Form["pubsub#node_type"]?.ValueString ?? string.Empty, out NodeType Type))
                        {
                            Type = NodeType.leaf;
                        }

                        Mouse.OverrideCursor = Cursors.Wait;

                        this.pubSubClient.CreateNode(NodeName, e.Form, (sender3, e3) =>
                        {
                            MainWindow.MouseDefault();

                            if (e3.Ok)
                            {
                                if (this.IsLoaded)
                                {
                                    PubSubNode Node = new PubSubNode(this, this.pubSubClient.ComponentAddress, NodeName, Title, Type);

                                    if (this.children is null)
                                    {
                                        this.children = new SortedDictionary <string, TreeNode>()
                                        {
                                            { Node.Key, Node }
                                        }
                                    }
                                    ;
                                    else
                                    {
                                        lock (this.children)
                                        {
                                            this.children[Node.Key] = Node;
                                        }
                                    }

                                    MainWindow.UpdateGui(() =>
                                    {
                                        this.Account?.View?.NodeAdded(this, Node);
                                        this.OnUpdated();
                                    });
                                }
                            }
                            else
                            {
                                MainWindow.ErrorBox("Unable to create node: " + e3.ErrorText);
                            }
                        }, null);
                    },
                                        (sender2, e2) =>
                    {
                        // Do nothing.
                    }, string.Empty, string.Empty, Fields);

                    ParameterDialog Dialog = new ParameterDialog(Form);

                    MainWindow.UpdateGui(() =>
                    {
                        Dialog.ShowDialog();
                    });
                }
                else
                {
                    MainWindow.ErrorBox("Unable to get default node properties: " + e.ErrorText);
                }
            }, null);
        }
Exemplo n.º 20
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     ParameterDialog dialog = new ParameterDialog();
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         this.listView1.Items.Add(this.method_0(dialog.method_1()));
     }
 }
Exemplo n.º 21
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (this.listView1.SelectedItems.Count != 0)
     {
         ListViewItem item = this.listView1.SelectedItems[0];
         ParameterDialog dialog = new ParameterDialog();
         dialog.method_2((XmlCmdParameter) item.Tag);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             this.method_1(item, dialog.method_1());
         }
     }
 }
Exemplo n.º 22
0
        public override void Edit()
        {
            Mouse.OverrideCursor = Cursors.Wait;

            this.Service.PubSubClient.GetItems(this.node, new string[] { this.itemId }, (sender, e) =>
            {
                MainWindow.MouseDefault();

                if (e.Ok)
                {
                    if (e.Items.Length == 1)
                    {
                        Networking.XMPP.PubSub.PubSubItem Item = e.Items[0];
                        DataForm Form          = null;
                        ParameterDialog Dialog = null;

                        Form = new DataForm(this.Service.PubSubClient.Client,
                                            (sender2, e2) =>
                        {
                            string Payload = Form["Payload"].ValueString;

                            try
                            {
                                XmlDocument Xml = new XmlDocument();
                                Xml.LoadXml(Payload);
                            }
                            catch (Exception ex)
                            {
                                Form["Payload"].Error = ex.Message;

                                MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() =>
                                {
                                    Dialog = new ParameterDialog(Form);
                                    Dialog.ShowDialog();
                                }));

                                return;
                            }

                            Mouse.OverrideCursor = Cursors.Wait;

                            this.Service.PubSubClient.Publish(this.node, this.itemId, Payload, (sender3, e3) =>
                            {
                                MainWindow.MouseDefault();

                                if (e3.Ok)
                                {
                                    this.Init(Payload);
                                    this.OnUpdated();
                                }
                                else
                                {
                                    MainWindow.ErrorBox("Unable to update item: " + e3.ErrorText);
                                }
                            }, null);
                        },
                                            (sender2, e2) =>
                        {
                            // Do nothing.
                        }, e.From, e.To,
                                            new JidSingleField(null, "Publisher", "Publisher:", false, new string[] { Item.Publisher }, null, "JID of publisher.",
                                                               null, null, string.Empty, false, true, false),
                                            new TextMultiField(null, "Payload", "XML:", false, new string[] { Item.Payload }, null, "XML payload of item.",
                                                               StringDataType.Instance, null, string.Empty, false, false, false));

                        Dialog = new ParameterDialog(Form);

                        MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() =>
                        {
                            Dialog.ShowDialog();
                        }));
                    }
                }
                else
                {
                    MainWindow.ErrorBox("Unable to get item from server: " + e.ErrorText);
                }
            }, null);
        }