void CreateCityMenu()
 {
     SubContinent[] subContinents = CityData.GetCityData();
     for (int i = 0; i < subContinents.Length; i++)
     {
         PivotItem pv = new PivotItem();
         pv.Header   = subContinents[i]._Name;
         pv.FontSize = 10;
         ChangeCityPivot.Items.Add(pv);
         CityStateList list = new CityStateList(subContinents[i]._stateOrCityList, this, i);
         pv.Content = list;
         pv.Tag     = subContinents[i];
     }
 }
Example #2
0
        private City GetCityInformation(String cityToken)
        {
            SubContinent[] subContinents = CityData.GetCityData();
            foreach (SubContinent subContinent in subContinents)
            {
                StateOrCity[] stateOrCityList = subContinent._stateOrCityList;
                for (int i = 0; i < stateOrCityList.Length; i++)
                {
                    StateOrCity stateOrCity = stateOrCityList[i];
                    bool        isState     = stateOrCity is State;

                    if (isState)
                    {
                        State state = stateOrCity as State;
                        foreach (City city in state._cities)
                        {
                            if (city._UrlToken == cityToken)
                            {
                                if (city._timeZone == TimeZoneValues.Unknown)
                                {
                                    city._timeZone = state._timeZone;
                                }
                                return(city);
                            }
                        }
                    }
                    else
                    {
                        City city = stateOrCity as City;
                        if (city._UrlToken == cityToken)
                        {
                            if (city._timeZone == TimeZoneValues.Unknown)
                            {
                                city._timeZone = subContinent._timeZone;
                            }
                            return(city);
                        }
                    }
                }
            }
            return(null);
        }
Example #3
0
        static void OldMain(string[] args)
        {
            scanPatterns = new PatternToScan[] {
                new PatternToScan(@"Sunrise:\s+([\d:]+)", false, FieldType.Sunrise),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Sunset:\s+([\d:]+)", false, FieldType.Sunset),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Moonrise:\s+([\w\d:]+)", false, FieldType.Moonrise),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, false, FieldType.TamilYear),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, false, FieldType.NorthYear),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, false, FieldType.GujaratYear),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Ayana:(\w+)", false, FieldType.Ayana),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Ritu:(\w+)", false, FieldType.Ritu),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Vedic Ritu:(\w+)", false, FieldType.VedicRitu),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, false, FieldType.TamilMonth),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, false, FieldType.SanskritMonth),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, false, FieldType.Paksha),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"T:\s+(\w+)", false, FieldType.Tithi),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"N:\s+(\S+)", false, FieldType.Nakshatra),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Y:\s+(\w+)", false, FieldType.Yoga),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"K:\s+(\w+)", false, FieldType.Karana),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Sun\s+:\s(\w+)", false, FieldType.SunRasi),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"Moon\s+:\s(\w+)", false, FieldType.MoonRasi),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"RK:\s+([\d:-]+)", false, FieldType.RahuKalam),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"YM:\s+([\d:-]+)", false, FieldType.YamaGandam),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(@"GK:\s+([\d:-]+)", false, FieldType.Gulikai),
                // spare values
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None),
                new PatternToScan(null, true, FieldType.None)
            };
            SubContinent[] subContinents = CityData.GetCityData();
            festivalData = FestivalDataGetter.GetFestivalData();


            //CalendarData.CityData.FindClosestCity(0, 0);
            //CalculateLatLong(subContinents);

            foreach (SubContinent subcontinent in subContinents)
            {
                TimeZoneValues timeZone;
                if (subcontinent._stateOrCityList[0] is State)
                {
                    State[] stateList = subcontinent._stateOrCityList as State[];
                    foreach (State state in stateList)
                    {
                        foreach (City city in state._cities)
                        {
                            if (subcontinent._timeZone != TimeZoneValues.Unknown)
                            {
                                timeZone = subcontinent._timeZone;
                            }
                            else if (state._timeZone != TimeZoneValues.Unknown)
                            {
                                timeZone = state._timeZone;
                            }
                            else
                            {
                                timeZone = city._timeZone;
                            }

                            GetCalendarDataPerCityAndYear(2013, city._Name, city._UrlToken, timeZone);
                        }
                    }
                }
                else
                {
                    City[] cityList = subcontinent._stateOrCityList as City[];
                    foreach (City city in cityList)
                    {
                        if (subcontinent._timeZone != TimeZoneValues.Unknown)
                        {
                            timeZone = subcontinent._timeZone;
                        }
                        else
                        {
                            timeZone = city._timeZone;
                        }
                        GetCalendarDataPerCityAndYear(2013, city._Name, city._UrlToken, timeZone);
                    }
                }
            }
        }