Exemple #1
0
        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);
        }
        public override void Init(object initData)
        {
            Debug.WriteLine("PrayerPageModel.Init()");
            base.Init(initData);

            try
            {
                _prayerModel       = FreshIOC.Container.Resolve <IPrayerModel>() as PrayerModel;
                _dominicanCalender = FreshIOC.Container.Resolve <IDominicanCalender>() as DominicanCalender;

                if (initData is null)
                {
                    return;
                }

                // get date time passed in
                string[] data = (initData as string).Split(' ');
                if (data.Length != 2)
                {
                    return;                                                         // WTF !!!
                }
                string stringDate = data[0] + " " + data[1];
                _date = DateTime.ParseExact(stringDate, "yyyyMMdd HH:mm", CultureInfo.CurrentCulture);

                _fontIncrement   = (Device.Idiom == TargetIdiom.Phone) ? 4 : 8;
                _htmlEndTemplate = PrayerSeason.LoadEndHtml();

                if (Application.Current.Properties.ContainsKey("FontSize"))
                {
                    _fontSize = (int)Application.Current.Properties["FontSize"];
                    if (_fontSize < 1)
                    {
                        _fontSize = 12;
                    }
                }
                else
                {   // first time thru or they haven't updated the font size yet
                    _fontSize = (Device.Idiom == TargetIdiom.Phone) ? 16 : 20;
                }
                _htmlStart = string.Format(_htmlStartTemplate, _fontSize);
                _htmlEnd   = string.Format(_htmlEndTemplate, _fontSize);

                DisplayPrayer(_date);
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"PrayerPageModel.Init() - Error: {ex.Message}\n{ex.InnerException}");
            }
            Debug.WriteLine("PrayerPageModel.Init() - FIN");
        }