Ejemplo n.º 1
0
        private async void BillingHandler_OnProductPurchased(int response, Purchase purchase, string purchaseData, string purchaseSignature)
        {
            var result = await RegisterPurchase(pendingBuyIntent);

            if (result)
            {
                _serviceConnection.BillingHandler.ConsumePurchase(purchase);
            }

            HomeActivity homeActivity = (HomeActivity)Activity;

            homeActivity.OnSectionAttached(HomeActivity.HOME_MENU_INDEX, true);

            progressDialog.Cancel();
        }
Ejemplo n.º 2
0
        private void Btn_home_arm_Click(object sender, EventArgs e)
        {
            HomeActivity homeActivity = (HomeActivity)Activity;

            homeActivity.OnSectionAttached(HomeActivity.PLANT_MENU_INDEX);
        }
 public MyDialogClickListener(HomeActivity activity)
 {
     homeActivity = activity;
 }
        private async void LoadUserTraps()
        {
            try
            {
                List <ArmedTrapApiResult> response = await TrapApiService.ListArmed();

                if (response != null && response.Count > 0)
                {
                    var boundsBuilders = new LatLngBounds.Builder();

                    foreach (var trapPlanted in response)
                    {
                        var idIcon = 0;

                        if (trapPlanted.NameKey == ETrap.BEAR.ToString())
                        {
                            idIcon = MyTrap.Droid.Resource.Drawable.trap_bear_trap_selected_icon;
                        }
                        else if (trapPlanted.NameKey == ETrap.MINE.ToString())
                        {
                            idIcon = MyTrap.Droid.Resource.Drawable.trap_mine_trap_selected_icon;
                        }
                        else if (trapPlanted.NameKey == ETrap.PIT.ToString())
                        {
                            idIcon = MyTrap.Droid.Resource.Drawable.trap_pit_trap_selected_icon;
                        }
                        else if (trapPlanted.NameKey == ETrap.DOGS.ToString())
                        {
                            idIcon = MyTrap.Droid.Resource.Drawable.trap_dogs_trap_selected_icon;
                        }
                        //else if (trapPlanted.NameKey == ETrap.LOOP.ToString())
                        else
                        {
                            //idIcon = MyTrap.Droid.Resource.Drawable.trap_loop_trap_icon;
                            continue;
                        }

                        var position = new LatLng(trapPlanted.Latitude, trapPlanted.Longitude);

                        googleMap.AddMarker(new MarkerOptions()
                                            .SetPosition(position)
                                            .SetTitle(trapPlanted.Date.ToLocalTime().ToString(Resources.GetString(MyTrap.Droid.Resource.String.format_date_hour_minute)))
                                            .SetIcon(BitmapDescriptorFactory.FromResource(idIcon))
                                            );

                        int fillColor = Int32.Parse("80f15f4b", System.Globalization.NumberStyles.HexNumber);

                        CircleOptions circleOptions = new CircleOptions();

                        circleOptions.InvokeCenter(position);
                        circleOptions.InvokeFillColor(fillColor);
                        circleOptions.InvokeStrokeWidth(3);

                        googleMap.AddCircle(circleOptions);

                        boundsBuilders.Include(new LatLng(trapPlanted.Latitude, trapPlanted.Longitude));
                    }

                    if (response.Count > 1)
                    {
                        var bounds = boundsBuilders.Build();

                        googleMap.MoveCamera(CameraUpdateFactory.NewLatLngBounds(bounds, 100));
                    }
                    else
                    {
                        googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(response[0].Latitude, response[0].Longitude), 16));
                    }
                }
                else
                {
                    HomeActivity homeActivity = (HomeActivity)Activity;

                    new AlertDialog.Builder(Activity)
                    .SetIcon(Android.Resource.Drawable.IcDialogAlert)
                    .SetTitle(MyTrap.Droid.Resource.String.alert_title_error)
                    .SetMessage(MyTrap.Droid.Resource.String.no_traps_armed)
                    .SetPositiveButton(MyTrap.Droid.Resource.String.ok, new MyDialogClickListener(homeActivity))
                    .SetCancelable(false)
                    .Show();
                }

                progressDialog.Cancel();
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
Ejemplo n.º 5
0
 public MyDialogClickListener(PlantFragment fragment, HomeActivity activity)
 {
     armFragment  = fragment;
     homeActivity = activity;
 }