Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
        private void GeneratePlacesForDates(DateTime startDate, DateTime endDate)
        {
            try
            {
                string            htmlText          = "";
                DominicanCalender dominicanCalender = FreshIOC.Container.Resolve <IDominicanCalender>() as DominicanCalender;
                DateTime          date = startDate;
                while (date <= endDate)
                {
                    Place place = dominicanCalender.FindPlace(date);
                    htmlText += "<br/>" + date.ToString(_dateTimeFormat) + "&nbsp- &nbsp;" + place.ToString() + "&nbsp- &nbsp;" + date.ToString("ddd");

                    date = date.AddHours(12);
                }

                WriteFile("Places", startDate, endDate, htmlText);
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"GeneratePlaces exception: {ex.StackTrace}");
                WriteErrorFile("GeneratePlaces", ex);
            }
        }