예제 #1
0
        private async void Button_Click_3(object sender, RoutedEventArgs e)
        {
            wResult.Text         = "";
            Wfin.Visibility      = Visibility.Collapsed;
            rectangle.Visibility = System.Windows.Visibility.Visible;
            tokenSource          = new CancellationTokenSource();
            try
            {
                LongRun lr = new LongRun();
                long    i  = await lr.CountAsync4(token);

                wResult.Text = i.ToString();
            }catch (TaskCanceledException)
            {
                MessageBox.Show("Canceled");
            }
            catch (OperationCanceledException)
            {
                MessageBox.Show("canceled");
            }
            finally
            {
                tokenSource.Dispose();
                rectangle.Visibility = System.Windows.Visibility.Visible;
                Wfin.Visibility      = Visibility.Visible;
            }
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            wResult.Text    = "";
            Wfin.Visibility = Visibility.Collapsed;

            rectangle.Visibility = System.Windows.Visibility.Visible;
            LongRun lr = new LongRun();

            wResult.Text         = lr.count().ToString();
            rectangle.Visibility = System.Windows.Visibility.Collapsed;
            Wfin.Visibility      = Visibility.Visible;
        }
예제 #3
0
        private async void Button_Click_2(object sender, RoutedEventArgs e)
        {
            wResult.Text    = "";
            Wfin.Visibility = Visibility.Collapsed;

            rectangle.Visibility = System.Windows.Visibility.Visible;
            LongRun lr = new LongRun();
            long    i  = await lr.CountAsync3();

            wResult.Text         = i.ToString();
            rectangle.Visibility = System.Windows.Visibility.Collapsed;

            Wfin.Visibility = Visibility.Visible;
        }