Ejemplo n.º 1
0
        private void UpdateMemorizableInDatabase()
        {
            var path = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var db   = new DatabaseHelper(path);

            db.UpdateVerse(verse);
        }
Ejemplo n.º 2
0
        public VersesTableSource(UIViewController managingController)
        {
            VERSE_CELL         = new NSString("VERSE_CELL");
            Verses             = new Dictionary <string, List <Verse> > ();
            ManagingController = managingController;

            var path       = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var tempVerses = new List <Verse> ();

            var helper = new DatabaseHelper(path);

            tempVerses = helper.GetVerses().ToList();
            tempVerses.Sort();

            foreach (var verse in tempVerses)
            {
                ProcessKey(verse);
            }

            Keys = Verses.Keys.ToArray();

            foreach (var key in Keys)
            {
                if (Verses[key].Count == 0)
                {
                    Verses.Remove(key);
                }
            }

            Keys = Verses.Keys.ToArray();
        }
Ejemplo n.º 3
0
        private void HandleMemorizedTapped()
        {
            var data = Front.Data;
            var path = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var db   = new DatabaseHelper(path);

            data.Memorized = !data.Memorized;
            if (data.Memorized)
            {
                data.Category = MemorizationCategory.Review;

                Front.ImageView.Image = MemorizedImage;
                Back.ImageView.Image  = MemorizedImage;
            }
            else
            {
                if (data.Category == MemorizationCategory.Review)
                {
                    data.Category = MemorizationCategory.Queue;
                }

                Front.ImageView.Image = NotMemorizedImage;
                Back.ImageView.Image  = NotMemorizedImage;
            }

            db.UpdateVerse(data);

            LocalyticsSession.Shared.TagEvent("Verse Memorized");
        }
Ejemplo n.º 4
0
        void ButtonHandler(MemorizationCategory category)
        {
            var path   = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var db     = new DatabaseHelper(path);
            var verses = db.GetVerses().ToList();

            NavigationController.PushViewController(new MemorizationDialogViewController(verses, category), true);
        }
Ejemplo n.º 5
0
            void DeleteVerse()
            {
                var path = DatabaseSetupHelper.GetDatabasePath("verses.db3");
                var db   = new DatabaseHelper(path);

                db.RemoveVerse(verse);

                controller.NavigationController.PopViewControllerAnimated(true);
            }
Ejemplo n.º 6
0
        private void SaveButtonClicked()
        {
            Verse.Comments = VerseComments.Text;

            var path = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var db   = new DatabaseHelper(path);

            db.UpdateVerse(Verse);

            LocalyticsSession.Shared.TagEvent("Edited Verse");
        }
Ejemplo n.º 7
0
        private void SaveButtonClicked()
        {
            prayer.Title   = PrayerTitle.Text;
            prayer.Content = PrayerContent.Text;

            var path = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var db   = new DatabaseHelper(path);

            db.UpdatePrayer(prayer);

            LocalyticsSession.Shared.TagEvent("Edited Prayer");
        }
Ejemplo n.º 8
0
        private async void SaveButtonClicked()
        {
            if (VerseReference.Text != "")
            {
                var verse = new Verse {
                    Category    = MemorizationCategory.Queue,
                    Content     = "Verse downloading...",
                    Memorizable = true,
                    Memorized   = false,
                    Timestamp   = DateTime.Now,
                    Title       = VerseReference.Text,
                    Comments    = VerseComments.Text == "Comments" ? "" : VerseComments.Text
                };

                TranslationHelper.AddVerseTranslation(verse);

                if (Reachability.IsHostReachable("www.google.com"))
                {
                    var path        = DatabaseSetupHelper.GetDatabasePath("verses.db3");
                    var db          = new DatabaseHelper(path);
                    var translation = TranslationHelper.GetCurrentTranslationForDownload();

                    try {
                        UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
                        verse.Content = await BiblesDotOrg.GetVerseTextWithoutHtmlOrDigitsAsync(VerseReference.Text, translation);

                        db.AddVerse(verse);
                        LocalyticsSession.Shared.TagEvent("Verse Saved");
                    } catch (InvalidVerseException ex) {
                        Console.WriteLine(ex);
                        new UIAlertView("Invalid Input", "Oops! That verse was not found!", null, "Okay", null).Show();
                    } finally {
                        UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
                    }

                    ManagingController.ViewDidAppear(true);
                    ManagingController.VersesTable.ReloadData();
                }
                else
                {
                    new UIAlertView("Network Failure", "Oops! Please connect to the internet to download verses.", null, "Okay", null).Show();
                }
            }
            else
            {
                new UIAlertView("Invalid Input", "Oops! Don't forget to add a verse reference!", null, "Okay", null).Show();
            }
        }
Ejemplo n.º 9
0
        private void UpdateMemorizedInDatabase()
        {
            var path = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var db   = new DatabaseHelper(path);

            var memorized = verse.Memorized;

            if (memorized)
            {
                verse.Category = MemorizationCategory.Review;
            }
            else if ((!memorized) && verse.Category == MemorizationCategory.Review)
            {
                verse.Category = MemorizationCategory.Queue;
            }

            db.UpdateVerse(verse);
        }
Ejemplo n.º 10
0
        private void SaveButtonClicked()
        {
            if (!(PrayerContent.Text == "" || PrayerTitle.Text == ""))
            {
                var prayer = new Prayer {
                    Title     = PrayerTitle.Text,
                    Content   = PrayerContent.Text,
                    Timestamp = NSDate.Now
                };

                var path = DatabaseSetupHelper.GetDatabasePath("verses.db3");
                var db   = new DatabaseHelper(path);
                db.AddPrayer(prayer);

                DismissViewController(true, null);
            }
            else
            {
                new UIAlertView("Invalid Input", "Add additional information to your prayer!", null, "Okay", null).Show();
            }
        }
Ejemplo n.º 11
0
        public PrayersTableSource(UIViewController managingController)
        {
            PRAYER_CELL        = new NSString("PRAYER_CELL");
            prayers            = new Dictionary <string, List <Prayer> > ();
            ManagingController = managingController;

            var path        = DatabaseSetupHelper.GetDatabasePath("verses.db3");
            var tempPrayers = new List <Prayer> ();

            var helper = new DatabaseHelper(path);

            tempPrayers = helper.GetPrayers().ToList();
            tempPrayers.Sort();

            foreach (var prayer in tempPrayers)
            {
                ProcessKey(prayer);
            }

            Keys = prayers.Keys.ToArray();
        }
Ejemplo n.º 12
0
            void MoveVerseToCategory(MemorizationCategory category)
            {
                var elements = section.Elements;

                foreach (MemorizationElement element in elements)
                {
                    var verse = element.VerseForElement;

                    if (element.ElementIsSelected && verse.Category != category)
                    {
                        verse.Category = category;

                        if (category == MemorizationCategory.Review)
                        {
                            verse.Memorized = true;
                        }

                        var dbPath = DatabaseSetupHelper.GetDatabasePath("verses.db3");
                        var db     = new DatabaseHelper(dbPath);
                        db.UpdateVerse(verse);
                    }
                }
            }