예제 #1
0
 /// <summary>
 /// Shows a message dialog.
 /// </summary>
 /// <param name="dialogManager"> The extended <see cref="IDialogManager"/>. </param>
 /// <param name="messageModel"> The <see cref="MessageDialogModel"/> of the dialog. </param>
 /// <param name="buttons"> The <see cref="DialogButtons"/> to display. Default is <see cref="DialogButtons.Ok"/>. </param>
 /// <param name="displayLocation"> The <see cref="DialogDisplayLocation"/> of the dialog. Default is <see cref="DialogDisplayLocation.Window"/>. </param>
 /// <param name="displayBehavior"> The <see cref="DialogDisplayBehavior"/> of the dialog. Default is <see cref="DialogDisplayBehavior.Show"/>. </param>
 /// <param name="dialogOptions"> The <see cref="DialogOptions"/> of the dialog. Default is <see cref="DialogOptions.None"/>. </param>
 /// <param name="cancellationToken"> An external <see cref="CancellationToken"/> used to cancel the dialog. </param>
 /// <returns> An awaitable <see cref="DialogTask"/>. </returns>
 public static DialogTask ShowMessage
 (
     this IDialogManager dialogManager,
     MessageDialogModel messageModel,
     DialogButtons buttons = DialogButtons.Ok,
     DialogDisplayLocation displayLocation = DialogDisplayLocation.Window,
     DialogDisplayBehavior displayBehavior = DialogDisplayBehavior.Show,
     DialogOptions dialogOptions           = DialogOptions.None,
     CancellationToken cancellationToken   = default
 )
 => dialogManager.ShowMessage(new[] { messageModel }, buttons, displayLocation, displayBehavior, dialogOptions, cancellationToken);
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="messageModels"> The <see cref="MessageDialogModel"/>s that will be displayed. </param>
        public MessageDialogViewModel(ICollection <MessageDialogModel> messageModels)
        {
            // Save parameters.
            this.MessageModels = messageModels;

            // Initialize fields.
            this.SelectedMessageModel = messageModels.FirstOrDefault();

            //// TEST: Self closing
            //Task.Run(async () =>
            //{
            //	await Task.Delay(3000);
            //	//base.RequestClose?.Invoke(DialogResult.Killed);
            //	base.RequestClose?.Invoke(true);
            //});
        }