Exemple #1
0
 private async void SendMessageButton_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!_client.IsConnected)
         {
             throw new InvalidOperationException("client not connected");
         }
         if (string.IsNullOrEmpty(_viewModel.InputText))
         {
             throw new NullReferenceException("Input must have a value");
         }
         IsEnabled = false;
         await _client.SendMessage(_viewModel.InputText);
     }
     catch (Exception ex)
     {
         MessageBox.Show(this.GetParentWindowRecurs(), ex.Message);
     }
     finally
     {
         IsEnabled = true;
     }
 }