Esempio n. 1
0
 private void PubSubClient_ItemNotification(object Sender, ItemNotificationEventArgs e)
 {
     if (this.TryGetChild(e.NodeName, out TreeNode N) && N is PubSubNode Node)
     {
         Node.ItemNotification(e);
     }
 }
Esempio n. 2
0
        private Task PubSubClient_ItemNotification(object Sender, ItemNotificationEventArgs e)
        {
            if (this.TryGetChild(e.NodeName, out TreeNode N) && N is PubSubNode Node)
            {
                Node.ItemNotification(e);
            }

            return(Task.CompletedTask);
        }
Esempio n. 3
0
 internal void ItemRetracted(ItemNotificationEventArgs e)
 {
     if (this.TryGetChild(e.ItemId, out TreeNode N) && this.RemoveChild(N))
     {
         MainWindow.UpdateGui(() =>
         {
             Service?.Account?.View?.NodeRemoved(this, N);
             this.OnUpdated();
         });
     }
 }
Esempio n. 4
0
 private async Task PubSubClient_ItemRetracted(object Sender, ItemNotificationEventArgs e)
 {
     if (this.hasPubSubComponent && e.From.IndexOf('@') < 0)
     {
         ItemNotificationEventHandler h = this.NonPepItemRetraction;
         if (!(h is null))
         {
             await h(this, e);
         }
     }
 }
Esempio n. 5
0
 internal void ItemRetracted(ItemNotificationEventArgs e)
 {
     if (this.TryGetChild(e.ItemId, out TreeNode N) && this.RemoveChild(N))
     {
         MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() =>
         {
             Service?.Account?.View?.NodeRemoved(this, N);
             this.OnUpdated();
         }));
     }
 }
Esempio n. 6
0
 private void PubSubClient_ItemRetracted(object Sender, ItemNotificationEventArgs e)
 {
     if (this.hasPubSubComponent && e.From.IndexOf('@') < 0)
     {
         try
         {
             this.NonPepItemRetraction?.Invoke(this, e);
         }
         catch (Exception ex)
         {
             Log.Critical(ex);
         }
     }
 }
Esempio n. 7
0
        internal void ItemNotification(ItemNotificationEventArgs e)
        {
            if (this.IsLoaded)
            {
                if (this.TryGetChild(e.ItemId, out TreeNode N) && N is PubSubItem Item)
                {
                    Item.Init(e.Item.InnerXml);
                    Item.OnUpdated();
                }
                else
                {
                    Item = new PubSubItem(this, e.Publisher, e.NodeName, e.ItemId, e.Item.InnerText, e.Publisher);

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

                    MainWindow.UpdateGui(() =>
                    {
                        Service?.Account?.View?.NodeAdded(this, Item);
                        this.OnUpdated();
                    });
                }
            }
        }
Esempio n. 8
0
        private void PubSubClient_ItemNotification(object Sender, ItemNotificationEventArgs e)
        {
            if (this.hasPubSubComponent && e.From.IndexOf('@') < 0)
            {
                try
                {
                    this.NonPepItemNotification?.Invoke(this, e);
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }
            else
            {
                if (string.Compare(e.FromBareJID, this.client.BareJID, true) != 0)
                {
                    RosterItem Item = this.client[e.FromBareJID];
                    if (Item is null || (Item.State != SubscriptionState.Both && Item.State != SubscriptionState.To))
                    {
                        return;
                    }
                }

                IPersonalEvent PersonalEvent = null;

                foreach (XmlNode N in e.Item.ChildNodes)
                {
                    if (N is XmlElement E && personalEventTypes.TryGetValue(E.LocalName + " " + E.NamespaceURI, out IPersonalEvent PersonalEvent2))
                    {
                        PersonalEvent = PersonalEvent2.Parse(E);
                        break;
                    }
                }

                if (PersonalEvent != null)
                {
                    PersonalEventNotificationEventHandler[] Handlers;

                    lock (this.handlers)
                    {
                        if (!this.handlers.TryGetValue(PersonalEvent.GetType(), out Handlers))
                        {
                            return;
                        }
                    }

                    PersonalEventNotificationEventArgs e2 = new PersonalEventNotificationEventArgs(PersonalEvent, this, e);

                    foreach (PersonalEventNotificationEventHandler Handler in Handlers)
                    {
                        try
                        {
                            Handler.Invoke(this, e2);
                        }
                        catch (Exception ex)
                        {
                            Log.Critical(ex);
                        }
                    }
                }
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Event argument for personal event notification events.
 /// </summary>
 /// <param name="PersonalEvent">Personal event</param>
 /// <param name="PepClient">Personal Eventing Protocol (PEP) Client.</param>
 /// <param name="e">Message event arguments</param>
 public PersonalEventNotificationEventArgs(IPersonalEvent PersonalEvent, PepClient PepClient, ItemNotificationEventArgs e)
     : base(e)
 {
     this.personalEvent = PersonalEvent;
     this.pepClient     = PepClient;
 }
Esempio n. 10
0
 // Wird ausgelöst, wenn auf dem DAVID Server eine neue Terminanforderung eintrifft.
 void MyNotification_ItemNewEvent(object sender, ItemNotificationEventArgs e)
 {
     this.NewAppointmentMailEvent?.Invoke(this, e);
 }