コード例 #1
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            BluetoothHolder.bluetoothManage.Read();
            if (DatabaseHolder.CODE() == "OK")
            {
                Toast.MakeText(this.Activity, "Received: " + DatabaseHolder.receiver, ToastLength.Long).Show();

                UploadingDatabase();

                UsersViewAdapter adapter = new UsersViewAdapter(this.Activity, users);
                usersList.Adapter = adapter;
            }
            alertDialogAndroid.Dismiss();
        }
コード例 #2
0
 private void DoorClosedBtnOK_Click(object sender, EventArgs e)
 {
     BluetoothHolder.bluetoothManage.Read();
     if (DatabaseHolder.CODE() == "OK")
     {
     }
     else if (DatabaseHolder.CODE() == "ER")
     {
         Toast.MakeText(this.Activity, "Error while closing door!", ToastLength.Long).Show();
     }
     else
     {
         Toast.MakeText(this.Activity, "Unknown error!", ToastLength.Long).Show();
     }
     alertDialogAndroid.Dismiss();
 }
コード例 #3
0
        private void AccBtn_Click1(object sender, EventArgs e)
        {
            BluetoothHolder.bluetoothManage.Read();
            OKBtn.Enabled  = true;
            AccBtn.Enabled = false;

            if (DatabaseHolder.CODE() == "OK")
            {
            }
            else if (DatabaseHolder.CODE() == "ER")
            {
                Toast.MakeText(this.Activity, "There was an error while uploading a database!", ToastLength.Long).Show();
            }
            else
            {
                Toast.MakeText(this.Activity, "UNKNOWN ERROR - RECEIVED MSG:'" + DatabaseHolder.receiver + "'", ToastLength.Long).Show();
            }
            alertDialogAndroid.Dismiss();
        }
コード例 #4
0
 private void UploadingUsersList()
 {
     BluetoothHolder.bluetoothManage.Read();
     if (DatabaseHolder.CODE() == null)
     {
         Toast.MakeText(this.Activity, "Error, received message has wrong format!", ToastLength.Long).Show();
     }
     else if (DatabaseHolder.CODE() == "OK")
     {
         if (UploadingDatabase())
         {
             UsersViewAdapter adapter = new UsersViewAdapter(this.Activity, users);
             usersList.Adapter = adapter;
         }
     }
     else if (DatabaseHolder.CODE() == "ER")
     {
         Toast.MakeText(this.Activity, "Error while uploading a database!", ToastLength.Long).Show();
     }
 }
コード例 #5
0
        private void AccBtn_Click2(object sender, EventArgs e, AdapterView.ItemClickEventArgs p)
        {
            BluetoothHolder.bluetoothManage.Read();
            OKBtn.Enabled  = true;
            AccBtn.Enabled = false;

            if (DatabaseHolder.CODE() == "OK")
            {
                Toast.MakeText(this.Activity, "Received: " + DatabaseHolder.receiver, ToastLength.Long).Show();

                char[] ar = new char[2];
                ar = DatabaseHolder.IntToCharArr(users[p.Position].Id);
                DatabaseHolder.receiver = "";
                BluetoothHolder.bluetoothManage.Write(DatabaseHolder.CHNCD + ar[0] + ar[1] + '\a');
            }
            else if (DatabaseHolder.CODE() == "ER")
            {
                Toast.MakeText(this.Activity, "There was an error while uploading a database!", ToastLength.Long).Show();
            }
            else
            {
                Toast.MakeText(this.Activity, "UNKNOWN ERROR - RECEIVED MSG:'" + DatabaseHolder.receiver + "'", ToastLength.Long).Show();
            }
        }