protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var data = Intent.GetStringExtra("data");

            appPreferences = new AppPreferences(Application.Context);
            var item = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);

            viewModel = new FacilityDetailViewModel(item);

            Bundle mybundle = new Bundle();

            mybundle.PutString("data", Newtonsoft.Json.JsonConvert.SerializeObject(item));

            adapter = new TabsAdapter(this, SupportFragmentManager, mybundle);
            pager   = FindViewById <ViewPager>(Resource.Id.viewpager);
            var tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            pager.Adapter = adapter;
            tabs.SetupWithViewPager(pager);
            pager.OffscreenPageLimit = 3;

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Submit":
                    FacilityInformationFragment fragment = (FacilityInformationFragment)SupportFragmentManager.Fragments[1];
                    if (fragment != null)
                    {
                        fragment.SubmitFacility();
                    }
                    break;

                case "Add":
                    var buildingIntent = new Intent(this, typeof(AddBuildingActivity));;
                    StartActivity(buildingIntent);
                    break;
                }
            };

            pager.PageSelected += (sender, args) =>
            {
                var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible;

                fragment?.BecameVisible();
            };

            SupportActionBar.Title = item.Name;
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
        }
        private async void SignIn_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            MessageDialog  messageDialog = new MessageDialog();
            AppPreferences ap            = new AppPreferences(Application.Context);

            messageDialog.ShowLoading();

            EncryptionHelper encryptionHelper = new EncryptionHelper();

            message.Text = "";
            var user = new User()
            {
                Username = username.Text,
                Password = password.Text,
            };

            //if (ap.IsOnline(Application.Context))
            //{
            user = await ViewModel.ExecuteLoginCommand(user);

            // this.SqlLiteManager.CreateDatabase();
            //await this.SqlLiteManager.InsertUpdateUser(this.SqlLiteManager.MapUserToLocalUser(user));
            //}
            //else {
            //   var locaUser = await SqlLiteManager.GetUser(this.SqlLiteManager.MapUserToLocalUser(user));
            //    if (locaUser != null)
            //        user = SqlLiteManager.MapLocalUserToUser(locaUser);
            //    else {
            //        user = new User()
            //        {
            //            RespondMessage = "Invaild username or password.",
            //        };
            //    }
            //}


            if (user.RespondMessage != null)
            {
                message.Text = user.RespondMessage;
            }
            else
            {
                var newIntent = new Intent(this, typeof(MainActivity));
                newIntent.AddFlags(ActivityFlags.ClearTop);
                newIntent.AddFlags(ActivityFlags.SingleTop);
                ap.SaveUserId(user.Id.ToString());

                StartActivity(newIntent);

                Finish();
            }

            messageDialog.HideLoading();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ViewModel = new FacilitiesViewModel();
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_facility_picture);
            secondFacilityPhoto = FindViewById <ImageView>(Resource.Id.facility_secondphoto_imageview);
            facilityPhoto       = FindViewById <ImageView>(Resource.Id.facility_photo_imageview);
            appPreferences      = new AppPreferences(Application.Context);

            takeaphotoButton      = FindViewById <Button>(Resource.Id.img_takeaphoto);
            selectPictureButton   = FindViewById <Button>(Resource.Id.img_selectpicture);
            selectSecondImgButton = FindViewById <Button>(Resource.Id.secondimg_selectpicture);
            takeaSecondImgButton  = FindViewById <Button>(Resource.Id.secondimg_takeaphoto);

            selectPictureButton.Click   += SelectAPicture;
            takeaphotoButton.Click      += TakeAPicture;
            selectSecondImgButton.Click += SelectASecondPicture;
            takeaSecondImgButton.Click  += TakeASecondPicture;

            _dir    = CreateDirectoryForPictures();
            Toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            if (Toolbar != null)
            {
                SetSupportActionBar(Toolbar);
                SupportActionBar.Title = "Facility Pictures";
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);
            }
            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Save":
                    SaveFacility();
                    break;
                }
            };
            var data = Intent.GetStringExtra("data");

            facility = new Facility();
            if (data != null)
            {
                facility   = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);
                imageNames = facility.IDPicture == null ? new List <string>() : facility.IDPicture.Split(',').ToList();
                if (imageNames.Count > 0)
                {
                    GetImages(appPreferences);
                }
            }
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            appPreferences = new AppPreferences(Application.Context);
            userId         = Convert.ToInt32(appPreferences.GetUserId());
            fullname       = FindViewById <EditText>(Resource.Id.etf_fullname);
            designation    = FindViewById <EditText>(Resource.Id.etf_designation);
            mobileNumber   = FindViewById <EditText>(Resource.Id.etf_mobileNumber);
            emailaddress   = FindViewById <EditText>(Resource.Id.etf_emailaddress);
            ViewModel      = new PersonViewModel();
            Person         = new Person();
            var data = Intent.GetStringExtra("data");

            if (data != null)
            {
                Facility = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);
                Person   = Facility.ResposiblePerson;
                if (Person != null)
                {
                    fullname.Text     = Person.FullName;
                    designation.Text  = Person.Designation;
                    mobileNumber.Text = Person.PhoneNumber;
                    emailaddress.Text = Person.EmailAddress;
                }
            }

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Save":
                    SavePerson();
                    break;
                }
            };

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
        }
