/// <summary> /// Initializes a new instance of the <see cref="CreateArticleViewModel"/> class. /// </summary> /// <param name="articlesRpcClient">Articles RPC client injection.</param> /// <param name="eventAggregator">Event aggregator injection.</param> public CreateArticleViewModel(IArticlesRpcClient articlesRpcClient, IEventAggregator eventAggregator) { this.articlesRpcClient = articlesRpcClient; this.eventAggregator = eventAggregator; this.article = new ArticleViewModel(new ArticleDto()); this.SaveArticleCommand = new DelegateCommand(this.OnSaveArticle); }
/// <summary> /// Initializes a new instance of the <see cref="SidebarViewModel"/> class. /// </summary> /// <param name="articlesRpcClient">Rpc client injection.</param> /// <param name="eventAggregator">Event aggregator injection.</param> public SidebarViewModel(IArticlesRpcClient articlesRpcClient, IEventAggregator eventAggregator) { this.articlesRpcClient = articlesRpcClient; this.eventAggregator = eventAggregator; this.eventAggregator.GetEvent <ArticleSavedEvent>().Subscribe(OnArticleSaved); this.eventAggregator.GetEvent <ArticleDeletedEvent>().Subscribe(OnArticleDeleted); this.CreateArticleCommand = new DelegateCommand(this.OnCreateArticle, () => true); }
/// <summary> /// Initializes a new instance of the <see cref="ArticleDetailViewModel"/> class. /// </summary> /// <param name="articlesRpcClient">gRPC client injection.</param> /// <param name="eventAggregator">Event aggregator injection.</param> public ArticleDetailViewModel(IArticlesRpcClient articlesRpcClient, IEventAggregator eventAggregator) { this.articlesRpcClient = articlesRpcClient; this.eventAggregator = eventAggregator; this.eventAggregator.GetEvent <OpenArticleDetailEvent>().Subscribe(this.OnOpenArticleDetail); this.AddCommentCommand = new DelegateCommand(OnAddComment); this.DeleteArticleCommand = new DelegateCommand(OnDeleteArticle); this.Comment = new CommentViewModel(new CommentDto()); }
/// <summary> /// Initializes a new instance of the <see cref="ArticlesController"/> class. /// </summary> /// <param name="rpcClient">RPC client injection.</param> /// <param name="logger">Logger injection.</param> /// <param name="hub">SignalR hub injection.</param> public ArticlesController( IArticlesRpcClient rpcClient, ILogger <ArticlesController> logger, ArticlesHub hub) { this.rpcClient = rpcClient; this.logger = logger; this.hub = hub; }