Пример #1
0
 public void changeType(int t)
 {
     try {
         GameObject.Destroy(currentFloor);
     }
     catch {}
     currentFloor = GameObject.Instantiate(floors[t], floors[t].transform.position, floors[t].transform.rotation) as GameObject;
     eq           = currentFloor.GetComponent <EarthQuake>();
 }
Пример #2
0
 public void Initialize()
 {
     testTerrarium = new Terrarium(10, 10);
     plant         = new Plant();
     herbivore     = new Herbivore();
     carnivore     = new Carnivore();
     human         = new Human();
     earthquake    = new EarthQuake();
     time          = new TimeController(0, testTerrarium);
 }
Пример #3
0
        public IActionResult Update(string id, EarthQuake earthQuakeIn)
        {
            var earthQuake = _earthQuakeService.Get(id);

            if (earthQuake == null)
            {
                return(NotFound());
            }

            _earthQuakeService.Update(id, earthQuakeIn);

            return(NoContent());
        }
Пример #4
0
 public void Remove(EarthQuake EarthQuakeIn)
 {
     _earthQuakes.DeleteOne(earthQuake => earthQuake.eqID == EarthQuakeIn.eqID);
 }
Пример #5
0
 public void Update(string id, EarthQuake EarthQuakeIn)
 {
     _earthQuakes.ReplaceOne(earthQuake => earthQuake.eqID == id, EarthQuakeIn);
 }
Пример #6
0
 public EarthQuake Create(EarthQuake earthQuake)
 {
     _earthQuakes.InsertOne(earthQuake);
     return(earthQuake);
 }
Пример #7
0
        public async Task RefreshData(EarthQuake earthQuakeData)
        {
            try
            {
                #region | Veri Çekimi İşlemi |

                earthQuakeList.Clear();

                if (earthQuakeData == null)
                {
                    earthQuakeData = await EarthQuakeService.InfoEarthQuake();
                }

                var res = (from s in earthQuakeData.result
                           where s.Other == "-" && s.Country == "Türkiye"
                           select s).ToList();

                foreach (var item in res)
                {
                    #region | Boş gelen Location değerini doldurma işlemi |

                    if (item.Location == "- (-)")
                    {
                        char[] _ayrac = { '(' };
                        item.Other = item.Other + "(";
                        var newValue = item.Other.Split(_ayrac);
                        if (newValue.Length > 1)
                        {
                            /*char[] _ayracTwo = { '.' };
                             * var newValueTwo = item.Other.Split(_ayracTwo);
                             * var _countyValue = newValueTwo[1].ToString();
                             *
                             * string _city = newValue[1].ToString().Replace(")", "").Replace(" ", "").Replace(",", "");
                             *
                             * string _county = _countyValue.Replace((_city),"").Replace(")", "").Replace("(", "");*/
                            item.Location = newValue[1].ToString().Replace(")", "").Replace(" ", "").Replace(",", "");
                        }

                        if (newValue[1].ToString() == "")
                        {
                            item.Location = newValue[0].ToString().Replace(")", "").Replace(" ", "").Replace(",", "");
                        }
                    }
                    #endregion

                    #region | Veri basma işlemi |

                    Location userLocation       = new Location(Latitude, Longitude);
                    Location earthquakeLocation = new Location(Convert.ToDouble(item.Latitude), Convert.ToDouble(item.Longitude));
                    double   distanceKM         = Location.CalculateDistance(userLocation, earthquakeLocation, DistanceUnits.Kilometers);

                    EarthQuakeList.Add(new Result
                    {
                        Location       = item.Location,
                        Date           = item.Date,
                        Ml             = item.Ml,
                        Depth          = item.Depth,
                        Latitude       = item.Latitude,
                        Longitude      = item.Longitude,
                        ShareButton    = item.Location + "@" + item.Ml + "@" + item.Date + "@" + item.City,
                        LocationButton = item.Location + "@" + item.Longitude + "@" + item.Latitude,
                        Distance       = Convert.ToInt32(distanceKM).ToString() + "km"
                    });

                    #endregion
                }

                #endregion

                #region | Bugün yaşanan en büyük deprem |

                var todayRes = (from s in res
                                where DateTime.ParseExact(s.Date, "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture) >= DateTime.Now.AddDays(-1)
                                select s).OrderByDescending(c => c.Ml).First();

                TodayHighestEarthQuake = "Bugün yaşanan en büyük deprem : " + todayRes.Location + " - Şiddet " + todayRes.Ml + "";
                #endregion

                #region | En üstteki deprem verilerini gösterme işlemi |

                TopInformation(res[0]);

                #endregion

                DependencyService.Get <IMessage>().LongMessage("Deprem verileri güncellendi...");
            }
            catch (System.Exception ex)
            {
            }
        }
Пример #8
0
        public ActionResult <EarthQuake> Create(EarthQuake earthQuake)
        {
            _earthQuakeService.Create(earthQuake);

            return(CreatedAtRoute("GetEarthQuake", new { id = earthQuake.eqID.ToString() }, earthQuake));
        }
Пример #9
0
 public void EarthQuakeConstructorTest()
 {
     earthquake = new EarthQuake(new Position(1, 2));
     Assert.AreEqual(1, earthquake.Position.X);
     Assert.AreEqual(2, earthquake.Position.Y);
 }