Пример #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            appPreferences   = new AppPreferences(Application.Context);
            userId           = Convert.ToInt32(appPreferences.GetUserId());
            erfNumber        = FindViewById <EditText>(Resource.Id.etf_erfnumber);
            titleDeedNumber  = FindViewById <EditText>(Resource.Id.etf_titledeednumber);
            extentm2         = FindViewById <EditText>(Resource.Id.etf_extentm2);
            ownerInformation = FindViewById <EditText>(Resource.Id.etf_ownerinformation);
            ViewModel        = new DeedInforViewModel();
            DeedsInfo        = new DeedsInfo();
            var data = Intent.GetStringExtra("data");

            if (data != null)
            {
                Facility  = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);
                DeedsInfo = Facility.DeedsInfo;
                if (DeedsInfo != null)
                {
                    erfNumber.Text        = DeedsInfo.ErFNumber;
                    titleDeedNumber.Text  = DeedsInfo.TitleDeedNumber;
                    extentm2.Text         = DeedsInfo.Extent;
                    ownerInformation.Text = DeedsInfo.OwnerInfomation;
                }
            }

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Save":
                    SaveDeedInfor();
                    break;
                }
            };
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            viewModel      = new FacilitiesViewModel();
            helpers        = new UIHelpers();
            appPreferences = new AppPreferences(Application.Context);
            settlementtype = FindViewById <Spinner>(Resource.Id.sf_settlementtype);
            zoning         = FindViewById <Spinner>(Resource.Id.sf_zoning);

            var data = Intent.GetStringExtra("data");

            if (data != null)
            {
                facility = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);
                if (!String.IsNullOrEmpty(facility.SettlementType))
                {
                    settlementtype.SetSelection(helpers.GetSpinnerIndex(settlementtype, facility.SettlementType));
                }
                if (!String.IsNullOrEmpty(facility.Zoning))
                {
                    zoning.SetSelection(helpers.GetSpinnerIndex(zoning, facility.Zoning));
                }
            }

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Save":
                    SaveFacility();
                    break;
                }
            };

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            ViewModel = new BuildingsViewModel();

            AppPreferences ap = new AppPreferences(Application.Context);

            facilityId = Convert.ToInt32(ap.GetFacilityId());
            var data = Intent.GetStringExtra("data");

            informationButton        = FindViewById <Button>(Resource.Id.information_button);
            informationButton.Touch += (sender, e) =>
            {
                var intent = new Intent(this, typeof(FacilityInformationActivity));
                StartActivity(intent);
            };

            recyclerView = FindViewById <RecyclerView>(Resource.Id.buildingRecyclerView);
            addButton    = FindViewById <FloatingActionButton>(Resource.Id.addnewBuilding_button);

            recyclerView.HasFixedSize       = true;
            recyclerView.SetAdapter(adapter = new BrowseBuildingsAdapter(this, ViewModel));

            refresher = FindViewById <SwipeRefreshLayout>(Resource.Id.buildingRefresher);
            refresher.SetColorSchemeColors(Resource.Color.accent);
            addButton.Click += AddButton_Click;
            addButton.SetBackgroundColor(Android.Graphics.Color.Tan);

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var intent = new Intent(this, typeof(LoginActivity));
                ap.SaveUserId("0");
                StartActivity(intent);
            };

            if (data != null)
            {
                facility = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);
                SupportActionBar.Title = facility.Name;
            }

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
        }
