Пример #1
0
        private async void ProvisioningClient_IsFriendQuestion(object Sender, IsFriendEventArgs e)
        {
            try
            {
                IsFriendQuestion Question = await Database.FindFirstDeleteRest <IsFriendQuestion>(new FilterAnd(
                                                                                                      new FilterFieldEqualTo("Key", e.Key), new FilterFieldEqualTo("JID", e.JID)));

                if (Question == null)
                {
                    Question = new IsFriendQuestion()
                    {
                        Created         = DateTime.Now,
                        Key             = e.Key,
                        JID             = e.JID,
                        RemoteJID       = e.RemoteJID,
                        ProvisioningJid = this.provisioningClient.ProvisioningServerAddress
                    };

                    await Database.Insert(Question);

                    await MainWindow.currentInstance.NewQuestion(Question);
                }
            }
            catch (Exception ex)
            {
                Log.Critical(ex);
            }
        }
Пример #2
0
        private async void ProvisioningClient_IsFriendQuestion(object Sender, IsFriendEventArgs e)
        {
            try
            {
                IsFriendQuestion Question = await Database.FindFirstDeleteRest <IsFriendQuestion>(new FilterAnd(
                                                                                                      new FilterFieldEqualTo("Key", e.Key), new FilterFieldEqualTo("JID", e.JID)));

                if (Question is null)
                {
                    Question = new IsFriendQuestion()
                    {
                        Created         = DateTime.Now,
                        Key             = e.Key,
                        JID             = e.JID,
                        RemoteJID       = e.RemoteJID,
                        OwnerJID        = XmppClient.GetBareJID(e.To),
                        ProvisioningJID = this.provisioningClient.ProvisioningServerAddress
                    };

                    await Database.Insert(Question);

                    DispatcherOperation Op = MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() =>
                                                                                                               MainWindow.currentInstance.NewQuestion(this.Account, this.provisioningClient, Question)));
                }
            }
            catch (Exception ex)
            {
                Log.Critical(ex);
            }
        }
Пример #3
0
        private async Task ProvisioningClient_IsFriendQuestion(object Sender, IsFriendEventArgs e)
        {
            IsFriendQuestion Question = await Database.FindFirstDeleteRest <IsFriendQuestion>(new FilterAnd(
                                                                                                  new FilterFieldEqualTo("Key", e.Key), new FilterFieldEqualTo("JID", e.JID)));

            if (Question is null)
            {
                Question = new IsFriendQuestion()
                {
                    Created         = DateTime.Now,
                    Key             = e.Key,
                    JID             = e.JID,
                    RemoteJID       = e.RemoteJID,
                    OwnerJID        = XmppClient.GetBareJID(e.To),
                    ProvisioningJID = this.provisioningClient.ProvisioningServerAddress
                };

                await Database.Insert(Question);

                MainWindow.UpdateGui(() =>
                                     MainWindow.currentInstance.NewQuestion(this.Account, this.provisioningClient, Question));
            }
        }