protected override void OnCreate(Bundle savedInstanceState) { //Window Setup base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.winGraphV2); //Get UI Items. //Setup Swipe. this.swipeLeft = new Easter(new CustomEgg("Left").WatchForSequence(Command.SwipeLeft())); this.swipeRight = new Easter(new CustomEgg("right").WatchForSequence(Command.SwipeRight())); this.swipeLeft.EggDetected += (Egg Egg) => { if (this.windowID < 2) { this.windowID++; } }; this.swipeRight.EggDetected += (Egg egg) => { if (this.windowID > 0) { this.windowID--; } }; //Get Data From Service. this.courses = weekData.Keys; int userID = Controller.getController().user.ID; this.weekData = Controller.getController().service.getAvgsWeek(userID); this.monthData = Controller.getController().service.getAvgsMonth(userID); this.YearData = Controller.getController().service.getAvgsYear(userID); }
public string GetEaster(string year) { int yearNo = 0; if (!int.TryParse(year, out yearNo)) { return(null); } return(Easter.CalcEaster(yearNo).ToShortDateString()); }
public Dagar(int ár) { Ár = ár; páskadagur = new Lazy <DateTime>(() => Easter.CalculateForYear(Ár)); fyrraÁr = new Lazy <Dagar>(() => new Dagar(Ár - 1)); frídagar = new Lazy <AlmennirFrídagar>(() => new AlmennirFrídagar(this)); aðrir = new Lazy <AðrirViðburðardagar>(() => new AðrirViðburðardagar(this)); norrænt = new Lazy <Norrænt>(() => new Norrænt(this)); }
private static TemporalExpressionUnion GetEasterHolidays(int startYear, int endYear) { Debug.Assert(endYear >= startYear); var list = Easter.GetEasterSundays(startYear, endYear); var union = new TemporalExpressionUnion(); foreach (var date in list) { union.Add(new ScheduleDate(date)); } return(union); }
static public PrayerSeason CreatePrayerSeason(Place place, bool testMode) { PrayerSeason prayerSeason = null; switch (place.DomSeason) { case DominicanSeasons.XMas: prayerSeason = new XMas(place, testMode); break; case DominicanSeasons.OT1: prayerSeason = new OrdinaryTime(place, testMode); break; case DominicanSeasons.Ash_Wednesday_Week: prayerSeason = new AshWednesdayWeek(place, testMode); break; case DominicanSeasons.Lent: prayerSeason = new Lent(place, testMode); break; case DominicanSeasons.Holy_Week: prayerSeason = new HolyWeek(place, testMode); break; case DominicanSeasons.Easter: prayerSeason = new Easter(place, testMode); break; case DominicanSeasons.OT2: prayerSeason = new OrdinaryTime(place, testMode); break; case DominicanSeasons.Advent: prayerSeason = new Advent(place, testMode); break; case DominicanSeasons.XMas_II: prayerSeason = new XMas(place, testMode); break; //case DominicanSeasons.EndOfYear: //break; case DominicanSeasons.Feasts: default: prayerSeason = new FeastDay(place, testMode); break; } return(prayerSeason); }
protected override void OnCreate(Bundle savedInstanceState) { //Window Setup base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.winGraph); //Get Data From Service. int userID = Controller.getController().user.ID; s.weekData = Controller.getController().service.getAvgsWeek(userID); s.monthData = Controller.getController().service.getAvgsMonth(userID); s.YearData = Controller.getController().service.getAvgsYear(userID); s.userCources = new List <MoodleCourse> (); foreach (MoodleCourse c in s.weekData.Keys) { s.userCources.Add(c); } s.selectedCourse = s.userCources[0]; //Get UI Items. this.revLayout = FindViewById <RelativeLayout> (Resource.Id.winChartLayout); this.btnCourseSelect = FindViewById <Button> (Resource.Id.btnCourseSelect); this.btnCourseSelect.Click += delegate { this.selectCourse = true; FragmentTransaction ft = FragmentManager.BeginTransaction(); dialog_SelectCourse sc = new dialog_SelectCourse(this); sc.Show(ft, "dialog_SelectCourse"); }; //Setup Swipe. this.swipeLeft = new Easter(new CustomEgg("Left").WatchForSequence(Command.SwipeLeft())); this.swipeRight = new Easter(new CustomEgg("right").WatchForSequence(Command.SwipeRight())); this.swipeLeft.EggDetected += (Egg Egg) => { if (this.windowID < 2) { this.windowID++; } this.redoWindow(); }; this.swipeRight.EggDetected += (Egg egg) => { if (this.windowID > 0) { this.windowID--; } this.redoWindow(); }; this.redoWindow(); }
public void EasterWesternDateTest() { var d2020 = new DateTime(2020, 4, 12); var d2021 = new DateTime(2021, 4, 4); var d2022 = new DateTime(2022, 4, 17); var d2023 = new DateTime(2023, 4, 9); var d2024 = new DateTime(2024, 3, 31); var d2025 = new DateTime(2025, 4, 20); var d2026 = new DateTime(2026, 4, 5); var d2027 = new DateTime(2027, 3, 28); var d2028 = new DateTime(2028, 4, 16); var d2029 = new DateTime(2029, 4, 1); var d2030 = new DateTime(2030, 4, 21); //var dateList = Easter.GetEasterSundays(2020, 2030); //foreach (var date in dateList) //{ // Debug.WriteLine(date.ToShortDateString()); //} var s2020 = new ScheduleDate(Easter.GetEasterSunday(2020)); var s2021 = new ScheduleDate(Easter.GetEasterSunday(2021)); var s2022 = new ScheduleDate(Easter.GetEasterSunday(2022)); var s2023 = new ScheduleDate(Easter.GetEasterSunday(2023)); var s2024 = new ScheduleDate(Easter.GetEasterSunday(2024)); var s2025 = new ScheduleDate(Easter.GetEasterSunday(2025)); var s2026 = new ScheduleDate(Easter.GetEasterSunday(2026)); var s2027 = new ScheduleDate(Easter.GetEasterSunday(2027)); var s2028 = new ScheduleDate(Easter.GetEasterSunday(2028)); var s2029 = new ScheduleDate(Easter.GetEasterSunday(2029)); var s2030 = new ScheduleDate(Easter.GetEasterSunday(2030)); Assert.IsTrue(s2020.Includes(d2020)); Assert.IsTrue(s2021.Includes(d2021)); Assert.IsTrue(s2022.Includes(d2022)); Assert.IsTrue(s2023.Includes(d2023)); Assert.IsTrue(s2024.Includes(d2024)); Assert.IsTrue(s2025.Includes(d2025)); Assert.IsTrue(s2026.Includes(d2026)); Assert.IsTrue(s2027.Includes(d2027)); Assert.IsTrue(s2028.Includes(d2028)); Assert.IsTrue(s2029.Includes(d2029)); Assert.IsTrue(s2030.Includes(d2030)); }
protected override void OnCreate(Bundle savedInstanceState) { //Window Setup base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.winGraph); //Get UI Items. this.revLayout = FindViewById <RelativeLayout> (Resource.Id.winChartLayout); //Setup Swipe. this.swipeLeft = new Easter(new CustomEgg("Left").WatchForSequence(Command.SwipeLeft())); this.swipeRight = new Easter(new CustomEgg("right").WatchForSequence(Command.SwipeRight())); this.swipeLeft.EggDetected += (Egg Egg) => { if (this.windowID < 2) { this.windowID++; } Toast.MakeText(this, "WindowID: " + windowID, ToastLength.Long).Show(); this.redoWindow(); }; this.swipeRight.EggDetected += (Egg egg) => { if (this.windowID > 0) { this.windowID--; } Toast.MakeText(this, "WindowID: " + windowID, ToastLength.Long).Show(); this.redoWindow(); }; //Get Data From Service. Controller.getController().user = Controller.getController().service.getUserByID(6); int userID = Controller.getController().user.ID; this.weekData = Controller.getController().service.getAvgsWeek(userID); this.monthData = Controller.getController().service.getAvgsMonth(userID); this.YearData = Controller.getController().service.getAvgsYear(userID); this.courses = new List <MoodleCourse> (); foreach (MoodleCourse c in weekData.Keys) { this.courses.Add(c); } this.redoWindow(); }
public Event(DateTime ClockStart, DateTime ClockEnd, int ClockRunTime, System.Xml.Linq.XDocument XMLEvents, ref CrashHandler Crash) { ch = Crash; events = new Dictionary<string, List<EventItem>>(); clock = new PartyClock(ClockStart, ClockEnd, ClockRunTime); Util.ShowClock = true; sound = new Sound(true); text = new Text2D(); chess = new Chess(); sf = new Starfield(150); intro = new Intro(ref sound, ref text); outro = new Outro(ref sound); advent = new Advent(ref sound); birthday = new Birthday(ref sound, ref text, ref chess); xmas = new Christmas(ref sound); smurf = new Datasmurf(ref sound, ref text); // random dif = new Dif(ref chess, ref sound); // random fbk = new Fbk(ref sound); // random hw = new Halloween(ref chess, ref sound, 25); lucia = new Lucia(ref chess, ref sound); newyear = new NewYear(); richard = new RMS(ref sound, ref text); // random scroller = new Scroller(ref chess, ref sf, ref text); // random semla = new Semla(); sune = new SuneAnimation(ref sound, ref text); tl = new TurboLogo(ref sound, ref chess, (OpenGL.Util.SpringOrFall.Equals("Spring")? true:false)/*((ClockStart.Month >= 1 && ClockStart.Month <= 8)? false:true)*/ ); // vilken termin är det? jan till början av augusti VT, resten HT... random valentine = new Valentine(ref sound); wl = new WinLinux(ref chess); //random creators = new Self(ref sound); // random bb = new BB(ref sound); // random GM = new GummiBears(ref sound); NDay = new National(ref chess, ref sound); easter = new Easter(ref sound); hajk = new Hajk(ref sound); mid = new Midsummer(ref sound); vaf = new Vaffla(); wp = new Walpurgis(); crayfish = new CrayFish(); ts = new TeknatStyle(ref chess, ref sound, ref text); m = new Matrix(ref text); q = new Quiz(ref text, false, ref sound); talepsin = new Talespin(ref sound); cd = new ChipAndDale(ref sound, ref chess); nerd = new Nerdy(ref chess, ref sound); trex = new Trex(ref sound); sailormoon = new Sailormoon(ref sound,ref chess); gb = new GhostBusters(ref sound); zelda = new Zelda(ref sound, ref chess); tardis = new Tardis(ref sound); f**k = new F**k(ref sound, ref chess); silverFang = new SilverFang(ref sound); mt = new MoraT(ref sound); swine = new Swine(ref chess, ref text); tjall = new Tjall(ref chess, ref text); ronja = new Ronja(ref sound); emil = new Emil(ref sound); djungelboken = new Djungelboken(ref sound); fabbe = new Fabbe(ref sound); drink = new Drink(ref sound); frozen = new Frozen(ref sound); eventCurrent = null; // event item for events to be triggerd in clock_NewDate //randomEvent = new List<string>(new string[] { "starfield", "SuneAnimation", "TurboLogo", "Datasmurf", "WinLinux", "Scroller", "BB", "GummiBears", "TeknatStyle", "Matrix"}); randomEvent = new List<string>(new string[] { "starfield", "Nerdy", "Talespin", "Sailormoon", "GhostBusters", "Zelda", "Tardis", "F**k", "SilverFang", "MoraT" }); //new stuff List<UtilXML.EventData> ed = UtilXML.Loadeffectdata(); // TODO: Make a clean list with all events allowed to be used implement so that it is actaully usable instead of a switch at the bottom of this file. Dictionary<string, Effect> effects = new Dictionary<string, Effect>() { {"SuneAnimation", new Effect(sune, ed.Find(e => e.Name == "SuneAnimation"))}, {"Dif",new Effect(dif, ed.Find(e => e.Name == "Dif"))}, {"Fbk",new Effect(fbk, ed.Find(e => e.Name == "Fbk"))}, {"TurboLogo",new Effect(tl, ed.Find(e => e.Name == "TurboLogo"))}, {"Datasmurf", new Effect(smurf, ed.Find(e => e.Name == "Datasmurf"))}, {"RMS",new Effect(richard, ed.Find(e => e.Name == "RMS"))}, {"WinLinux",new Effect(wl, ed.Find(e => e.Name == "WinLinux"))}, {"Scroller",new Effect(scroller, ed.Find(e => e.Name == "Scroller"))}, {"Self",new Effect(creators, ed.Find(e => e.Name == "Self"))}, {"BB",new Effect(bb, ed.Find(e => e.Name == "BB"))}, {"GummiBears",new Effect(GM, ed.Find(e => e.Name == "GummiBears"))}, {"Hajk",new Effect(hajk, ed.Find(e => e.Name == "Hajk"))}, {"TeknatStyle",new Effect(ts, ed.Find(e => e.Name == "TeknatStyle"))}, {"Matrix",new Effect(m, ed.Find(e => e.Name == "Matrix"))}, {"Quiz",new Effect(q, ed.Find(e => e.Name == "Quiz"))}, {"Talespin",new Effect(talepsin, ed.Find(e => e.Name == "Talespin"))}, {"ChipDale",new Effect(cd, ed.Find(e => e.Name == "ChipDale"))}, {"Nerdy",new Effect(nerd, ed.Find(e => e.Name == "Nerdy"))}, /* {"Trex",new Effect(trex, ed.Find(e => e.Name == "Trex"))},*/ {"Sailormoon",new Effect(sailormoon, ed.Find(e => e.Name == "Sailormoon"))}, {"GhostBusters",new Effect(gb, ed.Find(e => e.Name == "GhostBusters"))}, {"Zelda",new Effect(zelda, ed.Find(e => e.Name == "Zelda"))}, {"Tardis",new Effect(tardis, ed.Find(e => e.Name == "Tardis"))}, {"F**k",new Effect(f**k, ed.Find(e => e.Name == "F**k"))}, {"SilverFang",new Effect(silverFang, ed.Find(e => e.Name == "SilverFang"))}, {"MoraT",new Effect(mt, ed.Find(e => e.Name == "MoraT"))}, {"Ronja",new Effect(ronja, ed.Find(e => e.Name == "Ronja"))}, {"Emil",new Effect(emil, ed.Find(e => e.Name == "Emil"))}, {"Djungelboken",new Effect(djungelboken, ed.Find(e => e.Name == "Djungelboken"))}, {"Fabbe",new Effect(fabbe, ed.Find(e => e.Name == "Fabbe"))}, {"Drink",new Effect(drink, ed.Find(e => e.Name == "Drink"))}, {"Frozen",new Effect(drink, ed.Find(e => e.Name == "Frozen"))} }; runEffectInMonth = new Dictionary<string, List<objdata>>(); string[] months = Util.monthlist(); int counter; foreach (KeyValuePair<string, Effect> pair in effects) { counter = 0; foreach (bool b in pair.Value.RunAllowedlist) { if (b == true) { if (!runEffectInMonth.ContainsKey(months[counter])) { runEffectInMonth.Add(months[counter], new List<objdata>()); } runEffectInMonth[months[counter]].Add(new objdata(pair.Key, pair.Value.Vetolist[counter], pair.Value.Priolist[counter], pair.Value.Runslist[counter])); } counter++; } } clock.NewDate += clock_NewDate; // Event listener if (ch.CrashDialogResult == System.Windows.Forms.DialogResult.Yes) { clock.clock = ch.CrashClock; } string name, date, type; // Event dates setup foreach (var item in XMLEvents.Descendants("event")) { name = item.Element("name").Value; date = item.Element("date").Value; type = item.Element("type").Value.ToLower(); EventItem ei = new EventItem(name, type, date); if (!events.ContainsKey(date)) { List<EventItem> list = new List<EventItem>(); // seems most bad in my eyes... events.Add(date, list); } for (int i = 0; i < events[date].Count; i++) { EventItem e = events[date][i]; if ("birthday".Equals(e.Type) && "birthday".Equals(ei.Type)) { e.Name += "\n\n" + ei.Name; events[date][i] = e; } } events[date].Add(ei); name = date = type = string.Empty; } // this needs to be fixed nicer... if (events.ContainsKey(ClockEnd.ToShortDateString())) { events[ClockEnd.ToShortDateString()].Clear(); // force this to be top.. events[ClockEnd.ToShortDateString()].Add( new EventItem("outro", "outro", ClockEnd.ToShortDateString()) ); } else { events.Add(ClockEnd.ToShortDateString(), new List<EventItem>() { new EventItem("outro", "outro", ClockEnd.ToShortDateString()) }); } // Random effects on dates with no effects and check against new list of allowed things for them... DateTime dt = ClockStart; bool star = (Util.Rnd.Next(0, 1000) < 500 ? true:false); // make this random at the start too? int num = 0; while (dt <= ClockEnd) { date = dt.ToShortDateString(); if (!events.ContainsKey(date)) { EventItem ei; if (num == 0 || num == 1) { ei = new EventItem("starfield", "random", date); } else { //ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); string month = ""; if (dt != null) month = dt.Month.ToString(); switch (month) { case "1": month = "jan"; break; case "2": month = "feb"; break; case "3": month = "mar"; break; case "4": month = "apr"; break; case "5": month = "maj"; break; case "6": month = "jun"; break; case "7": month = "jul"; break; case "8": month = "aug"; break; case "9": month = "sep"; break; case "10": month = "okt"; break; case "11": month = "nov"; break; case "12": month = "dec"; break; }//switch if (runEffectInMonth.ContainsKey(month)) { List<objdata> mobj = runEffectInMonth[month]; List<objdata> vetolist = new List<objdata>(); List<objdata> novetolist = new List<objdata>(); foreach (objdata n in mobj) { if ("Quiz".Equals(n.Name) && eventnum == 4) { n.vetoAgain(); eventnum = 0; } if (n.Veto == true) { if (n.Runs > 0) vetolist.Add(n); } else { if (n.Runs > 0) novetolist.Add(n); } } vetolist.Sort(); novetolist.Sort(); if (vetolist.Count > 0) { ei = new EventItem(vetolist[0].Name, "random", date); vetolist[0].noMoreVeto(); } else if (novetolist.Count > 0) { ei = new EventItem(novetolist[0].Name, "random", date); novetolist[0].decRuns(); if (eventnum < 4) eventnum++; } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } num++; if (num == 3) { num = 0; } ei = new EventItem("Self", "random", date); // this is for debuging new events events.Add(date, new List<EventItem>()); events[date].Add(ei); } dt = dt.AddDays(1); date = string.Empty; } }
public void EasterYearTest(int year) { Easter holiday = new Easter(); Assert.AreEqual(year, holiday.GetByYear(year).Year); }