Benachrichtigungen werden nicht mehr angezeigt, wenn der Versender der angemeldete Benutzer ist

This commit is contained in:
Lyndon Jetten
2020-09-25 14:55:40 +02:00
parent fdc262d1ee
commit 96e12f68a6

View File

@@ -249,7 +249,7 @@ namespace ChatController
notifyIcon.BalloonTipClosed += (sender, args) =>
{
// TODO: wird beim ausblenden bzw. automatischem Schließen des "Balloons" ausgelöst
//DisposeAndRemoveNotification((NotifyIcon)sender, pGroupId);
DisposeAndRemoveNotification((NotifyIcon)sender, pGroupId);
};
_Group2NotifyIcons.AddOrUpdateValueInDictionary(pGroupId, notifyIcon);
@@ -277,7 +277,6 @@ namespace ChatController
pNotification.Dispose();
_Group2NotifyIcons.Remove(pGroupId);
Application.DoEvents();
}
@@ -732,6 +731,11 @@ namespace ChatController
{
foreach (var newContact in contacts)
{
if(newContact == null)
{
continue;
}
if (contact.GroupId == newContact.GroupId)
{
// ReceivedMessage kann null sein!
@@ -741,9 +745,15 @@ namespace ChatController
contact.TimeStamp = newContact.TimeStamp;
var selectedContact = (Contact) Clientlist.SelectedItem;
// Angemeldeter Benutzer
var userOid = _Chat.ChatDaten.LoggedInUser.Response.User.Oid;
if (selectedContact != null && !selectedContact.GroupId.Equals(newContact.GroupId) || selectedContact == null || _IsInBackground && userOid != contact?.ReceivedMessage?.UserId)
var senderId = contact.ReceivedMessage?.UserId;
var receiverId = userOid;
var receiverGroupId = newContact.GroupId;
var selectedGroupId = selectedContact?.GroupId;
if(senderId != receiverId && (_IsInBackground || receiverGroupId != selectedGroupId))
{
ContainingWindow.Icon = Utils.GetImageSourceFromIcon(Resource.oC_favico_NewMessage);
ShowNotification(newContact.Name, newContact.ReceivedMessage, newContact.GroupId);