Merge branch 'ConnectionController' of https://sourcecode.socialcoding.bosch.com/scm/~hpl2fe/polychat into ConnectionController
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
using SocketIOSharp.Server.Client;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace PolyChat.Models
|
||||
{
|
||||
public class ChatPartner
|
||||
public class ChatPartner : INotifyPropertyChanged
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -20,6 +23,11 @@ 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);
|
||||
@@ -28,6 +36,7 @@ namespace PolyChat.Models
|
||||
public void SetName(string name)
|
||||
{
|
||||
Name = name;
|
||||
NotifyPropertyChanged("Name");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user