public override async Task <bool> OnActionCallback() { this.IsEnabled = false; await base.OnActionCallback(); var item = this.Context as Inspector; var mailItem = item?.CurrentItem as MailItem; if (mailItem == null) { return(false); } var dialogWindow = new DialogForm(); DialogResult result = dialogWindow.ShowDialog(); if (result == DialogResult.OK) { IProgress <int> progress = new Progress <int>(ProgressUpdate); int maxNumber = 100; Int32.TryParse(dialogWindow.MaxNumber, out maxNumber); using (var mail = new OutlookMailItem(mailItem)) { await mail.ChangeEmailBodyWithEratosthenesSieveNumbers(maxNumber, progress); } } dialogWindow.Dispose(); this.IsEnabled = true; return(true); }
/// <summary> /// 关闭 /// </summary> private static void CloseAsyMessage() { //上传等待取消 if (dialogForm != null) { dialogForm.Close(); dialogForm.Dispose(); } }
private static string AskPlayerName() { string result = ""; DialogForm dialogForm = new DialogForm(); DialogResult res = dialogForm.ShowDialog(); if (res == DialogResult.OK) { result = dialogForm.Text; } dialogForm.Dispose(); if (String.IsNullOrEmpty(result)) { result = "unknown player"; } return(result); }