public string[] getPrayerTimes(double ln, double lt) { int tz = 0; if (App.timeZone == 99) tz = TimeZoneInfo.Utc.GetUtcOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Month)).Hours; else tz = App.timeZone; var calculator = new Calculator(App.cm, App.aj, App.hlm); calculator.setOffSets(App.fajrAdjustment, App.dhuhrAdjustment, App.asrAdjustment, App.maghribAdjustment, App.ishaAdjustment); var times = calculator.GetPrayerTimes(DateTime.Today, lt, ln, 0, tz, App.isDST, App.displayTimeFormat); String[] s = new String[9]; s[0] = times.Imsak; s[1] = times.Fajr; s[2] = times.Sunrise; s[3] = times.Dhuhur; s[4] = times.Asr; s[5] = times.Sunset; s[6] = times.Magrib; s[7] = times.Isha; s[8] = times.Midnight; return s ; }
public string[] getPrayerTimes(double ln, double lt, DateTime workableDate, int overRideMethod) { int tz = 0; if(App.timeZone==99) tz = TimeZoneInfo.Utc.GetUtcOffset(new DateTime(workableDate.Year, workableDate.Month, workableDate.Month)).Hours; else tz = App.timeZone; var calculator = new Calculator(App.cm, App.aj, App.hlm); calculator.setOffSets(App.fajrAdjustment, App.dhuhrAdjustment, App.asrAdjustment, App.maghribAdjustment, App.ishaAdjustment); PrayerTimeDto times; if (overRideMethod == 1) // time for tiles { if (App.displayTimeFormat == 0) { times = calculator.GetPrayerTimes(workableDate, lt, ln, 0, tz, App.isDST, App.displayTimeFormat); } else { times = calculator.GetPrayerTimes(workableDate, lt, ln, 0, tz, App.isDST, TimeFormats.Hour24); } } else times = calculator.GetPrayerTimes(workableDate, lt, ln, 0, tz, App.isDST, App.displayTimeFormat); String[] s = new String[9]; s[0] = times.Imsak; s[1] = times.Fajr; s[2] = times.Sunrise; s[3] = times.Dhuhur; s[4] = times.Asr; s[5] = times.Sunset; s[6] = times.Magrib; s[7] = times.Isha; s[8] = times.Midnight; return s; }
static void Main() { Console.WriteLine("Using Muslim World League Method"); Console.WriteLine("--- Location: Jakarta ----"); var calc1 = new Calculator(); var res1 = calc1.GetPrayerTimes(DateTime.Today, -6.17, 106.83, 0, +7); // Jakarta Console.WriteLine("Fajr: {0}", res1.Fajr); Console.WriteLine("Dhuhur: {0}", res1.Dhuhur); Console.WriteLine("Asr: {0}", res1.Asr); Console.WriteLine("Magrib: {0}", res1.Magrib); Console.WriteLine("Isha: {0}", res1.Isha); Console.WriteLine(); Console.WriteLine("Using Makkah Method"); Console.WriteLine("--- Location: Dubai ----"); var calc2 = new Calculator(CalculationMethods.Makkah, AsrJuristics.Standard, HighLatitudeMethods.NightMiddle); var res2 = calc2.GetPrayerTimes(DateTime.Today, 25.2522, 55.2800, 0, +4); // Dubai Console.WriteLine("Fajr: {0}", res2.Fajr); Console.WriteLine("Dhuhur: {0}", res2.Dhuhur); Console.WriteLine("Asr: {0}", res2.Asr); Console.WriteLine("Magrib: {0}", res2.Magrib); Console.WriteLine("Isha: {0}", res2.Isha); Console.WriteLine(); Console.WriteLine("Using ISNA Method"); Console.WriteLine("--- Location: Redmond ----"); var calc3 = new Calculator(CalculationMethods.ISNA, AsrJuristics.Standard, HighLatitudeMethods.AngleBased); var res3 = calc3.GetPrayerTimes(DateTime.Today, 47.6833, -122.1231, 0, -8); Console.WriteLine("Fajr: {0}", res3.Fajr); Console.WriteLine("Dhuhur: {0}", res3.Dhuhur); Console.WriteLine("Asr: {0}", res3.Asr); Console.WriteLine("Magrib: {0}", res3.Magrib); Console.WriteLine("Isha: {0}", res3.Isha); Console.WriteLine(); Console.ReadKey(); }