I am using Matrix xmppClient to set up a chat client app on WP7.. On giving wrong credentials (username/password), Invalid Cross thread access exception is been thrown...I am using Dipatcher.BeginInvoke as shown below but still that exception is coming.. can anybody tel me what need to be done to fix this?? Thanks
void xmppClient_OnAuthError(object sender, SaslEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
DisplayEvent("OnAuthError", "authentication failed");
});
}
void DisplayEvent(string evt, string arg1 = null, string arg2 = null)
{
var par = new Paragraph();
par.Inlines.Add(new Run
{
Text = evt,
FontSize = 14,
});
if (arg1 != null)
par.Inlines.Add(new Run
{
Text = "\t=>" + arg1,
FontSize = 14,
});
if (arg2 != null)
par.Inlines.Add(new Run
{
Text = "\t=> " + arg2,
FontSize = 14,
});
var rtf = new RichTextBox();
rtf.Blocks.Add(par);
stackEvents.Children.Add(rtf);
ScrollToEnd(scrollEvents);
}
Not getting any exception in DisplayEvent method