public PromptsViewModel(IPromptsViewModelService promptsViewModelService, IReportRenderer reportRenderer) { _reportRenderer = reportRenderer; _catalogItemInfo = new CatalogItemInfo {Name = string.Empty}; _prompts = new ObservableCollection<IPrompt>(); _promptsViewModelService = promptsViewModelService; _executeReport = new RelayCommand(OnExeucteReport, ValidateAllPromptsAreReadyForReportExecution); MoveNext = new RelayCommand(OnMoveNext, () => _canMoveNext); MovePrevious = new RelayCommand(OnMovePrevious,() => _canMovePrevious); }
public void Render( CatalogItemInfo catalogItemInfo , ObservableCollection<PromptSelectionInfo> promptSelectionInfos , Action<string> callBack , Action<string> errorCallback) { _promptSelectionServiceClient.SetPromptSelectionsAsync( catalogItemInfo.Path, promptSelectionInfos, r => OnSetPromptSelectionsCompleted(r, callBack), errorCallback); }
public ReportViewModel( CatalogItemInfo catalogItemInfo , ObservableCollection<PromptSelectionInfo> selectionInfos , IReportExecutionService reportExecutionService , string serverName) { _serverName = serverName; _url = string.Empty; reportExecutionService.Render( catalogItemInfo, selectionInfos, OnRender, OnError); State = ViewModelState.Loading; }
public void SetupRender( CatalogItemInfo catalogItemInfo, ObservableCollection<PromptSelectionInfo> promptSelectionInfos) { var setup = _mock.Setup( m => m.Render( catalogItemInfo, promptSelectionInfos, It.IsAny<Action<string>>(), It.IsAny<Action<string>>())); setup.Callback< CatalogItemInfo, ObservableCollection<PromptSelectionInfo>, Action<string>, Action<string>>( (i, s, c, ec) => { _callback = c; _errorCallback = ec; } ); }
public virtual void AddReport(CatalogItemInfo catalogItemInfo, ObservableCollection<PromptSelectionInfo> promptSelectionInfos) { var viewModel = _reportViewModelBuilder.Build(catalogItemInfo, promptSelectionInfos); Report = viewModel; RaisePropertyChanged("Report"); }
public IReportViewModel Build( CatalogItemInfo catalogItemInfo, ObservableCollection<PromptSelectionInfo> promptSelectionInfos) { return new ReportViewModel(catalogItemInfo, promptSelectionInfos, _reportExecutionService, _serverName); }
public void ShowPromptsFor(CatalogItemInfo catalogItemInfo) { if(catalogItemInfo != CatalogItemInfo || State == ViewModelState.Error) { if(State == ViewModelState.Loading) { _promptsViewModelService.CancelGetPromptViewModels(CatalogItemInfo.Path); } CatalogItemInfo = catalogItemInfo; State = ViewModelState.Loading; foreach (var prompt in Prompts) { prompt.PropertyChanged -= OnPromptPropertyChanged; } if (!ErrorMessage.Equals(string.Empty)) { ErrorMessage = string.Empty; } _promptsViewModelService.GetPromptViewModels( catalogItemInfo.Path, OnGetPromptCollectionCompleted, OnErrorGettingPrompts); } }
private ICatalogItemViewModel CreateReportCatalogItem(CatalogItemInfo catalogItemInfo) { switch (catalogItemInfo.Type) { case CatalogItemType.Report: var reportViewModel = new ReportCatalogItemViewModel(catalogItemInfo, _promptsViewModel); return reportViewModel; case CatalogItemType.Folder: var folderViewModel = new FolderCatalogItemViewModel(catalogItemInfo); return folderViewModel; default: throw new Exception(); } }
public void Setup() { _promptsViewModel = new Mock<IPromptsViewModel>(); _catalogItemInfo = new CatalogItemInfo {Name = "Name", Path = "Path", Type = CatalogItemType.Report}; _reportCatalogItemViewModel = new ReportCatalogItemViewModel(_catalogItemInfo, _promptsViewModel.Object); }
public FolderCatalogItemViewModel(CatalogItemInfo catalogItemInfo) { _catalogItemInfo = catalogItemInfo; }
public ReportCatalogItemViewModel(CatalogItemInfo catalogItemInfo, IPromptsViewModel promptsViewModel) { _promptsViewModel = promptsViewModel; _catalogItemInfo = catalogItemInfo; ShowPromptCollection = new RelayCommand(OnShowPrompts); }