Mega Code Archive
Cross Thread Exception Raising
//File:Window.xaml.cs
using System;
using System.Threading;
using System.Windows;
using System.Windows.Threading;
namespace WpfApplication1
{
public partial class SecondaryUiThreadWindow : Window
{
public SecondaryUiThreadWindow()
{
InitializeComponent();
this.Title = Thread.CurrentThread.ManagedThreadId+"";
}
void r(object sender, RoutedEventArgs e)
{
throw new Exception(Dispatcher.CurrentDispatcher.Thread.ManagedThreadId+"");
}
void SecondaryUiThreadWindow_Closed(object sender, EventArgs e)
{
Dispatcher.CurrentDispatcher.InvokeShutdown();
}
}
}