Example #1
0
        private void Send()
        {
            if (proxy != null && chatTxtBoxType.Text != "")
            {
                if (proxy.State == CommunicationState.Faulted)
                {
                    HandleProxy();
                }
                else
                {
                    //Create message, assign its properties
                    SVC.Message msg = new WPFClient.SVC.Message();
                    msg.Sender = this.localClient.Name;
                    msg.Content = chatTxtBoxType.Text.ToString();

                    //If whisper mode is checked and an item is
                    //selected in the list box of clients, it will
                    //arrange a client object called receiver
                    //to whisper
                    if ((bool)chatCheckBoxWhisper.IsChecked)
                    {
                        if (this.receiver != null)
                        {
                            proxy.WhisperAsync(msg, this.receiver);
                            chatTxtBoxType.Text = "";
                            chatTxtBoxType.Focus();
                        }
                    }

                    else
                    {
                        proxy.SayAsync(msg);
                        chatTxtBoxType.Text = "";
                        chatTxtBoxType.Focus();
                    }
                    //Tell the service to tell back all clients that this client
                    //has just finished typing..
                    proxy.IsWritingAsync(null);
                }
            }
        }
Example #2
0
 private void chatButtonSend_Click(object sender, RoutedEventArgs e)
 {
     SVC.Message msg = new WPFClient.SVC.Message();
     msg.Sender = this.localClient.Name;
     msg.Content = chatTxtBoxWriteMsg.Text.ToString();
 }