Ejemplo n.º 1
0
        public void RefreshData()
        {
            int idInc = 0;

            if (LoadInfo.Count == 0)
            {
                foreach (var data in BibleInfo.ListOldTestament)
                {
                    BibleTableInfo info = new BibleTableInfo();

                    info.Id             = idInc++;
                    info.Name           = data;
                    info.MaxChapterSize = BibleInfo.GetChapterSize(data);

                    LoadInfo.Add(info);
                }

                foreach (var data in BibleInfo.ListNewTestament)
                {
                    BibleTableInfo info = new BibleTableInfo();

                    info.Id             = idInc++;
                    info.Name           = data;
                    info.MaxChapterSize = BibleInfo.GetChapterSize(data);

                    LoadInfo.Add(info);
                }
            }

            listView.ItemsSource = LoadInfo;

            listView.ItemSelected += OnItemSelected;

            var plan = SQLLiteDB.ReadBibleReadPlan();

            if (plan != null)
            {
                ReadChapterCount.Text = plan.Count.ToString();

                var search = LoadInfo.Find(e => e.Name == plan.BibleName);
                if (search != null)
                {
                    listView.SelectedItem = search;
                    listView.TabIndex     = search.Id;
                }

                StartTime.Date = plan.StartTime;


                ShowInfomation(StartTime.Date, plan.Count);
            }
        }
Ejemplo n.º 2
0
        private void LoadCacheUserData()
        {
            try
            {
                SQLLiteDB.LoadCacheData();

                //성경 읽기계획이 없는 경우 디폴트로 분당에서 하는 것으로 설정한다.
                var plan = SQLLiteDB.ReadBibleReadPlan();
                if (plan == null)
                {
                    DateTime StartTime = new DateTime(2020, 1, 13);
                    SQLLiteDB.InsertBibleReadPlan(StartTime.Date, "마태복음", 1);
                }
            }
            catch (Exception e)
            {
#if DEBUG
                CrossLocalNotifications.Current.Show("SQLLiteDB.LoadCacheData Failded", DateTime.Now.ToString(), 0, DateTime.Now);
#endif
            }
        }
Ejemplo n.º 3
0
        private MyPosToBibleRead CalculateTodayBibleChapter(int addDay = 0)
        {
            MyPosToBibleRead readpos = new MyPosToBibleRead();

            var data = SQLLiteDB.ReadBibleReadPlan();

            if (data == null)
            {
                return(null);
            }

            DateTime BeginTime = data.StartTime;

            DateTime MondayTime = WeekDateTime(DateTime.Now, DayOfWeek.Monday);

            MondayTime = MondayTime.AddDays(addDay);

            if (data.StartTime > MondayTime)
            {
                return(null);
            }

            int DiffDay = (MondayTime - BeginTime).Days;

            var search = BibleInfo.List.Find(e => e.Name == data.BibleName);

            if (search == null)
            {
                return(null);
            }

            int accChapterSize = 0;

            foreach (var bible in BibleInfo.List)
            {
                if (search.Id > bible.Id)
                {
                    continue;
                }


                int chapter = BibleInfo.GetChapterSize(bible.Name);

                int currChapter = DiffDay * data.Count;
                accChapterSize += chapter;


                if (currChapter + 1 <= accChapterSize)
                {
                    readpos.begin_bibleName = bible.Name;
                    readpos.begin_chapter   = Math.Abs((accChapterSize - currChapter) - chapter) + 1;

                    string outbible   = "";
                    int    outchapter = 1;

                    string inbible   = readpos.begin_bibleName;
                    int    inchapter = readpos.begin_chapter;

                    for (int i = 0; i < data.Count - 1; i++)
                    {
                        GetNextPos(inbible, inchapter, out outbible, out outchapter);

                        inbible   = outbible;
                        inchapter = outchapter;
                    }

                    readpos.end_bibleName = outbible;
                    readpos.end_chapter   = outchapter;
                    break;
                }
            }

            return(readpos);
        }