Exemple #1
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         chatService.Disconnect();
     }
     catch (Exception exc)
     {
         MessageBoxUtils.ShowException(exc);
     }
 }
Exemple #2
0
 private async Task InitializeChatService()
 {
     try
     {
         chatService.OnMessageReceived += AppendMessage;
         chatService.OnStatusReceived  += UpdateStatus;
         await chatService.Connect(userName);
     }
     catch (Exception exc)
     {
         MessageBoxUtils.ShowException(exc);
     }
 }
Exemple #3
0
        private async Task SendMessage()
        {
            if (!string.IsNullOrEmpty(tbMessage.Text))
            {
                try
                {
                    await chatService.SendMessage(userName, tbMessage.Text);

                    tbMessage.Text = string.Empty;
                    tbMessage.Focus();
                }
                catch (Exception exc)
                {
                    MessageBoxUtils.ShowException(exc);
                }
            }
        }
Exemple #4
0
 private async void MainForm_Shown(object sender, EventArgs e)
 {
     try
     {
         if (GetUserName())
         {
             await InitializeChatService();
         }
         else
         {
             Close();
         }
     }
     catch (Exception exc)
     {
         MessageBoxUtils.ShowException(exc);
     }
 }
Exemple #5
0
 private static void UnhandledExceptionHandler(Exception exception)
 {
     MessageBoxUtils.ShowException(exception);
 }