示例#1
0
        public PrayerTimeCalculation(MethodBase method, AsrMethod asrMethod, MidnightMethod midnightMethod, int maghribAdjustment)
        {
            if (method == null)
                throw new ArgumentNullException("Method must be specified");
            else
                currentMethod = method;

            timeFormat = TimeFormat.Format24h;

            // Do not change anything here; use adjust method instead
            settings.Add(TimeNames.Imsak, "10 min");
            settings.Add(TimeNames.Dhuhr, "0 min");
            settings.Add(TimeNames.Asr, asrMethod);
            settings.Add("HighLats", HighLatitudeMethod.AngleBased);

            //timeSuffixes = ['am', 'pm'],
            //invalidTime =  '-----',

            numIterations = 1;

            // Default Parameters in Calculation Methods
            defaultParams.Add(TimeNames.Maghrib, maghribAdjustment + " min");
            defaultParams.Add(TimeNames.Midnight, midnightMethod);

            foreach (DictionaryEntry item in defaultParams)
            {
                if (!currentMethod.Parameters.Contains(item.Key))
                    currentMethod.Parameters.Add(item.Key, item.Value);
                else if (item.Key == TimeNames.Maghrib && maghribAdjustment > 0 && Utils.ContainsMin(currentMethod.Parameters[item.Key]))
                {
                    var maghribNewValue = Utils.Eval(currentMethod.Parameters[item.Key].ToString()) + maghribAdjustment;
                    currentMethod.Parameters[item.Key] = maghribNewValue + " min";
                }
            }

            // Initialize settings
            foreach (DictionaryEntry item in currentMethod.Parameters)
            {
                settings[item.Key] = item.Value;
            }

            foreach (string timeName in TimeNames.TimeName)
            {
                offsets.Add(timeName, 0);
            }
        }
示例#2
0
 private void UpdateTile(Location location, MethodBase method, string asrMethod, string midnightMethod)
 {
     if (!string.IsNullOrEmpty(location.City) && method != null)
         Notification.UpdateTile(location, method.ToString(), asrMethod, midnightMethod);
 }
示例#3
0
        private async Task UpdateToastNotifications(Location location, MethodBase method, string asrMethod, string midnightMethod)
        {

            this.source = new CancellationTokenSource();
            PrayerTimeCalculation prayerCalculation = new PrayerTimeCalculation(
                method,
                ConvertStringToAsrMethod(asrMethod),
                ConvertStringToMidnightMethod(midnightMethod),
                this.MaghribAdjustement);

            await Notification.PlanToastNotifications(source.Token, prayerCalculation, location);
        }
示例#4
0
        private MethodBase GetMethodByCountry(string country = null, string city = null)
        {
            if (string.IsNullOrEmpty(country))
                country = Location.Country;

            if (string.IsNullOrEmpty(city))
                city = Location.City;

            MethodBase method = null;
            switch (country)
            {
                case "France": method = new MethodUOIF();
                    break;

                case "Morocco": method = new MethodMorocco();
                    break;

                case "Pakistan":
                case "India":
                case "Bangladesh":
                case "Afghanistan":
                    method = new MethodKarachi();
                    break;

                case "Bahrain":
                case "United Arab Emirates":
                case "Saudi Arabia":
                case "Kuwait":
                case "Oman":
                case "Qatar":
                case "Yemen":
                case "Syria":
                    method = new MethodMakkah();
                    break;

                case "Egypt":
                case "Algeria":
                case "Libya":
                    method = new MethodEgypt();
                    break;

                default:
                    switch (LocationService.GetContinent(country))
                    {
                        case "Antarctica":
                        case "Europe": method = new MethodMWL();
                            break;
                        case "North America": method = new MethodISNA();
                            break;
                        case "Africa": method = new MethodMWL();
                            break;
                        case "South America": method = new MethodMWL();
                            break;
                        default: method = new MethodMWL();
                            break;
                    }
                    break;

            }
            return method;
        }