Пример #1
0
        public PostListViewModel(INavigationService navigationService,
                                 IPostSummariesService postSummariesService,
                                 IProgressBarController progressBarController,
                                 IWindowManager windowManager,
                                 IBackgroundLoader loader)
        {
            this.navigationService     = navigationService;
            this.postSummariesService  = postSummariesService;
            this.progressBarController = progressBarController;
            this.windowManager         = windowManager;
            this.loader = loader;

            backgroundObserver =
                new BackgroundObserver <IEnumerable <PostSummary> >(async() => await postSummariesService.GetPostSummaries(),
                                                                    (data) =>
            {
                if (OriginList.Count != Enumerable.Count(data))
                {
                    OriginList = new ObservableCollection <PostSummary>(data);
                }
            });
        }
Пример #2
0
        public PostViewModel(ICommentService commentService,
                             IPostService postService,
                             INavigationService navigationService,
                             IWindowManager windowManager,
                             IProgressBarController progressBarController,
                             IBackgroundLoader backgroundLoader)
        {
            this.commentService        = commentService;
            this.postService           = postService;
            this.navigationService     = navigationService;
            this.windowManager         = windowManager;
            this.progressBarController = progressBarController;
            this.backgroundLoader      = backgroundLoader;

            backgroundObserver = new BackgroundObserver <IEnumerable <Comment> >(async() => await commentService.GetCommentForPost(PostId),
                                                                                 (data) =>
            {
                if (data.Count() != CommentList.Count)
                {
                    CommentList = new ObservableCollection <Comment>(data);
                }
            });
        }