Пример #8
0
        private async void SignIn_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            MessageDialog messageDialog = new MessageDialog();

            messageDialog.ShowLoading();

            EncryptionHelper encryptionHelper = new EncryptionHelper();

            message.Text = "";
            var user = new User()
            {
                Username = username.Text,
                Password = password.Text,
            };

            if (appPreferences.IsOnline(Application.Context))
            {
                user = await ViewModel.ExecuteLoginCommand(user);

                if (user.RespondMessage != null)
                {
                    message.Text = user.RespondMessage;
                }
                else
                {
                    var newIntent = new Intent(this, typeof(MainActivity));
                    newIntent.AddFlags(ActivityFlags.ClearTop);
                    newIntent.AddFlags(ActivityFlags.SingleTop);
                    appPreferences.SaveUserId(user.Id.ToString());

                    StartActivity(newIntent);

                    Finish();
                }
            }

            messageDialog.HideLoading();
        }
Пример #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Context        mContext = Android.App.Application.Context;
            AppPreferences ap       = new AppPreferences(mContext);
            string         userId   = ap.GetUserId();

            if (Convert.ToInt32(userId) == 0)
            {
                var newIntent = new Intent(this, typeof(LoginActivity));
                StartActivity(newIntent);
            }

            adapter = new TabsAdapter(this, SupportFragmentManager);
            pager   = FindViewById <ViewPager>(Resource.Id.viewpager);
            var tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            pager.Adapter = adapter;
            tabs.SetupWithViewPager(pager);
            pager.OffscreenPageLimit = 3;

            pager.PageSelected += (sender, args) =>
            {
                var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible;

                fragment?.BecameVisible();
            };

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var    intent  = new Intent(this, typeof(LoginActivity));
                string _userId = "0";
                ap.SaveUserId(_userId);
                StartActivity(intent);
            };

            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);
        }
