Ejemplo n.º 1
0
Archivo: AI.cs Proyecto: Zepsen/Sky2
        public AI(int[] arr)
        {
            Map.SetConstrains(arr);

            map = new Map(new List <Field>()
            {
                new Field(0, 0),
                new Field(0, 1),
                new Field(0, 2),
                new Field(0, 3),
                new Field(1, 0),
                new Field(1, 1),
                new Field(1, 2),
                new Field(1, 3),
                new Field(2, 0),
                new Field(2, 1),
                new Field(2, 2),
                new Field(2, 3),
                new Field(3, 0),
                new Field(3, 1),
                new Field(3, 2),
                new Field(3, 3),
            });

            history = new MapHistory(map);
        }
Ejemplo n.º 2
0
        private async void AddMapHistory(MapHistory history)
        {
            await firebaseHelper.AddMapHistory(history);

            //await DisplayAlert("Success", "Person Added Successfully", "OK");
            Console.WriteLine("Map history added Successfully");
            // var allPersons = await firebaseHelper.GetAllPersons();
            // lstPersons.ItemsSource = allPersons;
        }
Ejemplo n.º 3
0
        private async Task RetreiveLocation()
        {
            if (Application.Current.Properties.ContainsKey("USER_NAME"))
            {
                var username = Application.Current.Properties["USER_NAME"] as string;

                var locator = CrossGeolocator.Current;
                locator.DesiredAccuracy = 20;

                var position = await locator.GetPositionAsync(TimeSpan.FromTicks(10000));

                txtLat.Text  = "Latitude : " + position.Latitude.ToString();
                txtLong.Text = "Longitude : " + position.Longitude.ToString();



                Position  pos      = new Position(position.Latitude, position.Longitude);
                DateTime  datetime = DateTime.Now;
                CustomPin pin      = new CustomPin
                {
                    Type     = PinType.Place,
                    Position = pos,
                    Label    = "ข้อมูลพิกัดล่าสุด(" + username + ")",
                    Address  = "พิกัด: " + position.Latitude.ToString() + ", " + position.Longitude.ToString(),
                    Name     = username,
                    Time     = datetime.ToString(),
                    Url      = "www.google.co.th"
                };
                MyMap.Pins.Clear();
                MyMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude)
                                                               , Distance.FromMeters(500)));
                MyMap.Pins.Add(pin);

                MapHistory history = new MapHistory();
                history.LoginName    = username;
                history.Accuracy     = locator.DesiredAccuracy.ToString();
                history.GeoLatitude  = position.Latitude.ToString();
                history.GeoLongitude = position.Longitude.ToString();
                history.PinType      = PinType.Place.ToString();
                history.PinLabel     = pin.Label.ToString();
                history.PinAddress   = pin.Address.ToString();
                history.SaveTime     = datetime;

                AddMapHistory(history);
            }
        }
Ejemplo n.º 4
0
 public async Task AddMapHistory(MapHistory history)
 {
     await firebase
     .Child("MapHistory")
     .PostAsync(history);
 }