public static Session StartWaitDialog(this WaitDialogFactory factory, string waitCatption, WaitDialogProgressData initialProgress = null, TimeSpan delayToShow = default) { var instance = factory.CreateInstance(); var cancellationSource = new CancellationTokenSource(); var progress = new ProgressAdapter(instance, cancellationSource); var callback = new CancellationCallback(cancellationSource); instance.StartWaitDialogWithCallback(waitCatption, initialProgress?.WaitMessage, initialProgress?.ProgressText, initialProgress != null && initialProgress.IsCancelable, (int)delayToShow.TotalSeconds, true, initialProgress?.TotalSteps ?? 0, initialProgress?.CurrentStep ?? 0, callback); return(new Session(instance, progress, cancellationSource.Token, callback)); }
/// <summary> /// Creates the instance of an <see cref="IWaitDialog"/>. /// </summary> /// <param name="factory">The factory.</param> /// <returns>The instance of the <see cref="IWaitDialog"/></returns> public static IWaitDialog CreateInstance(this WaitDialogFactory factory) { Requires.NotNull(factory, nameof(factory)); factory.CreateInstance(out var dialog); return(dialog); }