Esempio n. 1
0
        /// <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 (connectionService.GetState() != OBDConnectionService.STATE_CONNECTED)
            {
                Toast.MakeText(Application.Context, 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 BluetoothConnectionService to write
                byte[] send = message.GetBytes();
                connectionService.Write(send);
            }
        }
Esempio n. 2
0
/// <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);
            }
        }
        private void SendMessage(Java.Lang.String message)
        {
            if (chatService.GetState() != BluetoothChatService.STATE_CONNECTED)
            {
                Toast.MakeText(this, Resource.String.not_connected, ToastLength.Short).Show();
                return;
            }
            else if (message.Length() > 0)
            {
                // Send message
                byte[] msg = message.GetBytes();
                chatService.Write(msg);
                // Send EOT character
                byte[] END_MSG = new Java.Lang.String("~").GetBytes();
                chatService.Write(END_MSG);

                outStringBuffer.SetLength(0);
                outEditText.Text = string.Empty;
            }
        }
Esempio n. 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_poisearch);
            // ��ʼ������ģ�飬ע�������¼�����
            mPoiSearch = PoiSearch.NewInstance();
            mPoiSearch.SetOnGetPoiSearchResultListener(this);
            mSuggestionSearch = SuggestionSearch.NewInstance();
            mSuggestionSearch.SetOnGetSuggestionResultListener(this);
            keyWorldsView = FindViewById<AutoCompleteTextView>(Resource.Id.searchkey);
            sugAdapter = new ArrayAdapter<string>(this,
                    Android.Resource.Layout.SimpleDropDownItem1Line);
            keyWorldsView.Adapter = sugAdapter;
            mBaiduMap = (Android.Runtime.Extensions.JavaCast<SupportMapFragment>(SupportFragmentManager
                    .FindFragmentById(Resource.Id.map))).BaiduMap;

            /**
             * ������ؼ��ֱ仯ʱ����̬���½����б�
             */
            keyWorldsView.AfterTextChanged += (sender, e) => { };
            keyWorldsView.BeforeTextChanged += (sender, e) => { };
            keyWorldsView.TextChanged += (sender, e) =>
            {
                ICharSequence cs = new String(e.Text.ToString());
                if (cs.Length() <= 0)
                {
                    return;
                }
                string city = (FindViewById<EditText>(Resource.Id.city)).Text;
                /**
                 * ʹ�ý������������ȡ�����б�������onSuggestionResult()�и���
                 */
                mSuggestionSearch
                        .RequestSuggestion((new SuggestionSearchOption())
                                .Keyword(cs.ToString()).City(city));
            };
        }