Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1 ------------ Universal apps --------
- private async void but1_Click(object sender, RoutedEventArgs e)
- {
- ProgressUpdateTop.Visibility = Visibility.Visible;
- await getMethod("all");
- ProgressUpdateTop.Visibility = Visibility.Collapsed;
- }
- private async Task getMethod(string p)
- {
- string test = p + "!!";
- await Task.Delay(5000);
- test += p;
- MessageDialog msgbox = new MessageDialog("Message Box is displayed");
- await msgbox.ShowAsync();
- }
- //2 ------------ WPF desktop apps --------
- private async void but1_Click(object sender, RoutedEventArgs e)
- {
- ProgressUpdateTop.Visibility = Visibility.Visible;
- await getMethod("all");
- ProgressUpdateTop.Visibility = Visibility.Collapsed;
- }
- private async Task getMethod(string p)
- {
- string test = p + "!!";
- await Task.Delay(5000);
- test += p;
- MessageBox.Show("Message Box is displayed");
- await Task.Run(async () =>
- {
- Thread.Sleep(5000);
- //await this.Dispatcher.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => getMethod("all"));
- });
- MessageBox.Show("Message Box is displayed2");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement