Exemple #1
0
        public void OnLocationChanged(Location location)
        {
            _currentLocation = location;
            if (_currentLocation == null)
            {
                Toast.MakeText(this, "current location not available", ToastLength.Short).Show();
            }
            else
            {
                _locationText = string.Format("{0:f6},{1:f6}", _currentLocation.Latitude, _currentLocation.Longitude);
                latitude      = _currentLocation.Latitude;
                longitude     = _currentLocation.Longitude;

                MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
                GoogleMap   map     = mapFrag.Map;
                map.Clear();

                map.SetOnInfoWindowClickListener(this);

                mountainsRepository = new MountainsService();
                mMountains          = mountainsRepository.GetAllMountains();

                foreach (Mountain item in mMountains)
                {
                    marker = map.AddMarker(new MarkerOptions()
                                           .SetPosition(new LatLng(item.Lat, item.Lng))
                                           .SetTitle(item.MtName)
                                           .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)));
                }
            }
        }
Exemple #2
0
        private void BandageBtn_Click(object sender, EventArgs e)
        {
            mountainService = new MountainsService();
            mFirstAid       = mountainService.GetFirstAidData();
            var intent = new Intent(this, typeof(FirstAidAct));

            intent.PutExtra("TITLE", mFirstAid.Title);
            intent.PutExtra("Desc00", mFirstAid.Desc00);
            intent.PutExtra("Img001", mFirstAid.Img001);
            intent.PutExtra("Desc001", mFirstAid.Desc001);
            intent.PutExtra("Img002", mFirstAid.Img002);
            intent.PutExtra("Desc002", mFirstAid.Desc002);
            intent.PutExtra("Img003", mFirstAid.Img003);
            intent.PutExtra("Desc003", mFirstAid.Desc003);
            intent.PutExtra("Img004", mFirstAid.Img004);
            intent.PutExtra("Desc004", mFirstAid.Desc004);
            intent.PutExtra("Img005", mFirstAid.Img005);
            intent.PutExtra("Desc005", mFirstAid.Desc005);
            intent.PutExtra("Img006", mFirstAid.Img006);
            intent.PutExtra("Desc006", mFirstAid.Desc006);


            intent.PutExtra("Desc01", mFirstAid.Desc01);
            intent.PutExtra("Img011", mFirstAid.Img011);
            intent.PutExtra("Desc011", mFirstAid.Desc011);
            intent.PutExtra("Img012", mFirstAid.Img012);
            intent.PutExtra("Desc012", mFirstAid.Desc012);
            intent.PutExtra("Img013", mFirstAid.Img013);
            intent.PutExtra("Desc013", mFirstAid.Desc013);
            intent.PutExtra("Img014", mFirstAid.Img014);
            intent.PutExtra("Desc014", mFirstAid.Desc014);
            intent.PutExtra("Img015", mFirstAid.Img015);
            intent.PutExtra("Desc015", mFirstAid.Desc015);


            intent.PutExtra("Desc02", mFirstAid.Desc02);
            intent.PutExtra("Img021", mFirstAid.Img021);
            intent.PutExtra("Desc021", mFirstAid.Desc021);
            intent.PutExtra("Img022", mFirstAid.Img022);
            intent.PutExtra("Desc022", mFirstAid.Desc022);
            intent.PutExtra("Img023", mFirstAid.Img023);
            intent.PutExtra("Desc023", mFirstAid.Desc023);
            intent.PutExtra("Img024", mFirstAid.Img024);
            intent.PutExtra("Desc024", mFirstAid.Desc024);
            intent.PutExtra("Img025", mFirstAid.Img025);
            intent.PutExtra("Desc025", mFirstAid.Desc025);

            StartActivity(intent);
            OverridePendingTransition(Resource.Animation.slide_right, Resource.Animation.fade_out);
        }
        public void AddingMountain()
        {
            var list     = new List <Mountain>();
            var mockRepo = new Mock <IDeletableEntityRepository <Mountain> >();

            mockRepo.Setup(x => x.AllAsNoTracking()).Returns(list.AsQueryable());
            mockRepo.Setup(x => x.AddAsync(It.IsAny <Mountain>()));
            var service  = new MountainsService(mockRepo.Object);
            var mountain = new Mountain
            {
                Id   = 1,
                Name = "Rila",
            };

            list.Add(mountain);
            var expected = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("1", "Rila"),
            };

            Assert.Equal(expected, service.GetAllAsKeyValuePairs());
        }
