【发布时间】:2013-01-09 10:51:33
【问题描述】:
我正在尝试创建一个这样的弹出窗口
// Create a Popup
var Pop = new Popup() { IsOpen = true };
// Create a StackPanel for the Buttons
var SPanel = new StackPanel() { Background = MainGrid.Background };
// Set the comment
var TxtBlockComment = new TextBlock { Margin = new Thickness(20, 5, 20, 5), Text = Obj.Comment };
// Set the value
var TxtBoxValue = new TextBox { Name = "MeasureValue" };
TxtBoxValue.KeyUp += (sender, e) => { VerifyKeyUp(sender, Measure); };
// Create the button
var ButtonFill = new Button { Content = Loader.GetString("ButtonAccept"), Margin = new Thickness(20, 5, 20, 5), Style = (Style)App.Current.Resources["TextButtonStyle"] };
ButtonFill.Click += (sender, e) => { Obj.Value = TxtBoxValue.Text; };
// Add the items to the StackPanel
SPanel.Children.Add(TxtBlockComment);
SPanel.Children.Add(TxtBoxValue);
SPanel.Children.Add(ButtonFill);
// Set the child on the popup
Pop.Child = SPanel;
我想在ButtonFill.Click事件执行后通知主线程,这样我就可以继续那个线程了
但是我该怎么做呢?
【问题讨论】:
-
您可以尝试使用AutoResetEvent,msdn.microsoft.com/en-us/library/…
-
你的意思是 ButtonFill.Clicked 事件吗?
-
不清楚应该通知主线程的另一个线程在哪里。从您发布的代码看起来它是单线程的。
-
是的,我的意思是
ButtonFill.Click事件 ;) -
@Kimi 我的意思是如何在方法中通知
Click事件已被抛出?
标签: c# windows-runtime .net-4.5