Ejemplo n.º 1
0
        public MessageListViewModel(int friendId
            , IMessageItemModelFactory messageItemModelFactory
            , IUserInfoRepository userInfoRepository
            , IFriendsRepository friendsRepository
            , IDialogMessagesRepository dialogMessagesRepository
            , ILoadingIndicatorViewModel loadingIndicatorModel
            , ILanguageRepository languageRepository
            , ILogger logger) 
            : base(languageRepository, logger)
        {
            _messageItemModelFactory = messageItemModelFactory;
            FriendId = friendId;
            MessageViews = new BindableCollection<IMessageBaseItemViewModel>();
            LoadingIndicatorModel = loadingIndicatorModel;

            if (userInfoRepository.NotEmpty())
            {
                UserFirstName = userInfoRepository.Data.FirstName;
            }

            if (friendsRepository.NotEmpty())
            {
                FriendFirstName = friendsRepository.Data.FirstOrDefault(x => x.VkId == friendId)?.FirstName;
            }

            dialogMessagesRepository.AddingRange += DialogMessagesAddingRange;
            dialogMessagesRepository.AddedRange += DialogMessagesAddedRange;
            dialogMessagesRepository.AddRangeFailed += DialogMessagesAddRangeFailed;
        }