Example #1
0
        // get asr shadow factor
        public double asrFactor(AsrMethod asrParam)
        {
            var factor = new Dictionary <AsrMethod, double> {
                { AsrMethod.Standard, 1 }, { AsrMethod.Hanafi, 2 }
            };

            //[asrParam];
            //return factor || this.eval(asrParam);
            return(factor[asrParam]);
        }
Example #2
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);
            }
        }
Example #3
0
 // Get asr shadow factor
 private double AsrFactor(AsrMethod asrParam)
 {
     return asrParam == AsrMethod.Standard ? 1 : 0;
 }