Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public void Render(
     CatalogItemInfo catalogItemInfo
     , ObservableCollection<PromptSelectionInfo> promptSelectionInfos
     , Action<string> callBack
     , Action<string> errorCallback)
 {
     _promptSelectionServiceClient.SetPromptSelectionsAsync(
         catalogItemInfo.Path,
         promptSelectionInfos,
         r => OnSetPromptSelectionsCompleted(r, callBack),
         errorCallback);
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
        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;
                    } );
        }
Exemplo n.º 5
0
 public virtual void AddReport(CatalogItemInfo catalogItemInfo, ObservableCollection<PromptSelectionInfo> promptSelectionInfos)
 {
     var viewModel = _reportViewModelBuilder.Build(catalogItemInfo, promptSelectionInfos);
     Report = viewModel;
     RaisePropertyChanged("Report");
 }
Exemplo n.º 6
0
 public IReportViewModel Build(
     CatalogItemInfo catalogItemInfo,
     ObservableCollection<PromptSelectionInfo> promptSelectionInfos)
 {
     return new ReportViewModel(catalogItemInfo, promptSelectionInfos, _reportExecutionService, _serverName);
 }
Exemplo n.º 7
0
        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);
 }
Exemplo n.º 10
0
 public FolderCatalogItemViewModel(CatalogItemInfo catalogItemInfo)
 {
     _catalogItemInfo = catalogItemInfo;
 }
Exemplo n.º 11
0
 public ReportCatalogItemViewModel(CatalogItemInfo catalogItemInfo, IPromptsViewModel promptsViewModel)
 {
     _promptsViewModel = promptsViewModel;
     _catalogItemInfo = catalogItemInfo;
     ShowPromptCollection = new RelayCommand(OnShowPrompts);
 }