Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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;
            };
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
                });
            }
        }
Exemplo n.º 5
0
 void EndRead(object sender, EventArgs e)
 {
     BtReceiver.EndRead();
 }
Exemplo n.º 6
0
 void OnButtonClick(object sender, EventArgs e)
 {
     BtReceiver.StartRead();
 }