Пример #1
0
 private async Task WaitDialog(string message, string title, string buttonText = "确定", Action afterHideCallback = null)
 {
     (Guid g, UIElement mg) = ShowDialog(guid => MessageGrid.Show(ChangeDialogResult, guid, message, title, buttonText));
     while (true)
     {
         lock (_dialogResult)
         {
             if (_dialogResult[g] != null)
             {
                 break;
             }
         }
         await Task.Delay(1);
     }
     CloseDialog(g, mg);
     afterHideCallback?.Invoke();
 }
Пример #2
0
        private async Task <bool> WaitDialog(string message, string title, string buttonConfirmText = "确定", string buttonCancelText = "取消", Action <bool> afterHideCallback = null)
        {
            (Guid g, UIElement mg) = ShowDialog(guid => MessageGrid.Show(ChangeDialogResult, guid, message, title, buttonConfirmText, buttonCancelText));
            while (true)
            {
                lock (_dialogResult)
                {
                    if (_dialogResult[g] != null)
                    {
                        break;
                    }
                }
                await Task.Delay(1);
            }
            var result = GetDialogResult(g) ?? false;

            CloseDialog(g, mg);
            afterHideCallback?.Invoke(result);
            return(result);
        }