public override void HandleMessage(Client.Core.Models.Notification notification) { if (!String.IsNullOrEmpty(notification.PayloadType)) { Debug.WriteLine("----"); Debug.WriteLine(notification.PayloadType); Debug.WriteLine(notification.Payload); Debug.WriteLine("----"); switch (notification.PayloadType) { case "StateChangeNotification": var stateChange = JsonConvert.DeserializeObject <StateChangeNotification>(notification.Payload); var titleCasedId = $"{stateChange.NewState.Id.Substring(0, 1).ToUpper()}{stateChange.NewState.Id.Substring(1)}"; Instance.Status = new EntityHeader <DeploymentInstanceStates>() { Id = stateChange.NewState.Id, Text = stateChange.NewState.Text }; RaisePropertyChanged(nameof(MonitorInstanceViewModel.Instance)); EnableActions(); break; default: break; } } AddMessage(notification); }
private void AddMessage(DateTime dateStamp, string message) { var notification = new Client.Core.Models.Notification() { Text = message, DateStamp = dateStamp.ToJSONString() }; AddMessage(notification); }
private void AddMessage(Client.Core.Models.Notification notification) { if (!String.IsNullOrEmpty(notification.Text)) { DispatcherServices.Invoke(() => { MessagesFromServer.Insert(0, notification); if (MessagesFromServer.Count > 100) { MessagesFromServer.RemoveAt(100); } }); } }