Created
October 31, 2010 18:30
-
-
Save vcsjones/656949 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using System.Windows; | |
using System.Windows.Threading; | |
namespace BorderTest | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
} | |
public delegate void MyDelegate(); | |
public void dispatchP1() | |
{ | |
player1.Dispatcher.VerifyAccess(); | |
player1.Dispatcher.Invoke(new MyDelegate(p1SetContent)); | |
} | |
public void p1SetContent() | |
{ | |
player1.Content = "WORKS!"; | |
} | |
private void Window_Loaded(object sender, RoutedEventArgs e) | |
{ | |
var thread = new Thread(() => new SecondMainWindow().dispatchP1()); | |
thread.SetApartmentState(ApartmentState.STA); | |
thread.Start(); | |
} | |
} | |
public class SecondMainWindow : MainWindow | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment