/// <summary>
        /// Sends a message.
        /// </summary>
        /// <param name='message'>
        /// A string of text to send.
        /// </param>
        private void SendMessage(Java.Lang.String message)
        {
            // Check that we're actually connected before trying anything
            if (chatService.GetState() != BluetoothChatService.STATE_CONNECTED)
            {
                Toast.MakeText(this, Resource.String.not_connected, ToastLength.Short).Show();
                return;
            }

            // Check that there's actually something to send
            if (message.Length() > 0)
            {
                // Get the message bytes and tell the BluetoothChatService to write
                byte[] send = message.GetBytes();
                chatService.Write(send);

                // Reset out string buffer to zero and clear the edit text field
                outStringBuffer.SetLength(0);
                outEditText.Text = string.Empty;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sends a message. </summary>
        /// <param name="message">  A string of text to send. </param>
        private void SendMessage(string message)
        {
            // Check that we're actually connected before trying anything
            if (mChatService.State != BluetoothChatService.STATE_CONNECTED)
            {
                Toast.MakeText(this, R.Strings.not_connected, Toast.LENGTH_SHORT).Show();
                return;
            }

            // Check that there's actually something to send
            if (message.Length > 0)
            {
                // Get the message bytes and tell the BluetoothChatService to write
                sbyte[] send = message.JavaGetBytes();
                mChatService.Write(send);

                // Reset out string buffer to zero and clear the edit text field
                mOutStringBuffer.Length = 0;
                mOutEditText.SetText(mOutStringBuffer);
            }
        }