Created
February 7, 2012 16:17
-
-
Save jacking75/1760498 to your computer and use it in GitHub Desktop.
[C#] WPF - 멀티 스레드에서 컨트롤 조작
This file contains 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
// from : MSDN | |
// 아래의 예는 리스트박스에 새로운 데이터를 추가하는 것이다. | |
private delegate void ListBoxDelegate(string arg); | |
void SetStateText(string state) | |
{ | |
this.listBox1.Dispatcher.BeginInvoke( | |
System.Windows.Threading.DispatcherPriority.Normal, | |
new ListBoxDelegate(UpdateListBox), state); | |
} | |
private void UpdateListBox(string state) | |
{ | |
this.listBox1.Items.Add(state); | |
} | |
// 메인 스레드가 아닌 곳에서는 SetStateText(string state)을 호출하여 리스트박스를 변경한다. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment