Eigene Nachrichten werden nicht als neu angezeigt.

Beim Senden einer Nachricht wird die Kontaktliste aktualisiert.
This commit is contained in:
LynJet
2022-05-30 20:48:14 +02:00
parent 7d25cac6ca
commit 04d06d4e3b
6 changed files with 16 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Media; using System.Windows.Media;
using ChatController.Core;
using ChatController.LoginKlassen; using ChatController.LoginKlassen;
using ChatController.Utilities; using ChatController.Utilities;
using Brush = System.Windows.Media.Brush; using Brush = System.Windows.Media.Brush;
@@ -46,8 +47,13 @@ namespace ChatController.ChatKlassen
set set
{ {
_HasUnreadMessages = value; _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; _Color = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
} }

View File

@@ -641,6 +641,8 @@ namespace ChatController
Chat.SendMessage(Chatbox.Text, CurrentContact.GroupId); Chat.SendMessage(Chatbox.Text, CurrentContact.GroupId);
Chatbox.Text = string.Empty; Chatbox.Text = string.Empty;
DoSynchro();
} }
} }
@@ -824,7 +826,7 @@ namespace ChatController
} }
} }
//Clientlist.Items.Refresh(); Clientlist.Items.Refresh();
OnPropertyChanged(nameof(ChatMessages)); OnPropertyChanged(nameof(ChatMessages));
OnPropertyChanged(nameof(ContactList)); OnPropertyChanged(nameof(ContactList));
}); });

View File

@@ -6,6 +6,8 @@ namespace ChatController.Core
{ {
public class OwnChatCache public class OwnChatCache
{ {
public long? LoggedOnUserId { get; set; }
private static readonly object _Lock = new object(); private static readonly object _Lock = new object();
// Key-> "group-127" oder "user-938" // Key-> "group-127" oder "user-938"

View File

@@ -3,7 +3,6 @@ using Newtonsoft.Json;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Web; using System.Web;
using System.Windows; using System.Windows;
using ChatController.Core;
using ChatController.Data; using ChatController.Data;
using ChatController.LoginKlassen; using ChatController.LoginKlassen;
using ChatController.Utilities; using ChatController.Utilities;
@@ -431,6 +432,8 @@ namespace ChatController.HauptKlassen
_LoggedInUser = connectionData; _LoggedInUser = connectionData;
OwnChatCache.GetInstance().LoggedOnUserId = _LoggedInUser.Response.User.Oid;
callback?.Invoke(true); callback?.Invoke(true);
} }
else else