コード例 #1
0
        static public int GetChapterSize(string name, BibleType type = BibleType.KRV)
        {
            if (bible.ContainsKey(type) == false)
            {
                bible[type] = new Dictionary <string, Dictionary <int, Dictionary <int, string> > >();
            }

            if (bible[type].ContainsKey(name) == false)
            {
                bible[type][name] = new Dictionary <int, Dictionary <int, string> >();
            }

            return(bible[type][name].Count);
        }
コード例 #2
0
        //성경 본문 가져오기 이름,장,절
        static public string GetContextText(BibleType type, string name, int chapter, int verse)
        {
            if (bible.ContainsKey(type) == false)
            {
                bible[type] = new Dictionary <string, Dictionary <int, Dictionary <int, string> > >();
            }

            if (bible[type].ContainsKey(name) == false)
            {
                bible[type][name] = new Dictionary <int, Dictionary <int, string> >();
            }

            if (bible[type][name].ContainsKey(chapter) == false)
            {
                bible[type][name][chapter] = new Dictionary <int, string>();
            }

            if (bible[type][name][chapter].ContainsKey(verse) == false)
            {
                bible[type][name][chapter][verse] = "";
            }

            return(bible[type][name][chapter][verse]);
        }
コード例 #3
0
        static public void Upsert(BibleType type, string name, int chapter, int verse, string context)
        {
            if (bible.ContainsKey(type) == false)
            {
                bible[type] = new Dictionary <string, Dictionary <int, Dictionary <int, string> > >();
            }

            if (bible[type].ContainsKey(name) == false)
            {
                bible[type][name] = new Dictionary <int, Dictionary <int, string> >();
            }

            if (bible[type][name].ContainsKey(chapter) == false)
            {
                bible[type][name][chapter] = new Dictionary <int, string>();
            }

            if (bible[type][name][chapter].ContainsKey(verse) == false)
            {
                bible[type][name][chapter][verse] = "";
            }

            bible[type][name][chapter][verse] += context;
        }
コード例 #4
0
ファイル: BibleView.cs プロジェクト: blessnhs/blessnhs
        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);
        }
コード例 #5
0
ファイル: BibleView.cs プロジェクト: blessnhs/blessnhs
 public void DrawMainText(StackLayout MainLayout, BibleType type = BibleType.KRV)
コード例 #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);
        }