public void AddItem(PurposeItem item) { lock (syncObject) { database.Database.Insert(item); } }
private void InsertDefaultForgets() { var forgetOne = new PurposeItem() { Content = "Stop wasting time on watching TV and scrolling on social networks.", Notes = "if you spend more than 4 hours a day on these, this is like a part time job.", Status = ItemStatus.Interesting, Type = ItemType.Forget }; var forgetTwo = new PurposeItem() { Content = "Stop comparing yourself with others.", Notes = "do not design your life based on others; make your own wishes and you will have the energy to touch the sky.", Status = ItemStatus.Wow, Type = ItemType.Forget }; var forgetThree = new PurposeItem() { Content = "Stop thinking about what others think about you.", Notes = "you do not have to explain yourself, just live the way you want.", Status = ItemStatus.Cool, Type = ItemType.Forget }; lock (Locker) { Database.Insert(forgetOne); Database.Insert(forgetTwo); Database.Insert(forgetThree); } }
private void InsertDefaultSuggestions() { var suggestionOne = new PurposeItem() { Content = "https://www.youtube.com/watch?v=KBChcaDqKyg", Notes = "everybody dies, but not everybody lives – I really like this short video.", Status = ItemStatus.Touching, Type = ItemType.Suggestion }; var suggestionTwo = new PurposeItem() { Content = "The alchemist, by Paulo Coehlo ", Notes = "a book about choosing the path in life, about faith and growing", Status = ItemStatus.Interesting, Type = ItemType.Suggestion }; var suggestionThree = new PurposeItem() { Content = "Thinking fast and slow, by Daniel Kahneman", Notes = "a book about the way our minds work, about why we think and do certain things; getting to better know yourself is a must in the process of evolution.", Status = ItemStatus.Interesting, Type = ItemType.Suggestion }; lock (Locker) { Database.Insert(suggestionOne); Database.Insert(suggestionTwo); Database.Insert(suggestionThree); } }
public void SaveItemClicked(object sender, EventArgs e) { var itemStatus = ItemStatus.Wow; switch (StatusPicker.SelectedIndex) { case 0: itemStatus = ItemStatus.Wow; break; case 1: itemStatus = ItemStatus.Interesting; break; case 2: itemStatus = ItemStatus.Cool; break; case 3: itemStatus = ItemStatus.ToRemember; break; case 4: itemStatus = ItemStatus.Touching; break; } var purposeItem = new PurposeItem() { Content = ContentText.Text, Notes = NotesText.Text, Status = itemStatus, Type = itemType }; var manageItems = new ManageItems(); if (item == null) { // new item manageItems.AddItem(purposeItem); } else { //edit item purposeItem.Id = item.Id; manageItems.UpdateItem(purposeItem); } RefreshItemsAction?.Invoke(); Navigation.PopAsync(); }
private void InsertDefaultQuestions() { var questionOne = new PurposeItem() { Content = "What would you do differently if you knew no one judges you?", Notes = "People that want to judge will judge you anyway.", Status = ItemStatus.ToRemember, Type = ItemType.Question }; var questionTwo = new PurposeItem() { Content = "What is the difference between being alive and truly living?", Notes = "define life", Status = ItemStatus.Cool, Type = ItemType.Question }; var questionThree = new PurposeItem() { Content = "If you win one million dollar, would you quit your job? How would your life be?", Notes = "do you think money stop you from archiving your dreams?", Status = ItemStatus.Wow, Type = ItemType.Question }; var questionFour = new PurposeItem() { Content = "What single advice would you give to a new baby born? ", Notes = "it is so important to always remember…", Status = ItemStatus.Interesting, Type = ItemType.Question }; var questionFive = new PurposeItem() { Content = "How important is the word “must” in your life? ", Notes = "you must do the things this way, you must be nice, you must….", Status = ItemStatus.Touching, Type = ItemType.Question }; lock (Locker) { Database.Insert(questionOne); Database.Insert(questionTwo); Database.Insert(questionThree); Database.Insert(questionFour); Database.Insert(questionFive); } }
public void UpdateItem(PurposeItem item) { lock (syncObject) { var itemToUpdate = database.Database.Table <PurposeItem>().FirstOrDefault(i => i.Id == item.Id); if (itemToUpdate != null) { itemToUpdate.Content = item.Content; itemToUpdate.Notes = item.Notes; itemToUpdate.Status = item.Status; database.Database.Update(itemToUpdate); } } }
private void InsertDefaultQuotes() { var quoteOne = new PurposeItem() { Content = "All our dreams can come true if we have the courage to pursue them.", Notes = "have perseverance", Status = ItemStatus.Cool, Type = ItemType.Quote }; var quoteTwo = new PurposeItem() { Content = "Every great dream begins with a dreamer. Always remember: you have within yourself the strength, the patience and the passion to reach for the stars to change the world.", Notes = "just have faith", Status = ItemStatus.ToRemember, Type = ItemType.Quote }; lock (Locker) { Database.Insert(quoteOne); Database.Insert(quoteTwo); } }