Subject: Problems with opening message window from background thread.
Heya guys, now i know this is not specifically about agsXMPP but i really need help with it.
im having trouble opening a new message window from the OnMessage callback.
heres the code blocks that im having issues with
The way my application is structured is that my base class is a class that extends ApplicationContext, mso when rosters/presence/messages come in there handled outside the regular mainform.
Whats happening is the form is being created but its freezing, witch in turn tells me that for some reason its being created by the BackgroundThread of agsXMPP.
Can anyone help me resolve this.
im having trouble opening a new message window from the OnMessage callback.
heres the code blocks that im having issues with
private delegate void OpenMessageWindowDelegate(Object Sender, agsXMPP.protocol.client.Message Message);
private void OpenMessageWindow(Object Sender, agsXMPP.protocol.client.Message Message)
{
MessageWindow MessageWindow;
RosterItem Roster = ContactManager[Message.From.Bare];
if (WindowManager.ContainsKey(Roster.Jid.Bare) == false)
{
MessageWindow = new MessageWindow(Roster);
MessageWindow.FormClosing += new FormClosingEventHandler(MessageWindow_FormClosing);
//Store it.
WindowManager.Add(Roster.Jid.Bare, MessageWindow);
}
MessageWindow = WindowManager[Roster.Jid.Bare];
MessageWindow.Show();
MessageWindow.Activate();
}
public void ClientConnection_OnMessage(Object Sender, agsXMPP.protocol.client.Message Message)
{
OpenMessageWindowDelegate OpenMessageWindowDelegate = new OpenMessageWindowDelegate(OpenMessageWindow);
OpenMessageWindowDelegate(Sender, Message);
}
private void OpenMessageWindow(Object Sender, agsXMPP.protocol.client.Message Message)
{
MessageWindow MessageWindow;
RosterItem Roster = ContactManager[Message.From.Bare];
if (WindowManager.ContainsKey(Roster.Jid.Bare) == false)
{
MessageWindow = new MessageWindow(Roster);
MessageWindow.FormClosing += new FormClosingEventHandler(MessageWindow_FormClosing);
//Store it.
WindowManager.Add(Roster.Jid.Bare, MessageWindow);
}
MessageWindow = WindowManager[Roster.Jid.Bare];
MessageWindow.Show();
MessageWindow.Activate();
}
public void ClientConnection_OnMessage(Object Sender, agsXMPP.protocol.client.Message Message)
{
OpenMessageWindowDelegate OpenMessageWindowDelegate = new OpenMessageWindowDelegate(OpenMessageWindow);
OpenMessageWindowDelegate(Sender, Message);
}
The way my application is structured is that my base class is a class that extends ApplicationContext, mso when rosters/presence/messages come in there handled outside the regular mainform.
Whats happening is the form is being created but its freezing, witch in turn tells me that for some reason its being created by the BackgroundThread of agsXMPP.
Can anyone help me resolve this.
robertpitt
Show profile
Link to this post
