public async Task <SubmitResultType> Submit() { ProgressIndicator progress = new ProgressIndicator { IsVisible = true, IsIndeterminate = true, Text = AppResources.PostsPage_Submitting }; PhoneApplicationPage page = (App.Current.RootVisual as PhoneApplicationFrame).Content as PhoneApplicationPage; SystemTray.SetOpacity(page, 1); SystemTray.SetIsVisible(page, true); SystemTray.SetProgressIndicator(page, progress); SubmitResultType result = await SubmitInternal(_thread.Number); if (result == SubmitResultType.Success) { progress.Text = AppResources.PostsPage_PostSuccess; Task ignore = Task.Delay(1000).ContinueWith(task => { SystemTray.SetProgressIndicator(page, null); SystemTray.SetIsVisible(page, false); }, TaskScheduler.FromCurrentSynchronizationContext()); } else { SystemTray.SetProgressIndicator(page, null); SystemTray.SetIsVisible(page, false); } return(result); }
public async Task Submit() { SubmitResultType result = await SubmitInternal(_threadID); switch (result) { case SubmitResultType.EmptyCaptchaError: case SubmitResultType.WrongCatpchaError: ElementFocused(this, NewThreadFocusResult.Captcha); break; case SubmitResultType.EmptyCommentError: ElementFocused(this, NewThreadFocusResult.Comment); break; case SubmitResultType.NoImageError: ElementFocused(this, NewThreadFocusResult.Page); break; case SubmitResultType.Success: case SubmitResultType.KnownError: case SubmitResultType.UnknownError: default: break; } }
protected async Task <SubmitResultType> SubmitInternal(ulong threadID) { IsPosting = true; SubmitResultType result = await SubmitInternalAsync(threadID); IsPosting = false; return(result); }