private void PostThought(string caption, bool saveToFile) { if (string.IsNullOrEmpty(caption)) { return; } Message message = new Message { ID = Guid.NewGuid(), Caption = caption, CreatedAt = DateTime.Now, ReviewedAt = DateTime.Now, Status = Status.Active, Subject = this.Subject }; ActiveThoughts.Add(message); if (saveToFile) { ActiveThoughts.Insert(0, message); messageRepository.SaveThoughts(ActiveThoughts); } PendingThought = string.Empty; RaiseUpdate("PendingThought"); RaiseUpdate("ActiveThoughts"); }
private void timer_Elapsed(object sender, ElapsedEventArgs e) { ApplicationSession.Invoker.BeginInvoke(new Action(() => { if (ActiveThoughts.Count == 0) { return; } if (ReviewSession != null) { ReviewSession.RepostCurrent(); } Message message = ActiveThoughts[ActiveThoughts.Count - 1]; ActiveThoughts.Remove(message); RaiseUpdate("ActiveThoughts"); StaleThoughts.Add(message); RaiseUpdate("StaleThoughts"); ReviewSession = new MessageReviewSession(message, result => { if (result.Status == Status.Active) { ActiveThoughts.Insert(0, result); RaiseUpdate("ActiveThoughts"); } ReviewSession = null; RaiseUpdate("ReviewSession"); }); RaiseUpdate("ReviewSession"); }), null); }