private void favorit_Click(object sender, EventArgs e) { // Add/Remove from favorits. depending on situation and change text on menu item accordinlgy ApplicationBarMenuItem mi = ApplicationBar.MenuItems[1] as ApplicationBarMenuItem; if (mi == null) { return; } if (StoryRepository.CheckStoryTitle(value.post.title)) { if (StoryRepository.RemoveStory(value.post.title)) { mi.Text = AddToFavoritsString; } } else { if (StoryRepository.AddNewStory(value.post.title, DateTime.Parse(value.post.date), value.post.url, value.post.content, null) > 0) { mi.Text = RemoveFromFavoritsString; } } }
private void favorit_Click(object sender, EventArgs e) { // Add/Remove from favorits. depending on situation and change text on menu item accordinlgy ApplicationBarMenuItem mi = ApplicationBar.MenuItems[1] as ApplicationBarMenuItem; if (mi == null) { return; } if (StoryRepository.CheckStoryTitle(value.post.title, true)) { if (StoryRepository.RemoveStory(value.post.title, true)) { mi.Text = AddToFavoritsString; } } else { StoryRepository.RemoveStory(value.post.title, true); if (StoryRepository.AddNewStory(value.post.title, value.post.date != null ? DateTime.Parse(value.post.date) : DateTime.Now, value.post.url, value.post.content, true, null) > 0) { Microsoft.Devices.VibrateController.Default.Start(TimeSpan.FromMilliseconds(50)); mi.Text = RemoveFromFavoritsString; } } }
public bool RemoveFavorite(Story story) { if (StoryRepository.RemoveStory(story)) { Favorits.Remove(story); return(true); } return(false); }
public bool AddFavorite(string title, DateTime publishedDate, string link, string details) { try { StoryRepository.RemoveStory(title, true); StoryRepository.AddNewStory(title, publishedDate, link, details, true, StoreFavorit); Microsoft.Devices.VibrateController.Default.Start(TimeSpan.FromMilliseconds(50)); return(true); } catch (Exception e) { } return(false); }