示例#1
0
        private void SosOnlineServiceOnOnNewSosOnlineNotification(object sender, NewSosOnlineNotificationArgs args)
        {
            NewsItemTypeEnum newItemType = (NewsItemTypeEnum)args.EventTypeId;
            bool             currentUserAuthoredEvent      = args.UserName == _settings.SosOnlineUsername;
            bool             reputationChangeOrAchievement = newItemType == NewsItemTypeEnum.SosOnlineReputationChange ||
                                                             newItemType == NewsItemTypeEnum.SosOnlineNewAchievement;

            if (currentUserAuthoredEvent && reputationChangeOrAchievement)
            {
                return;
            }
            // this may result in a web request to retrieve the person's image, so keep it on some other thread
            SosOnlinePerson sosOnlinePerson = _sosOnlineService.CreateSosOnlinePersonFromSosOnlineNotification(args, _avatarImageList);

            Invoke(() =>
            {
                NewNewsItemEventArgs newNewsItemEventArgs = new NewNewsItemEventArgs
                {
                    EventDate       = DateTime.Now,
                    Person          = sosOnlinePerson,
                    Title           = args.Message,
                    AvatarImageList = _avatarImageList,
                    NewsItemType    = newItemType
                };
                _newsFeed1.AddNewsItem(newNewsItemEventArgs);
            });
        }
示例#2
0
        private void SosOnlineServiceOnNewSosOnlineNotification(object sender, NewSosOnlineNotificationArgs args)
        {
            // this may result in a web request to retrieve the person's image, so keep it on some other thread
            SosOnlinePerson sosOnlinePerson = _sosOnlineService.CreateSosOnlinePersonFromSosOnlineNotification(args, _avatarImageList);

            Invoke(() =>
            {
                NewNewsItemEventArgs newNewsItemEventArgs = new NewNewsItemEventArgs
                {
                    EventDate       = DateTime.Now,
                    Person          = sosOnlinePerson,
                    Title           = args.Message,
                    AvatarImageList = _avatarImageList,
                    NewsItemType    = NewsItemTypeEnum.SosOnlineComment
                };
                _newsFeed1.AddNewsItem(newNewsItemEventArgs);
            });
        }