コード例 #1
0
        /// <summary>
        /// Creates and displays the indefinite loading progress bar, while running the workMethod asynchronously.
        /// Only returns when the work task is finished, and does not lock down UI thread.
        /// </summary>
        public static void VoidBuilder(
            Action workMethod,
            string title)
        {
            LoadingDialog dialog = new LoadingDialog();

            dialog.SetTitle(title);

            //Execute the work asynchronously
            Task.Run(() =>
            {
                workMethod();
                //Dispatch call to appropriate UI Thread to close the modal dialog and resume execution
                dialog.updater.CloseDialog();
            });

            //Display window as a Modal Dialog
            //Execution pauses on this call until the dialog is closed
            dialog.ShowDialog();
        }
コード例 #2
0
 public void SetTitle(string title) => dialog.Dispatcher.InvokeAsync(() => dialog.SetTitle(title));