コード例 #1
0
ファイル: GPAppHelper.cs プロジェクト: vijeetgv/GCAL
        public static GPLocationProvider getMyLocation()
        {
            if (myLocation == null)
            {
                myLocation = new GPLocationProvider();
                bool   bSucc        = false;
                string possibleFile = GPFileHelper.getAppDataFile("mylocation.xml");
                if (File.Exists(possibleFile))
                {
                    try
                    {
                        myLocation.loadXml(possibleFile);
                        bSucc = true;
                    }
                    catch
                    {
                    }
                }

                if (bSucc == false)
                {
                    NumberFormatInfo fmt = new NumberFormatInfo();
                    GPLocation       loc = new GPLocation();
                    loc.setCity(GPUserDefaults.StringForKey("myloc.city", "Mayapur"));
                    loc.setCountryCode(GPUserDefaults.StringForKey("myloc.country", "IN"));
                    loc.setLatitudeNorthPositive(double.Parse(GPUserDefaults.StringForKey("myloc.lat", "23.423413"), fmt));
                    loc.setLongitudeEastPositive(double.Parse(GPUserDefaults.StringForKey("myloc.lon", "88.388079"), fmt));
                    loc.setTimeZoneName(GPUserDefaults.StringForKey("myloc.tzname", "Asia/Calcutta"));
                    myLocation.setDefaultLocation(loc);
                }
            }

            return(myLocation);
        }
コード例 #2
0
ファイル: GPLocationList.cs プロジェクト: vijeetgv/GCAL
 public override void InsertNewObjectFromStrings(string[] parts, FileKey fk)
 {
     if (parts.Length >= 5 && parts[0].Length > 0)
     {
         NumberFormatInfo fmt      = new NumberFormatInfo();
         GPLocation       location = new GPLocation();
         location.setCity(parts[0]);
         location.setLatitudeNorthPositive(double.Parse(parts[1], fmt));
         location.setLongitudeEastPositive(double.Parse(parts[2], fmt));
         location.setCountryCode(parts[3]);
         location.setTimeZoneName(parts[4]);
         locations.Add(location);
     }
 }