Пример #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
        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);
            }
        }
Пример #3
0
        void btn_Clicked(object sender, EventArgs e)
        {
            Button evtButton = sender as Button;

            User.CacheData.Chapter = Convert.ToInt32(evtButton.Text);

            var parentPage = this.Parent as TabbedPage;

            int MaxVerse = BibleInfo.GetVerseSize(User.CacheData.BibleName, User.CacheData.Chapter);

            parentPage.Children[2] = new Verse(MaxVerse);

            parentPage.CurrentPage = parentPage.Children[2];
        }
Пример #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)
                    {
#if GLOBAL
                        var contexttext = BibleInfo.GetContextText(BibleType.KJV, data.BibleName, data.Chapter, data.Verse);
#else
                        var contexttext = BibleInfo.GetContextText(BibleType.KRV, data.BibleName, data.Chapter, data.Verse);
#endif


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

#if GLOBAL
                        var text = data.BibleName + " " + data.Chapter + " Chapter" + " " + data.Verse + "Verse \n" + line;
#else
                        var text = data.BibleName + " " + data.Chapter + " 장" + " " + data.Verse + "절 \n" + line;
#endif
                        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
        void Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
        {
            //선택된 아이템을 Contact 타입으로 변환
            var contact = e.SelectedItem as BibleTableInfo;

            User.CacheData.BibleName = contact.Name;

            var parentPage = this.Parent as TabbedPage;

            int MaxChapterSize = BibleInfo.GetChapterSize(contact.Name);

            parentPage.Children[1] = new Chapter(MaxChapterSize);

            parentPage.CurrentPage = parentPage.Children[1];
        }
Пример #6
0
 private void LoadResourceData()
 {
     try
     {
         BibleInfo.LoadKRV();
         BibleInfo.LoadKJV();
         Dic.LoadDic();
         Hymn.LoadList();
         //BibleInfo.LoadNIV();
         //BibleInfo.CheckValidate();
     }
     catch (Exception e)
     {
     }
 }
Пример #7
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();
            }
        }
Пример #8
0
        private void LoadResourceData()
        {
            try
            {
                BibleInfo.LoadKRV();
                BibleInfo.LoadKJV();
                Dic.LoadDic();
                Hymn.LoadList();
                //BibleInfo.LoadNIV();
                //BibleInfo.CheckValidate();
            }
            catch (Exception e)
            {
#if DEBUG
                CrossLocalNotifications.Current.Show("SQLLiteDB.LoadKRV Failded", DateTime.Now.ToString(), 0, DateTime.Now);
#endif
            }
        }
Пример #9
0
        public BibleList(BibleSplite _type)
        {
            InitializeComponent();

            var assembly = IntrospectionExtensions.GetTypeInfo(typeof(BibleList)).Assembly;

            List <BibleTableInfo> LoadInfo = new List <BibleTableInfo>();
            int idInc = 0;

            if (_type == BibleSplite.NewTestament)
            {
                foreach (var data in BibleInfo.ListNewTestament)
                {
                    BibleTableInfo info = new BibleTableInfo();

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

                    LoadInfo.Add(info);
                }
            }
            else
            {
                foreach (var data in BibleInfo.ListOldTestament)
                {
                    BibleTableInfo info = new BibleTableInfo();

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

                    LoadInfo.Add(info);
                }
            }

            listView.ItemsSource = LoadInfo;
        }
Пример #10
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;

                User.CacheData.Verse = 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();
                }
            }
        }
Пример #11
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);
        }
Пример #12
0
        public void DrawMainText(StackLayout MainLayout, BibleType type = BibleType.KRV)
#endif
        {
            //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
                    //{
                    //    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 App.Current.MainPage.DisplayAlert("Help", context, "OK");
                    //}
                    //catch (Exception)
                    //{

                    //}
                };

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

                    try
                    {
                        string action = await App.Current.MainPage.DisplayActionSheet("Line", "cancel", null, "red", "yellow", "blue");

                        //선택한 라벨의 절수를 가져온다.
                        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 "red":
                            labelText.BackgroundColor = Color.Red;
                            SQLLiteDB.InsertUnderlining(User.CacheData.BibleName, User.CacheData.Chapter, iverse, "빨강");
                            break;

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

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

                        case "cancel":
                            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);
                }
            }


            var LabelEndLine0 = new Label {
                Text = "", FontSize = User.CacheData.FontSize, LineBreakMode = LineBreakMode.WordWrap, TextColor = Xamarin.Forms.Color.FromRgb(0, 0, 0), HorizontalTextAlignment = TextAlignment.Center
            };

            TextLayout.Children.Add(LabelEndLine0);

            var LabelEndLine1 = new Label {
                Text = "성경전서 개역한글판의 저작권은", FontSize = User.CacheData.FontSize, LineBreakMode = LineBreakMode.WordWrap, TextColor = Xamarin.Forms.Color.FromRgb(0, 0, 0), HorizontalTextAlignment = TextAlignment.Center
            };

            TextLayout.Children.Add(LabelEndLine1);

            var LabelEndLine2 = new Label {
                Text = "( 재 ) 대한성서공회에 있습니다", FontSize = User.CacheData.FontSize, LineBreakMode = LineBreakMode.WordWrap, TextColor = Xamarin.Forms.Color.FromRgb(0, 0, 0), HorizontalTextAlignment = TextAlignment.Center
            };

            TextLayout.Children.Add(LabelEndLine2);

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

            TextLayout.Children.Add(LabelEndLine3);


            MainLayout.Children.Add(TextLayout);
        }