コード例 #1
0
ファイル: PromptsViewModel.cs プロジェクト: e82eric/Prompts
        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);
        }
コード例 #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);
 }
コード例 #3
0
ファイル: ReportViewModel.cs プロジェクト: e82eric/Prompts
 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;
 }
コード例 #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;
                    } );
        }
コード例 #5
0
 public virtual void AddReport(CatalogItemInfo catalogItemInfo, ObservableCollection<PromptSelectionInfo> promptSelectionInfos)
 {
     var viewModel = _reportViewModelBuilder.Build(catalogItemInfo, promptSelectionInfos);
     Report = viewModel;
     RaisePropertyChanged("Report");
 }
コード例 #6
0
 public IReportViewModel Build(
     CatalogItemInfo catalogItemInfo,
     ObservableCollection<PromptSelectionInfo> promptSelectionInfos)
 {
     return new ReportViewModel(catalogItemInfo, promptSelectionInfos, _reportExecutionService, _serverName);
 }
コード例 #7
0
ファイル: PromptsViewModel.cs プロジェクト: e82eric/Prompts
        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);
            }
        }
コード例 #8
0
 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();
     }
 }
コード例 #9
0
 public void Setup()
 {
     _promptsViewModel = new Mock<IPromptsViewModel>();
     _catalogItemInfo = new CatalogItemInfo {Name = "Name", Path = "Path", Type = CatalogItemType.Report};
     _reportCatalogItemViewModel = new ReportCatalogItemViewModel(_catalogItemInfo, _promptsViewModel.Object);
 }
コード例 #10
0
 public FolderCatalogItemViewModel(CatalogItemInfo catalogItemInfo)
 {
     _catalogItemInfo = catalogItemInfo;
 }
コード例 #11
0
 public ReportCatalogItemViewModel(CatalogItemInfo catalogItemInfo, IPromptsViewModel promptsViewModel)
 {
     _promptsViewModel = promptsViewModel;
     _catalogItemInfo = catalogItemInfo;
     ShowPromptCollection = new RelayCommand(OnShowPrompts);
 }