private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { //Messenger.Default.Register<LogMessage>(this, (m) => //{ // var log = string.Format("{0} at {1: HHmmss}", m.Message, m.Timestamp); // MessageListView.Items.Add(log); //}); //Messenger.Default.Register<ConfirmMessage>(this, (m) => //{ // var isConfirm = m.Confirm(); // var log = string.Format("{0}, you agree that? {1}, at {2: HHmmss}", m.Message, isConfirm, m.Timestamp); // MessageListView.Items.Add(log); //}); Messenger.Default.Register<NotificationMessage<ConfirmMessage>>(this, (m) => { var isConfirm = m.Content.Confirm(); var confirmMessage = m.Content; //var log = string.Format("{0}, you agree that? {1}, at {2: HHmmss}", // confirmMessage.Message, isConfirm, confirmMessage.Timestamp); var vm = new LogMessageViewModel() { IsConfirm = isConfirm, NotificationMessage = m}; MessageListView.Items.Add(vm); }); }
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { //Messenger.Default.Register<LogMessage>(this, (m) => //{ // var log = string.Format("{0} at {1: HHmmss}", m.Message, m.Timestamp); // MessageListView.Items.Add(log); //}); //Messenger.Default.Register<ConfirmMessage>(this, (m) => //{ // var isConfirm = m.Confirm(); // var log = string.Format("{0}, you agree that? {1}, at {2: HHmmss}", m.Message, isConfirm, m.Timestamp); // MessageListView.Items.Add(log); //}); Messenger.Default.Register <NotificationMessage <ConfirmMessage> >(this, (m) => { var isConfirm = m.Content.Confirm(); var confirmMessage = m.Content; //var log = string.Format("{0}, you agree that? {1}, at {2: HHmmss}", // confirmMessage.Message, isConfirm, confirmMessage.Timestamp); var vm = new LogMessageViewModel() { IsConfirm = isConfirm, NotificationMessage = m }; MessageListView.Items.Add(vm); }); }