public ChatWindowControl(TextBox sendMessageField, Label chatBoxLabel, TextBox chatBoxField, Button sendMessageButton, string username) { this.sendMessageButton = sendMessageButton; this.chatBoxField = chatBoxField; this.chatBoxLabel = chatBoxLabel; this.sendMessageField = sendMessageField; this.sendMessageButton.Click += sendMessageButton_Click; this.sendMessageField.KeyDown += sendMessageField_KeyDown; logic = new Logic(username); }
public Lobby(string username, RegistrationWindow sender) { InitializeComponent(); chatWindowControl = new ChatWindowControl(sendMessageField, chatBoxLabel, chatBoxField, sendMessageButton, username); MessagingClient.MessageReceived += MessagingClient_MessageReceived; this.username = username; this.sender = sender; BackgroundWorker getUserWorker = new BackgroundWorker(); getUserWorker.DoWork += getUserWorker_DoWork; getUserWorker.RunWorkerCompleted += getUserWorker_RunWorkerCompleted; getUserWorker.RunWorkerAsync(); timer_Tick(null, null); _logic = new Logic(username); InitDataTable(); }