Exemple #4
0
        private void SnakebiteBtn_Click(object sender, EventArgs e)
        {
            mountainService = new MountainsService();
            mSnakeBite      = mountainService.GetSnakeBiteData();
            var intent = new Intent(this, typeof(SnakeBiteAct));

            intent.PutExtra("TITLE", mSnakeBite.Title);
            intent.PutExtra("TITLEDESC", mSnakeBite.TitleDesc);
            intent.PutExtra("Description1", mSnakeBite.Description1);
            intent.PutExtra("Description2", mSnakeBite.Description2);
            intent.PutExtra("Description3", mSnakeBite.Description3);
            intent.PutExtra("Description4", mSnakeBite.Description4);
            intent.PutExtra("Description5", mSnakeBite.Description5);
            intent.PutExtra("Description6", mSnakeBite.Description6);
            intent.PutExtra("Description7", mSnakeBite.Description7);
            intent.PutExtra("Description8", mSnakeBite.Description8);
            intent.PutExtra("Description9", mSnakeBite.Description9);
            intent.PutExtra("Description10", mSnakeBite.Description10);
            StartActivity(intent);


            OverridePendingTransition(Resource.Animation.slide_right, Resource.Animation.fade_out);
        }
Exemple #5
0
        private void BtnLnt_Click(object sender, EventArgs e)
        {
            mountainService = new MountainsService();
            mLnt            = mountainService.GetLeaveNoTraceData();
            var intent = new Intent(this, typeof(LeaveNoTraceAct));

            intent.PutExtra("Title", mLnt.Title);
            intent.PutExtra("Desc", mLnt.Desc);
            intent.PutExtra("Desc1", mLnt.Desc1);
            intent.PutExtra("Desc11", mLnt.Desc11);
            intent.PutExtra("Desc2", mLnt.Desc2);
            intent.PutExtra("Desc22", mLnt.Desc22);
            intent.PutExtra("Desc3", mLnt.Desc3);
            intent.PutExtra("Desc33", mLnt.Desc33);
            intent.PutExtra("Desc4", mLnt.Desc4);
            intent.PutExtra("Desc44", mLnt.Desc44);
            intent.PutExtra("Desc5", mLnt.Desc5);
            intent.PutExtra("Desc55", mLnt.Desc55);
            intent.PutExtra("Desc6", mLnt.Desc6);
            intent.PutExtra("Desc66", mLnt.Desc66);
            intent.PutExtra("Desc7", mLnt.Desc7);
            intent.PutExtra("Desc77", mLnt.Desc77);
            intent.PutExtra("Desc8", mLnt.Desc8);
            intent.PutExtra("Desc88", mLnt.Desc88);

            intent.PutExtra("Icon1", mLnt.Icon1);
            intent.PutExtra("Icon2", mLnt.Icon2);
            intent.PutExtra("Icon3", mLnt.Icon3);
            intent.PutExtra("Icon4", mLnt.Icon4);
            intent.PutExtra("Icon5", mLnt.Icon5);
            intent.PutExtra("Icon6", mLnt.Icon6);
            intent.PutExtra("Icon7", mLnt.Icon7);
            intent.PutExtra("Icon8", mLnt.Icon8);

            StartActivity(intent);
            OverridePendingTransition(Resource.Animation.slide_right, Resource.Animation.fade_out);
        }
Exemple #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.mountainMap);
            //settings database getting records
            InitializeLocationManager();
            DBItineraryRepository dbr = new DBItineraryRepository();

            var terrain        = "terrain";
            var terrainValue   = "1";
            var normal         = "normal";
            var normalValue    = "0";
            var satellite      = "satellite";
            var satelliteValue = "0";
            var hybrid         = "toiletries";
            var hybridValue    = "0";

            try
            {
                var terrainResult = dbr.GetRecordSettings(terrain);
                terrainValue = terrainResult;
                var normalResult = dbr.GetRecordSettings(normal);
                normalValue = normalResult;
                var satelliteResult = dbr.GetRecordSettings(satellite);
                satelliteValue = satelliteResult;
                var hybridResult = dbr.GetRecordSettings(hybrid);
                hybridValue = hybridResult;
            }
            catch (Exception ex)
            {
            }

            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
            GoogleMap   map     = mapFrag.Map;

            map.SetOnInfoWindowClickListener(this);

            // position
            LatLng locations = new LatLng(13, 122);

            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(locations);
            builder.Zoom(6);
            CameraPosition cameraPosition = builder.Build();
            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            if (map != null)
            {
                map.Clear();
                map.MapType = GoogleMap.MapTypeTerrain;

                if (terrainValue == "1")
                {
                    map.MapType = GoogleMap.MapTypeTerrain;
                }
                else if (normalValue == "1")
                {
                    map.MapType = GoogleMap.MapTypeNormal;
                }
                else if (satelliteValue == "1")
                {
                    map.MapType = GoogleMap.MapTypeSatellite;
                }
                else if (hybridValue == "1")
                {
                    map.MapType = GoogleMap.MapTypeHybrid;
                }

                map.UiSettings.ZoomControlsEnabled = true;
                map.UiSettings.CompassEnabled      = true;
                map.MoveCamera(cameraUpdate);

                mountainsRepository = new MountainsService();
                mMountains          = mountainsRepository.GetAllMountains();

                foreach (Mountain item in mMountains)
                {
                    marker = map.AddMarker(new MarkerOptions()
                                           .SetPosition(new LatLng(item.Lat, item.Lng))
                                           .SetTitle(item.MtName)
                                           .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)));
                }
            }
        }