private static Answer PerformDialogDisplay(IDialogService<Answer> service, string message, string caption, IEnumerable<Answer> possibleAnswers, StockUserErrorIcon icon) { if (service == null) { throw new ArgumentNullException("service"); } var viewModel = CreateViewModel(message, caption, possibleAnswers, icon); return service.ShowDialogFor(viewModel); }
private static IDialogViewModel<Answer> CreateViewModel( string message, string caption = null, IEnumerable<Answer> possibleAnswers = null, StockUserErrorIcon icon = StockUserErrorIcon.Notice ) { if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentException("Please provide a message", "message"); } var newCaption = caption ?? icon.ToString(); var answers = possibleAnswers ?? new[] {Answer.Ok}; return new DialogViewModel(message, answers) { Icon = icon, Caption = newCaption }; }