所以即时通讯使用运动api和通过事件句柄更新的应用程序。问题是我有麻烦让消息框显示,我不明白为什么。以下基本代码:使用Windows Phone 8:消息框已停止工作?
public MainPage()
{
InitializeComponent();
MessageBox.Show("welcome"); //box not showing
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
motion = new Motion();
motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(20);
motion.CurrentValueChanged +=
new EventHandler<SensorReadingEventArgs<MotionReading>> (motion_CurrentValueChanged);
motion.Start();
}
void motion_CurrentValueChanged(object sender, SensorReadingEventArgs<MotionReading> e)
{
Dispatcher.BeginInvoke(() => CurrentValueChanged(e.SensorReading));
}
private void CurrentValueChanged(MotionReading e)
{
Thickness mar = characterMain.Margin;
txtblck1.Text = "Yaw " + e.Attitude.Yaw.ToString() + " Pitch " + e.Attitude.Pitch + " Roll " + e.Attitude.Roll;
mar.Left = hor + (e.Attitude.Roll * 200);
mar.Top = vert + (e.Attitude.Pitch * 200);
characterMain.Margin = mar;
bool col = engine1.CDetection_V1(characterMain.Margin.Left, characterMain.Margin.Top, characterMain.Width, characterMain.Height, BadGuy.Margin.Left, BadGuy.Margin.Top, BadGuy.Width, BadGuy.Height);
if (col == true)
{
MessageBox.Show("hit");//this doesnt
num.Text = "hit"; //this works
}
}
你能检查这个例子http://sdrv.ms/1c0rRXI吗? – Romasz
添加到我的代码和测试,但仍然没有运气,谢谢反正队友 –
正如你已经运行的例子(没有修改它) - 有MessageBox工作? – Romasz