protected override void OnResume() { base.OnResume(); contentView.StartReadButton.Click += OnButtonClick; contentView.EndReadButton.Click += EndRead; contentView.LedOnButton.Click += delegate { new Thread(() => { BtReceiver.LedOn(); }).Start(); }; contentView.LedOffButton.Click += delegate { new Thread(() => { BtReceiver.LedOff(); }).Start(); }; contentView.ResetButton.Click += delegate { new Thread(() => { BtReceiver.Reset(); }).Start(); }; BtClient.Scanning += OnScanning; BtClient.Found += OnDeviceFound; BtClient.NotFound += OnDeviceNotFound; BtClient.Connecting += OnConencting; BtClient.Connected += OnConnected; BtClient.Disconnecting += OnDisconnecting; BtClient.Disconnected += OnDisconnected; BtClient.Init(); contentView.Map.OnResume(); }
public void OnMapReady(GoogleMap googleMap) { this.googleMap = googleMap; MarkerOptions opts = new MarkerOptions(); opts.SetPosition(new LatLng(58.3793627, 26.7114551)); opts.SetTitle("58.3793627, 26.7114551"); opts.SetSnippet("No fish"); m = googleMap.AddMarker(opts); m.ShowInfoWindow(); googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(58.3793627, 26.7114551), 18.5f)); googleMap.MarkerClick += (sender, e) => { if (infoVisible) { e.Marker.HideInfoWindow(); } else { e.Marker.ShowInfoWindow(); } infoVisible = !infoVisible; }; googleMap.InfoWindowClick += (sender, e) => { if (ledOn) { new Thread(() => { BtReceiver.LedOff(); }).Start(); } else { new Thread(() => { BtReceiver.LedOn(); }).Start(); } ledOn = !ledOn; }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(contentView = new MainView(this)); IntentFilter filter = new IntentFilter(); filter.AddAction(BluetoothDevice.ActionAclConnected); filter.AddAction(BluetoothDevice.ActionAclDisconnectRequested); filter.AddAction(BluetoothDevice.ActionAclDisconnected); RegisterReceiver(new BtReceiver(), filter); contentView.Map.OnCreate(savedInstanceState); Timer t = new Timer(delegate { BtReceiver.StartRead(); }, null, 5000, int.MaxValue); }
public void Vibrate() { Vibrator mVibrator = (Vibrator)GetSystemService(Context.VibratorService); // Vibrate for 300 milliseconds mVibrator.Vibrate(500); if (a == null || !a.IsShowing) { AlertDialog.Builder b = new AlertDialog.Builder(this, AlertDialog.ThemeDeviceDefaultLight); b.SetTitle("Fish caught!"); b.SetNeutralButton("Nice", delegate { BtReceiver.Reset(); }); RunOnUiThread(delegate { a = b.Show(); }); } }
void EndRead(object sender, EventArgs e) { BtReceiver.EndRead(); }
void OnButtonClick(object sender, EventArgs e) { BtReceiver.StartRead(); }