public PrivateCenter3(UISharedRTClient sharedClient, Main.OnDiscFrmClosing closing) { InitializeComponent(); _closing = closing; _sharedClient = sharedClient; theBadge.Hide(); PrivateCenterCtx.DropContext(); TimingCtx.Drop(); SetListeners(true); Title2 = string.Format("{0} on {1} - private dashboard", SessionInfo.Get().person.Name, SessionInfo.Get().discussion.Subject); lstTopics.ItemsSource = TopicsOfDiscussion; lstPoints.ItemsSource = OwnArgPoints; lstOtherUsers.ItemsSource = OtherUsers; lstBadgesOfOtherUser.ItemsSource = ArgPointsOfOtherUser; lblWelcome.Content = SessionInfo.Get().person.Name; _commentDismissalRecognizer = new CommentDismissalRecognizer(bigBadgeScroller, OnDismiss); theBadge.CommentDismissalRecognizer = _commentDismissalRecognizer; initializing = true; DiscussionSelectionChanged(); initializing = false; }
private void UpdatePointsOfTopic(Topic t) { OwnArgPoints.Clear(); if (t == null) { theBadge.RemoveFocusFromInputControls(); theBadge.DataContext = null; return; } int selfId = SessionInfo.Get().person.Id; foreach (var ap in t.ArgPoint.Where(ap0 => ap0.Person.Id == selfId).OrderBy(ap0 => ap0.OrderNumber)) { OwnArgPoints.Add(new ArgPointExt(ap)); } UpdateLocalUnreadCountsOwn(TimingCtx.GetFresh()); if (OwnArgPoints.Count > 0) { lstPoints.SelectedItem = OwnArgPoints.First(); theBadge.RemoveFocusFromInputControls(); theBadge.DataContext = OwnArgPoints.First().Ap; } else { theBadge.RemoveFocusFromInputControls(); theBadge.DataContext = null; } }
private void ForgetDBDiscussionState() { //forget cached state PrivateCenterCtx.DropContext(); TimingCtx.Drop(); ////////////////////// }
private void ArgPointChanged(int argPointId, int topicId, PointChangedType change, int personId) { if (change == PointChangedType.Modified) { //if a comment has been added by someone except us, update number of unread comments // onStructChanged(-1, -1, DeviceType.Wpf); //only show notification that there are new comments, not more. user will need to click Refresh var currTopic = lstTopics.SelectedItem as Topic; if (currTopic == null) { return; } if (topicId == currTopic.Id && personId != SessionInfo.Get().person.Id) { TimingCtx.Drop(); //if (DaoUtils.NumCommentsUnreadBy(TimingCtx.GetFresh(), argPointId).Total() > 0) thereAreNewComments.Visibility = Visibility.Visible; } } }
private void UpdateBadgesOfOtherUser(int personId, int topicId) { ArgPointsOfOtherUser.Clear(); var q = from ap in PrivateCenterCtx.Get().ArgPoint where ap.Person.Id == personId && ap.Topic.Id == topicId select ap; foreach (var ap in q) { ArgPointsOfOtherUser.Add(new ArgPointExt(ap)); } if (_otherUserSelectedManually && ArgPointsOfOtherUser.Count > 0) { theBadge.RemoveFocusFromInputControls(); theBadge.DataContext = ArgPointsOfOtherUser.First().Ap; } UpdateLocalUnreadCountsOfOtherUser(TimingCtx.GetFresh()); }
private void OnCommentRead(CommentsReadEvent ev) { theBadge.HandleCommentRead(ev); var topic = lstTopics.SelectedItem as Topic; if (topic != null && topic.Id == ev.TopicId) { bool changedPointOwnedByOtherUser = false; var changedPointExt = OwnArgPoints.FirstOrDefault(ap => ap.Ap.Id == ev.ArgPointId); if (changedPointExt == null) { changedPointExt = ArgPointsOfOtherUser.FirstOrDefault(ap => ap.Ap.Id == ev.ArgPointId); changedPointOwnedByOtherUser = true; } TimingCtx.Drop(); var ctx = TimingCtx.GetFresh(); //if the changed point is our own point if (changedPointExt != null) { changedPointExt.NumUnreadComments = DaoUtils.NumCommentsUnreadBy( ctx, changedPointExt.Ap.Id).Total(); if (changedPointOwnedByOtherUser) { UpdateOtherUsersDots(ctx, changedPointExt.Ap.Person.Id); } else { UpdateLocalUnreadCountsOwn(ctx); } } } }