コード例 #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;
                }
            }
        }
コード例 #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();
                }
            }
        }
コード例 #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();
            }
        }
コード例 #4
0
        private void AddMarkWord()
        {
            try
            {
                Helper.RemoveRowGrid(main_grid, UnderliningPos);

                var list = SQLLiteDB.ReadUnderlining();
                if (list != null)
                {
                    int startpos = UnderliningPos;
                    foreach (var data in list)
                    {
                        var contexttext = BibleInfo.GetContextText(BibleType.KRV, data.BibleName, data.Chapter, data.Verse);

                        int    __verse;
                        string line;
                        Helper.SpliteVerseText(contexttext, out __verse, out line);

                        var text = data.BibleName + " " + data.Chapter + " 장" + " " + data.Verse + "절 \n" + line;

                        var labelText = new Label {
                            Text = text, LineBreakMode = LineBreakMode.WordWrap, TextColor = Xamarin.Forms.Color.FromRgb(0, 0, 0)
                        };

                        var stackLayout = new StackLayout();

                        stackLayout.Children.Add(labelText);
                        var frame = new Frame {
                            BorderColor = Color.Black, Padding = new Thickness(3, 3, 3, 3)
                        };
                        frame.Content = stackLayout;

                        main_grid.Children.Add(frame, 0, startpos++);
                        Grid.SetColumnSpan(frame, 2);
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
コード例 #5
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);
        }
コード例 #6
0
        public void DrawMainText(StackLayout MainLayout, BibleType type = BibleType.KRV)
        {
            //db에 밑줄 저장 데이터가 있는지 로딩한다.
            var list = SQLLiteDB.ReadUnderlining();

            MainTextLabel.Clear();

            var TextLayout = new StackLayout {
                Orientation = StackOrientation.Vertical, Spacing = 5
            };
            int verseSize    = BibleInfo.GetVerseSize(User.CacheData.BibleName, User.CacheData.Chapter);
            int verseSizeEng = BibleInfo.GetVerseSize(User.CacheData.BibleName, User.CacheData.Chapter, BibleType.KJV);

            int size = verseSize > verseSizeEng ? verseSize : verseSizeEng;

            for (int i = 1; i <= size; i++)
            {
                string Text = BibleInfo.GetContextText(type, User.CacheData.BibleName, User.CacheData.Chapter, i);

                string TextEnglish = BibleInfo.GetContextText(BibleType.KJV, User.CacheData.BibleName, User.CacheData.Chapter, i);

                var Label = new Label {
                    Text = Text, FontSize = User.CacheData.FontSize, LineBreakMode = LineBreakMode.WordWrap, TextColor = Xamarin.Forms.Color.FromRgb(0, 0, 0)
                };
                var LabelEnglish = new Label {
                    Text = TextEnglish, FontSize = User.CacheData.FontSize, LineBreakMode = LineBreakMode.WordWrap, TextColor = Xamarin.Forms.Color.FromRgb(0, 0, 0)
                };

                //SQL DB에 저장되어 있는 데이터가 존재하면 해당 색으로 배경을 변경한다.
                CheckUnderLine(list, Label, i);

                //자동이동을 위해 따로 저장한다.
                MainTextLabel[i] = Label;

                // Your label tap event
                var englishlabeltab = new TapGestureRecognizer();
                englishlabeltab.Tapped += async(s, e) =>
                {
                    try
                    {
                        if (User.Username != "강병욱")
                        {
                            return;
                        }

                        var labelText = s as Label;

                        string Context = labelText.Text;

                        string[] words = Context.Split(' ');

                        Dictionary <string, string> help = new Dictionary <string, string>();
                        if (words != null || words.Length > 0)
                        {
                            for (int k = 0; k < words.Length; k++)
                            {
                                words[k] = words[k].ToLower();
                                string outstr;
                                if (Dic._dictionary.TryGetValue(words[k], out outstr) == true)
                                {
                                    help[words[k]] = outstr;
                                }
                                else
                                {
                                    if (words[k].Length > 3)
                                    {
                                        //끝에 하나버림
                                        string sub1 = words[k].Substring(0, words[k].Length - 1);
                                        if (Dic._dictionary.TryGetValue(sub1, out outstr) == true)
                                        {
                                            help[sub1] = outstr;
                                        }
                                        else
                                        {
                                            //끝에 두개버림
                                            sub1 = words[k].Substring(0, words[k].Length - 2);
                                            if (Dic._dictionary.TryGetValue(sub1, out outstr) == true)
                                            {
                                                help[sub1] = outstr;
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        string context = "";
                        foreach (var str in help)
                        {
                            context += str.Key;
                            context += " : ";
                            context += str.Value;
                            context += "\n\n";
                        }

                        await DisplayAlert("Help", context, "OK");
                    }
                    catch (Exception)
                    {
                    }
                };

                var labeltab = new TapGestureRecognizer();
                labeltab.Tapped += async(s, e) =>
                {
                    var labelText = s as Label;

                    try
                    {
                        string action = await DisplayActionSheet("줄긋기", "안하기", null, "빨강", "노랑", "파랑");

                        //선택한 라벨의 절수를 가져온다.
                        int    iverse = 1;
                        string verse  = labelText.Text;
                        if (verse != null)
                        {
                            string[] header = verse.Split(' ');
                            if (header.Length > 0)
                            {
                                iverse = Convert.ToInt32(header[0]);
                            }
                        }

                        switch (action)
                        {
                        case "빨강":
                            labelText.BackgroundColor = Color.Red;
                            SQLLiteDB.InsertUnderlining(User.CacheData.BibleName, User.CacheData.Chapter, iverse, "빨강");
                            break;

                        case "노랑":
                            labelText.BackgroundColor = Color.Yellow;
                            SQLLiteDB.InsertUnderlining(User.CacheData.BibleName, User.CacheData.Chapter, iverse, "노랑");
                            break;

                        case "파랑":
                            labelText.BackgroundColor = Color.Green;
                            SQLLiteDB.InsertUnderlining(User.CacheData.BibleName, User.CacheData.Chapter, iverse, "파랑");
                            break;

                        case "안하기":
                            labelText.BackgroundColor = Color.White;
                            SQLLiteDB.DeleteUnderlining(User.CacheData.BibleName, User.CacheData.Chapter, iverse, "");
                            break;
                        }
                    }
                    catch (Exception)
                    {
                    }
                };

                Label.GestureRecognizers.Add(labeltab);
                LabelEnglish.GestureRecognizers.Add(englishlabeltab);

                TextLayout.Children.Add(Label);

                if (User.CacheData.EnalbeKJV == true)
                {
                    TextLayout.Children.Add(LabelEnglish);
                }
            }
            MainLayout.Children.Add(TextLayout);
        }