Пример #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Context        mContext = Android.App.Application.Context;
            AppPreferences ap       = new AppPreferences(mContext);
            string         userId   = ap.GetUserId();

            if (Convert.ToInt32(userId) == 0)
            {
                var newIntent = new Intent(this, typeof(LoginActivity));
                StartActivity(newIntent);
            }

            adapter        = new TabsAdapter(this, SupportFragmentManager);
            pager          = FindViewById <ViewPager>(Resource.Id.viewpager);
            searchBar      = FindViewById <TextInputLayout>(Resource.Id.search_textInputLayout);
            searchEditText = FindViewById <TextInputEditText>(Resource.Id.searchedTxt);
            var tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            pager.Adapter = adapter;
            tabs.SetupWithViewPager(pager);
            pager.OffscreenPageLimit = 3;

            searchBar.Visibility = ViewStates.Gone;
            pager.PageSelected  += (sender, args) =>
            {
                var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible;

                fragment?.BecameVisible();
            };
            searchEditText.Click += (sender, eventArgs) =>
            {
                searchBar.Visibility = ViewStates.Gone;
                Toolbar.Visibility   = ViewStates.Visible;
                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(searchEditText.WindowToken, 0);
            };

            searchEditText.TextChanged += (sender, eventArgs) => {
                if (searchEditText.Text.Trim().Length > 1)
                {
                    FacilityFragment fragment = (FacilityFragment)SupportFragmentManager.Fragments[0];
                    if (fragment != null)
                    {
                        fragment.SearchFacilities(searchEditText.Text.Trim());
                    }
                }
            };

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;

                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var    intent  = new Intent(this, typeof(LoginActivity));
                    string _userId = "0";
                    ap.SaveUserId(_userId);
                    StartActivity(intent);
                    break;

                case "Search":
                    searchBar.Visibility = ViewStates.Visible;
                    Toolbar.Visibility   = ViewStates.Gone;
                    break;
                }
            };

            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);
        }
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            building       = new Building();
            ViewModel      = new BuildingsViewModel();
            appPreferences = new AppPreferences(Application.Context);
            facilityId     = Convert.ToInt32(appPreferences.GetFacilityId());
            userId         = Convert.ToInt32(appPreferences.GetUserId());
            helpers        = new UIHelpers();
            var data = Intent.GetStringExtra("data");

            occupationYear        = FindViewById <EditText>(Resource.Id.etb_occupationyear);
            occupationyearLayout  = FindViewById <TextInputLayout>(Resource.Id.occupationyear_layout);
            gpscAddLocationButton = FindViewById <ImageView>(Resource.Id.gpscaddlocation_button);
            tvblatLang            = FindViewById <TextView>(Resource.Id.tvf_latLang);
            buildingPhoto         = FindViewById <ImageView>(Resource.Id.imgb_buildingphoto);
            _GPSCoordinates       = new GPSCoordinate();
            buildingName          = FindViewById <EditText>(Resource.Id.etb_name);
            buildingType          = FindViewById <Spinner>(Resource.Id.sf_buildingtype);
            buildingstandard      = FindViewById <Spinner>(Resource.Id.sf_buildingstandard);
            utilisationStatus     = FindViewById <EditText>(Resource.Id.etb_utilisationstatus);
            nooOfFoors            = FindViewById <EditText>(Resource.Id.etb_nooffloors);
            totalFootprintAream2  = FindViewById <EditText>(Resource.Id.etb_totalfootprintaream2);
            totalImprovedaAeam2   = FindViewById <EditText>(Resource.Id.etb_totalimprovedaream2);
            heritage                = FindViewById <Switch>(Resource.Id.sf_heritage);
            disabledAccesss         = FindViewById <Spinner>(Resource.Id.sf_disabledaccesss);
            disabledComment         = FindViewById <EditText>(Resource.Id.etb_disabledcomment);
            constructionDescription = FindViewById <EditText>(Resource.Id.etb_constructiondescription);
            accuracyMessage         = FindViewById <TextView>(Resource.Id.accuracy_message);
            refashAccuracy          = FindViewById <ImageView>(Resource.Id.refreshaccuracy_button);
            refashAccuracy.Click   += RefashAccuracy_Click;

            _dir = appPreferences.CreateDirectoryForPictures();

            if (data != null)
            {
                building = Newtonsoft.Json.JsonConvert.DeserializeObject <Building>(data);
                isEdit   = true;
                SupportActionBar.Title = "Edit Building";
                occupationYear.Text    = building.OccupationYear;
                if (building.GPSCoordinates != null)
                {
                    tvblatLang.Text = "Lat: " + building.GPSCoordinates.Latitude + " Long: " + building.GPSCoordinates.Longitude;
                    _GPSCoordinates = building.GPSCoordinates;
                }
                buildingName.Text = building.BuildingName;
                buildingType.SetSelection(helpers.GetSpinnerIndex(buildingType, building.BuildingType));
                buildingstandard.SetSelection(helpers.GetSpinnerIndex(buildingstandard, building.BuildingStandard));
                disabledAccesss.SetSelection(helpers.GetSpinnerIndex(disabledAccesss, building.DisabledAccess));
                utilisationStatus.Text       = building.Status;
                nooOfFoors.Text              = Convert.ToString(building.NumberOfFloors);
                totalFootprintAream2.Text    = Convert.ToString(building.FootPrintArea);
                totalImprovedaAeam2.Text     = Convert.ToString(building.ImprovedArea);
                heritage.Checked             = building.Heritage;
                disabledComment.Text         = building.DisabledComment;
                constructionDescription.Text = building.ConstructionDescription;

                Bitmap bit = SetImageBitmap(_dir + "/" + building.Photo);
                if (bit != null)
                {
                    buildingPhoto.SetImageBitmap(bit);
                }
                else if (bit == null && !String.IsNullOrEmpty(building.Photo))
                {
                    PictureViewModel pictureViewModel = new PictureViewModel();
                    Models.Picture   picture          = await pictureViewModel.ExecuteGetPictureCommand(building.Photo);

                    if (picture != null)
                    {
                        var _bit = appPreferences.StringToBitMap(picture.File);
                        if (_bit != null)
                        {
                            SaveImage(_bit, building.Photo);
                        }
                        buildingPhoto.SetImageBitmap(_bit);
                    }
                }
            }
            else
            {
                SupportActionBar.Title = "Add New Building";
            }
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            gpscAddLocationButton.Click += AddLocation_Click;
            buildingPhoto.Click         += (sender, e) => { ShowImage_Click(); };

            GPSTracker GPSTracker = new GPSTracker();

            Android.Locations.Location location = GPSTracker.GPSCoordinate();
            if (location != null)
            {
                accuracyMessage.Text = String.Format("Accurate to {0} Meters", location.Accuracy.ToString());
            }

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Save":
                    SaveBuilding();
                    break;
                }
            };
        }
