private async void btn_onSendClicked(object sender, EventArgs e) { if (ChatEntry.Text.Equals("") || !IsReady) { return; } SendButton.IsEnabled = false; await ChatHub.Invoke("Chat", ChatEntry.Text); ChatEntry.Text = string.Empty; SendButton.IsEnabled = true; }
private async void btn_onGetOutClicked(object sender, EventArgs e) { IGetOut = true; OutRoom.IsEnabled = false; try { await ChatHub.Invoke("Chat", ""); } catch { } //Wait for get Message "GetOut", then Stop Connect the HubConnect. //If, HubConnect.Stop() in line 130, Will be crash, because the asyncho, (stop Hub, still...) if (HubConnect.State == ConnectionState.Connected) { HubConnect.Stop(); } }