Exemplo n.º 1
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)
            {
            }
        }
Exemplo n.º 2
0
        //ui 갱신
        public void RefreshData()
        {
            Title = User.CacheData.BibleName + " " + User.CacheData.Chapter.ToString() + "장  KRV";

            var MainLayout = new StackLayout {
                Padding = new Thickness(5, 10)
            };

            DrawTopButton(MainLayout);
            DrawMainText(MainLayout);
            DrawBottomButton(MainLayout);

            SQLLiteDB.Upsert(User.CacheData);

            ScrollView scrollView = new ScrollView();

            scrollView.Content = MainLayout;

            Content = scrollView;
            GotoFocusLabel(scrollView, User.CacheData.Verse);
        }
Exemplo n.º 3
0
        static public void LoadCacheData()
        {
            var UserCacheData = SQLLiteDB.ReadUserCache();

            if (UserCacheData != null)
            {
                User.CacheData.FontSize  = UserCacheData.FontSize;
                User.CacheData.BibleName = UserCacheData.BibleName;
                User.CacheData.Chapter   = UserCacheData.Chapter;
                User.CacheData.Verse     = UserCacheData.Verse;
                User.CacheData.UserName  = UserCacheData.UserName;
                User.CacheData.Passwd    = UserCacheData.Passwd;
            }
            else
            {
                User.CacheData.BibleName = "창세기";
                User.CacheData.Chapter   = 1;
                User.CacheData.Verse     = 1;
                User.CacheData.FontSize  = 20;
                User.CacheData.EnalbeKJV = true;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
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);
        }