public ChatViewModel() { selectedString = ""; socket = SocketAPI.GetInstance().GetSocket(); SendCommand = new DelegateCommand(SendMessege); ChangeWindowCommand = new DelegateCommand(ChangeWindow); ItemSelectedCommand = new DelegateCommand <ChatModel>(HandleSelectedItem); listChatModel = new ListChatModel(); // Some sample instances listChatModel.Add(new ChatModel() { Name = "Name 1", Content = "Test content 1" }); listChatModel.Add(new ChatModel() { Name = "Name 2", Content = "Test content 2" }); listChatModel.Add(new ChatModel() { Name = "Name 3", Content = "Test content 3" }); listChatModel.Add(new ChatModel() { Name = "Name 4", Content = "Test content 4" }); listChatModel.Add(new ChatModel() { Name = "Name 5", Content = "Test content 5" }); RecieveMessege(); }
public static SocketAPI GetInstance() { if (instance == null) { instance = new SocketAPI(); } return(instance); }
public ChatMessegeModel() { currMessege = new MessegeModel(); list = new List <MessegeModel>(); socket = SocketAPI.GetInstance().GetSocket(); socket.On("dotnet_new_message", (message) => { list.Add((MessegeModel)message); }); }
public ChatModel() { Name = ""; Content = ""; socket = SocketAPI.GetInstance().GetSocket(); }
public MainWindow() { InitializeComponent(); socket = SocketAPI.GetInstance().GetSocket(); //DataContext = new ChatViewModel(); }