コード例 #1
0
ファイル: MainActivity.cs プロジェクト: jaantohver/afloat_app
        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();
        }
コード例 #2
0
ファイル: MainView.cs プロジェクト: jaantohver/afloat_app
        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;
            };
        }