Пример #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            streetAddress         = FindViewById <EditText>(Resource.Id.etf_streetAddress);
            suburb                = FindViewById <EditText>(Resource.Id.etf_suburb);
            region                = FindViewById <EditText>(Resource.Id.etf_region);
            province              = FindViewById <Spinner>(Resource.Id.sf_province);
            localmunicipality     = FindViewById <Spinner>(Resource.Id.sf_localmunicipality);
            gpsLocationButton     = FindViewById <ImageView>(Resource.Id.gpscaddlocation_button);
            bpLocationButton      = FindViewById <ImageView>(Resource.Id.bpaddlocation_button);
            refashAccuracy        = FindViewById <ImageView>(Resource.Id.refreshaccuracy_button);
            tvfLatLong            = FindViewById <TextView>(Resource.Id.tvf_latLang);
            boundaryPolygonsText  = FindViewById <TextView>(Resource.Id.boundaryPolygonsText);
            accuracyMessage       = FindViewById <TextView>(Resource.Id.accuracy_message);
            bpListView            = FindViewById <ListView>(Resource.Id.bplistView1);
            itemList              = new List <string>();
            refashAccuracy.Click += RefashAccuracy_Click;
            _BoundryPolygons      = new List <BoundryPolygon>();
            ViewModel             = new LocationViewModel();
            appPreferences        = new AppPreferences(Application.Context);
            helpers               = new UIHelpers();
            Location              = new Models.Location();
            var data = Intent.GetStringExtra("data");

            if (data != null)
            {
                Facility = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);
                Location = Facility.Location;
                if (Location != null)
                {
                    streetAddress.Text = Location.StreetAddress;
                    suburb.Text        = Location.Suburb;
                    region.Text        = Location.Region;
                    province.SetSelection(helpers.GetSpinnerIndex(province, Location.Province));
                    localmunicipality.SetSelection(helpers.GetSpinnerIndex(localmunicipality, Location.LocalMunicipality));
                    if (Location.GPSCoordinates != null)
                    {
                        tvfLatLong.Text = "Lat: " + Location.GPSCoordinates.Latitude + " Long: " + Location.GPSCoordinates.Longitude;
                    }
                    if (Location.BoundryPolygon != null)
                    {
                        foreach (var BoundaryPolygon in Location.BoundryPolygon)
                        {
                            _BoundryPolygons.Add(BoundaryPolygon);
                            itemList.Add("Lat: " + BoundaryPolygon.Latitude.ToString() + " Long: " + BoundaryPolygon.Longitude.ToString());
                        }

                        arrayAdapter              = new ArrayAdapter <string>(this, Resource.Layout.list_item, itemList);
                        bpListView.Adapter        = arrayAdapter;
                        bpListView.ItemLongClick += Adapter_ItemSwipe;
                        ViewGroup.LayoutParams param = bpListView.LayoutParameters;
                        param.Height = 80 * _BoundryPolygons.Count();
                        bpListView.LayoutParameters = param;
                    }
                    boundaryPolygonsText.Text = String.Format("Boundary Polygons {0}", itemList.Count);
                }
            }
            bpLocationButton.Click  += BPLocationButton_Click;
            gpsLocationButton.Click += GPSLocationButton_Click;
            Toolbar.MenuItemClick   += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Save":
                    SaveLocation();
                    break;
                }
            };

            GPSTracker GPSTracker = new GPSTracker();

            Android.Locations.Location location = GPSTracker.GPSCoordinate();
            if (location != null)
            {
                accuracyMessage.Text = String.Format("Accurate to {0} Meters", location.Accuracy.ToString());
            }
        }