protected override void OnNavigatedTo(NavigationEventArgs e) { string sStory, sComment; if (NavigationContext.QueryString.TryGetValue("Story", out sStory)) { _story = int.Parse(sStory); } else { _story = 10; } if (NavigationContext.QueryString.TryGetValue("Comment", out sComment)) { _comment = int.Parse(sComment); _thread = CoreServices.Instance.GetCommentThread(_comment); if (_thread == null || _thread.RootComment.Count == 0) { _thread = new CommentThread(_comment, _story); _thread.PropertyChanged += ThreadCreated; ProgressBar.Visibility = Visibility.Visible; } else { _comment = CoreServices.Instance.GetSelectedComment(); staticLoad = true; } CommentsList.DataContext = _thread; } }
public void LoadCurrentCommentThread() { try { DataContractSerializer ser = new DataContractSerializer(typeof(CommentThread)); using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream("currentcommentthread.txt", FileMode.Open, isf)) { _commentThread = ser.ReadObject(stream) as CommentThread; } } using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream("currentselectedcomment.txt", FileMode.Open, isf)) { StreamReader sr = new StreamReader(stream); _selectedComment = int.Parse(sr.ReadLine()); sr.Close(); } } } catch { } }
public void AddCommentThread(int comment, CommentThread thread) { _selectedComment = comment; _commentThread = thread; }