I am trying to handle events with Visual Studio C# like I did with my Windows Form, so for example:
On my Windows Phone 7 my code looks like this:
//ASDF.CS CLASS
public delegate void SignedOn(string Screenname);
public event SignedOn SO;
public void dataIncoming(string packet)
{
switch (packet)
{
case 0:
if (SO != null)
SO(m_Screenname);
break;
}
}
//MainWindow.xaml.cs
m_A.SignedOn += new ASDF.SignedOn(m_A_LoggedIn);
void m_OSC_LoggedIn(string Screenname, string FormattedSN, string Email)
{
//Works all the way to this sub then the code in here don't get ran because there is no invoke with WP7
MessageBox.Show("hello!");
}
My Windows Form Code that looks like this works:
//ASDF.CS CLASS
public delegate void SignedOn(string Screenname);
public event SignedOn SO;
public void dataIncoming(string packet)
{
switch (packet)
{
case 0:
if (SO != null)
SO(m_Screenname);
break;
}
}
//MainWindow.cs
m_A.SignedOn += new ASDF.SignedOn(m_A_LoggedIn);
void m_OSC_LoggedIn(string Screenname, string FormattedSN, string Email)
{
this.Invoke(new MethodInvoker(delegate
{
MessageBox.Show("hello!");
}));
}
So is there anyway I can get an alternative for invoke to work with Windows Phone 7?
Are there any other ways of getting this to work on WP7?
Thanks
Try using: