//kill the activity and start setup activity, disconnect MQTT client public void Kill() { //killsignal, remove me from list Thread PublishMQTT = new Thread(() => MQTTPublish("killme")); PublishMQTT.Start(); //start setupactivity SampleActivity activitysetup = new SampleActivity(1, 2, typeof(MainActivity)); activitysetup.Start(this); if (truckbool == true) { Toast.MakeText(this, "Truck stopped. Finisher will not receive updates. ", ToastLength.Long).Show(); } else { Toast.MakeText(this, "Finisher stopped.", ToastLength.Long).Show(); } try { Client.Disconnect(); } catch { } //stop this activity this.FinishActivity(1); }
//confirm settings and pass to ownVehicle activity when startbutton is pressed public void confirmSettings() { Button startButton = FindViewById <Button>(Resource.Id.startButton); startButton.Click += delegate { //EditText broker = FindViewById<EditText>(Resource.Id.editTextbroker); //string brokerstring = broker.Text; EditText name = FindViewById <EditText>(Resource.Id.editTextname); string namestring = name.Text; //EditText username = FindViewById<EditText>(Resource.Id.editTextusername); //string usernamestring = username.Text; //EditText pass = FindViewById<EditText>(Resource.Id.editTextpassword); //string passtring = username.Text; RadioButton truckfin = FindViewById <RadioButton>(Resource.Id.radiotruck); string truck; if (truckfin.Checked == true) { truck = "true"; } else { truck = "false"; } //create ownvehicle activity SampleActivity activityfin = new SampleActivity(1, 2, typeof(OwnVehicle)); //create var to give activity extra parameters var ownvec = new Intent(this, typeof(OwnVehicle)); //ownvec.PutExtra("broker",brokerstring ); ownvec.PutExtra("name", namestring); //ownvec.PutExtra("username",usernamestring ); //ownvec.PutExtra("pass",passtring ); ownvec.PutExtra("truck", truck); ownvec.PutExtra("loadpermeter", floatloadpermeter.ToString("0.00")); //start ownvehicle activity StartActivity(ownvec); }; }