diff --git a/ChatController/ChatKlassen/Contact.cs b/ChatController/ChatKlassen/Contact.cs index 3a0346b..b4995a0 100644 --- a/ChatController/ChatKlassen/Contact.cs +++ b/ChatController/ChatKlassen/Contact.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Windows.Media; +using ChatController.Core; using ChatController.LoginKlassen; using ChatController.Utilities; using Brush = System.Windows.Media.Brush; @@ -46,8 +47,13 @@ namespace ChatController.ChatKlassen set { _HasUnreadMessages = value; - - if (_HasUnreadMessages) + + var userId = OwnChatCache.GetInstance().LoggedOnUserId; + var rmUserId = ReceivedMessage?.UserId; + + var isOwnMessage = rmUserId.HasValue && rmUserId.Value.Equals(userId); + + if (_HasUnreadMessages && !isOwnMessage) { _Color = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush; } diff --git a/ChatController/ChatMainControl.xaml.cs b/ChatController/ChatMainControl.xaml.cs index a358aa4..4276c6a 100644 --- a/ChatController/ChatMainControl.xaml.cs +++ b/ChatController/ChatMainControl.xaml.cs @@ -641,6 +641,8 @@ namespace ChatController Chat.SendMessage(Chatbox.Text, CurrentContact.GroupId); Chatbox.Text = string.Empty; + + DoSynchro(); } } @@ -824,7 +826,7 @@ namespace ChatController } } - //Clientlist.Items.Refresh(); + Clientlist.Items.Refresh(); OnPropertyChanged(nameof(ChatMessages)); OnPropertyChanged(nameof(ContactList)); }); diff --git a/ChatController/Core/OwnChatCache.cs b/ChatController/Core/OwnChatCache.cs index 1428052..4bccde0 100644 --- a/ChatController/Core/OwnChatCache.cs +++ b/ChatController/Core/OwnChatCache.cs @@ -6,6 +6,8 @@ namespace ChatController.Core { public class OwnChatCache { + public long? LoggedOnUserId { get; set; } + private static readonly object _Lock = new object(); // Key-> "group-127" oder "user-938" diff --git a/ChatController/HauptKlassen/Chat.cs b/ChatController/HauptKlassen/Chat.cs index d7c26be..d852898 100644 --- a/ChatController/HauptKlassen/Chat.cs +++ b/ChatController/HauptKlassen/Chat.cs @@ -3,7 +3,6 @@ using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; diff --git a/ChatController/HauptKlassen/Login.cs b/ChatController/HauptKlassen/Login.cs index 1d3d890..e19baa9 100644 --- a/ChatController/HauptKlassen/Login.cs +++ b/ChatController/HauptKlassen/Login.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Net; using System.Web; using System.Windows; +using ChatController.Core; using ChatController.Data; using ChatController.LoginKlassen; using ChatController.Utilities; @@ -431,6 +432,8 @@ namespace ChatController.HauptKlassen _LoggedInUser = connectionData; + OwnChatCache.GetInstance().LoggedOnUserId = _LoggedInUser.Response.User.Oid; + callback?.Invoke(true); } else diff --git a/PrototypChat/.vs/PrototypChat/v16/.suo b/PrototypChat/.vs/PrototypChat/v16/.suo index 98f684b..bf8b321 100644 Binary files a/PrototypChat/.vs/PrototypChat/v16/.suo and b/PrototypChat/.vs/PrototypChat/v16/.suo differ