public UserMessageViewModel(string message, NotifyUserMessageEventArgs e) { Message = message; var png = ResourceManager.GetContentByteArray(string.Format("/Resources/{0}.png", e.Icon)); Icon = StfsPackageExtensions.GetBitmapFromByteArray(png); CommandParameter = new UserMessageCommandParameter(this, e.Command, e.CommandParameter); Flags = e.Flags; }
private void ExecuteOpenUserMessageCommand(UserMessageCommandParameter p) { var message = p.ViewModel; message.IsRead = true; message.IsChecked = true; NotifyPropertyChanged(UNREADMESSAGECOUNT); switch (p.Command) { case MessageCommand.OpenUrl: if (Web.Browse((string)p.Parameter)) { if (message.Flags.HasFlag(MessageFlags.IgnoreAfterOpen)) _userSettings.IgnoreMessage(message.Message); } break; case MessageCommand.OpenDialog: var dialogType = (Type) p.Parameter; var c = dialogType.GetConstructor(new[] {typeof (IWorkHandler)}); var d = c.Invoke(new object[] { WorkHandler }) as Window; if (d.ShowDialog() == true) _userSettings.IgnoreMessage(message.Message); break; } }