Here is the below code.In this code i want dispatcher to get timeout after 2 second but it is not working.Please help me out.
private void Button_Click(object sender, RoutedEventArgs e)
{
CancellationTokenSource tokenn = new CancellationTokenSource();
Application.Current.Dispatcher.Invoke(DispatcherPriority.Send,TimeSpan.FromSeconds(1), (Action)MyMethod2);
MessageBox.Show("Hello");
}
private void MyMethod2()
{
Uri uri = new Uri(@"D:\1.docx");
webBrowse.Navigate(uri);
}