public MainWindow() { InitializeComponent(); clientCallback = new ChatClientCallback(); instanceContext = new InstanceContext(clientCallback); m_Client = new WPFChat.Client.ChatServer.ChatServerClient(instanceContext); clientCallback.ReceivedMessage += new EventHandler<WPFChat.Library.GenericEventArgs<KeyValuePair<string, string>>>(clientCallback_ReceivedMessage); clientCallback.ReceivedUserList += new EventHandler<WPFChat.Library.GenericEventArgs<ClientInfo[]>>(clientCallback_ReceivedUserList); clientCallback.ReceivedBroadcastMessage += new EventHandler<GenericEventArgs<KeyValuePair<string, string>>>(clientCallback_ReceivedBroadcastMessage); this.Title = "Not logged in"; #region Populate avatar combo try { Avatar[] serverAvatars = m_Client.GetAvatars(); foreach (Avatar avatar in serverAvatars) { cmbAvatars.Items.Add( Utils.GetImageFromAvatar(avatar) ); } } catch (Exception ex) { //todo: log error } #endregion //create dummy chat control //CreateChatControl("test"); CreateMainChatWindow(); }
public ChatClient(UIAgent agent, ChatClientCallback onDisconnectCallback) { ui = agent; this.onDisconnectCallback = onDisconnectCallback; }