Beispiel #1
0
        private static void GetNextPos(string BibleName, int Chapter, out string outbible, out int chapter)
        {
            outbible = "종료";
            chapter  = 0;

            int CurrentMaxChapter = BibleInfo.GetChapterSize(BibleName);

            if (Chapter + 1 <= CurrentMaxChapter)
            {
                Chapter += 1;
                outbible = BibleName;
                chapter  = Chapter;
            }
            else
            {
                //다음 성경
                string NextBible  = BibleName;
                int    currentPos = 0;
                foreach (var bible in BibleInfo.List)
                {
                    if (bible.Name == BibleName)
                    {
                        break;
                    }

                    currentPos++;
                }

                if (BibleInfo.List.Count > currentPos + 1)
                {
                    outbible = BibleInfo.List[currentPos + 1].Name;
                    chapter  = 1;
                }
            }
        }
Beispiel #2
0
        //다음 성경 가져오기
        async void Handle_Clicked_Next(object sender, System.EventArgs e)
        {
            int CurrentMaxChapter = BibleInfo.GetChapterSize(User.CacheData.BibleName);

            if (User.CacheData.Chapter + 1 <= CurrentMaxChapter)
            {
                User.CacheData.Chapter += 1;

                RefreshData();
            }
            else
            {
                //다음 성경
                string NextBible  = User.CacheData.BibleName;
                int    currentPos = 0;
                foreach (var bible in BibleInfo.List)
                {
                    if (bible.Name == User.CacheData.BibleName)
                    {
                        break;
                    }

                    currentPos++;
                }

                if (BibleInfo.List.Count > currentPos + 1)
                {
                    User.CacheData.BibleName = BibleInfo.List[currentPos + 1].Name;
                    User.CacheData.Chapter   = 1;
                    User.CacheData.Verse     = 1;

                    RefreshData();
                }
            }
        }
Beispiel #3
0
        //이전 성경 가져오기
        async void Handle_Clicked_Prev(object sender, System.EventArgs e)
        {
            int CurrentMaxChapter = BibleInfo.GetChapterSize(User.CacheData.BibleName);

            //최소 1장보다 커야한다.
            if (User.CacheData.Chapter - 1 < 0)
            {
                User.CacheData.Chapter -= 1;

                RefreshData();
            }
            else
            {
                //다음 성경
                string NextBible  = User.CacheData.BibleName;
                int    currentPos = 0;
                foreach (var bible in BibleInfo.List)
                {
                    if (bible.Name == User.CacheData.BibleName)
                    {
                        break;
                    }

                    currentPos++;
                }

                if (0 <= (currentPos - 1) && User.CacheData.Chapter == 1)
                {
                    User.CacheData.BibleName = BibleInfo.List[currentPos - 1].Name;
                    User.CacheData.Chapter   = BibleInfo.GetChapterSize(User.CacheData.BibleName);
                    User.CacheData.Verse     = 1;
                }
                else
                {
                    int chapter = User.CacheData.Chapter - 1;
                    if (chapter < 1)
                    {
                        chapter = 1;
                    }

                    User.CacheData.BibleName = BibleInfo.List[currentPos].Name;
                    User.CacheData.Chapter   = chapter;
                    User.CacheData.Verse     = 1;
                }

                RefreshData();
            }
        }
Beispiel #4
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);
        }