public ChatWindow(SimpleChat simpleChat, PeerUser peerUserObject) { if (simpleChat == null) { throw new ArgumentNullException("simpleChat"); } if (peerUserObject == null) { throw new ArgumentNullException("peerUserObject"); } InitializeComponent(); this.chatClient = ChannelFactory<ISimpleChatService>.CreateChannel( new WSHttpBinding(), peerUserObject.Address); this.simpleChatOwner = simpleChat; this.peerUser = peerUserObject; string chatWith = null; if (!string.IsNullOrEmpty(peerUserObject.UserName)) { chatWith = this.peerUser.UserName; } else { chatWith = this.peerUser.Address.Uri.Host; } Text = string.Format( CultureInfo.CurrentCulture, Resources.ChattingWithMessage, simpleChat.UserName, chatWith); Owner = simpleChat; StartPosition = FormStartPosition.CenterParent; Show(); chatText.Focus(); }
public ChatService(SimpleChat simpleChat) { this.simpleChat = simpleChat; }