Beispiel #1
0
        public DispatcherSample()
        {
            InitializeComponent();

            var d = new DerivedObject();

            d.DoSomething();
        }
Beispiel #2
0
 private async void DispatcherButton_Click(object sender, RoutedEventArgs e)
 {
     var d = new DerivedObject();
     await Task.Run(async() =>
     {
         if (d.CheckAccess() == false)
         {
             await d.Dispatcher.InvokeAsync(() => d.DoSomething());
         }
     });
 }
Beispiel #3
0
        private async void NGButton_Click(object sender, RoutedEventArgs e)
        {
            var d = new DerivedObject();

            try
            {
                await Task.Run(() => d.DoSomething());
            }
            catch
            {
                MessageBox.Show("例外");
            }
        }
Beispiel #4
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            var d = new DerivedObject();

            d.DoSomething();
        }