Username change now dirty reactive in ui

This commit is contained in:
Patrick Hellebrand
2021-09-23 14:02:42 +02:00
committed by Felix Hartmann (PEA3-Fe-FI)
parent 7286b211bf
commit 43d8b2919c
3 changed files with 23 additions and 17 deletions

View File

@@ -1,17 +1,17 @@
using SocketIOSharp.Server.Client;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace PolyChat.Models
{
public class ChatPartner : INotifyPropertyChanged
public class ChatPartner
{
public string Name;
public string Code;
public ObservableCollection<ChatMessage> Messages;
private SocketIOSocket socketIOSocket;
public event PropertyChangedEventHandler PropertyChanged;
public ChatPartner(string name, string code, ObservableCollection<ChatMessage> messages = null)
{
@@ -23,20 +23,9 @@ namespace PolyChat.Models
public SocketIOSocket SocketIOSocket { get => socketIOSocket; set => socketIOSocket = value; }
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public void AddMessage(ChatMessage message)
{
Messages.Add(message);
}
public void SetName(string name)
{
Name = name;
NotifyPropertyChanged("Name");
}
}
}