private void favoriList_SelectionChanged(object sender, SelectionChangedEventArgs e) { FavoriData drv = (FavoriData)favoriList.SelectedItem; if (drv != null) { if (drv.IsTopic == "Visible") { NavigationService.Navigate(new Uri("/forum/ForumPost.xaml?sforum_id= " + drv.sforumID + "&topic_id=" + drv.topicID, UriKind.Relative)); } else if (drv.IsTopic == "Collapsed" && drv.sforumID != "0") { NavigationService.Navigate(new Uri("/forum/ForumTopic.xaml?sforum_id=" + drv.sforumID, UriKind.Relative)); } } favoriList.SelectedIndex = -1; }
private void unfavori_Click(object sender, RoutedEventArgs e) { FavoriData drv = (sender as MenuItem).DataContext as FavoriData; if (drv != null) { if (drv.IsTopic == "Visible") { string delete_this = classes.General.ReadFavori("fav_topic.txt").Replace(drv.sforumID + "|" + drv.topicID + "|" + drv.topicTitle + "|" + drv.topicAuthorInfo + "|" + drv.topicAuthorAvatar + "#", ""); classes.General.WriteFavori("fav_topic.txt", delete_this); } else if (drv.IsTopic == "Collapsed" && drv.sforumID != "0") { string delete_this = classes.General.ReadFavori("fav_forum.txt").Replace(drv.sforumID + "|" + drv.topicTitle + "#", ""); classes.General.WriteFavori("fav_forum.txt", delete_this); } ds.Clear(); GetFavori(); } }