public async Task <SetPasswordViewModel> BuildModelAsync(SetPasswordComponentModel componentModel) { var viewModel = new SetPasswordViewModel { Header = headerModelBuilder.BuildModel(), SetPasswordForm = await this.signPasswordFormModelBuilder.BuildModelAsync(new SetPasswordFormComponentModel { Id = componentModel.Id, ReturnUrl = componentModel.ReturnUrl }), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
/// <summary> /// Runs the report generation. /// </summary> public void Run() { foreach (var targetAssembly in _arguments.Get(ArgumentKeys.TargetAssemblies)) { var reportModel = _modelBuilder.BuildModel(targetAssembly); Debug.Assert(reportModel != null); _reportGenerator.Generate(reportModel); } }
public async Task <AvailableProductsPageViewModel> BuildModelAsync(ComponentModelBase componentModel) { var viewModel = new AvailableProductsPageViewModel { Header = await this.headerModelBuilder.BuildModelAsync(componentModel), MainNavigation = await this.mainNavigationModelBuilder.BuildModelAsync(componentModel), Catalog = await this.searchProductsCatalogModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public async Task <WarehousesPageViewModel> BuildModelAsync(ComponentModelBase componentModel) { var viewModel = new WarehousesPageViewModel { Locale = CultureInfo.CurrentUICulture.Name, Header = this.headerModelBuilder.BuildModel(), MenuTiles = this.menuTilesModelBuilder.BuildModel(), Catalog = await this.warehousesCatalogModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public SignInViewModel BuildModel(SignInComponentModel componentModel) { var viewModel = new SignInViewModel { Header = headerModelBuilder.BuildModel(), SignInForm = signInFormModelBuilder.BuildModel(new SignInFormComponentModel { ReturnUrl = componentModel.ReturnUrl }), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public async Task <OrdersPageViewModel> BuildModelAsync(ComponentModelBase componentModel) { var viewModel = new OrdersPageViewModel { Locale = CultureInfo.CurrentUICulture.Name, Header = await this.headerModelBuilder.BuildModelAsync(componentModel), MainNavigation = await this.mainNavigationModelBuilder.BuildModelAsync(componentModel), Catalog = await this.ordersCatalogModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public async Task <CategoryPageViewModel> BuildModelAsync(SearchProductsComponentModel componentModel) { var viewModel = new CategoryPageViewModel { Header = await this.headerModelBuilder.BuildModelAsync(componentModel), MainNavigation = await this.mainNavigationModelBuilder.BuildModelAsync(componentModel), Breadcrumbs = await this.categoryBreadcrumbsModelBuilder.BuildModelAsync(componentModel), Catalog = await this.categoryCatalogModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public async Task <ClientPageViewModel> BuildModelAsync(ComponentModelBase componentModel) { var viewModel = new ClientPageViewModel { Locale = CultureInfo.CurrentUICulture.Name, Header = headerModelBuilder.BuildModel(), MenuTiles = menuTilesModelBuilder.BuildModel(), ClientForm = await clientFormModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public async Task <ProductPageViewModel> BuildModelAsync(ComponentModelBase componentModel) { var viewModel = new ProductPageViewModel { Header = await this.headerModelBuilder.BuildModelAsync(componentModel), MainNavigation = await this.mainNavigationModelBuilder.BuildModelAsync(componentModel), Breadcrumbs = await this.productBreadcrumbsModelBuilder.BuildModelAsync(componentModel), ProductDetail = await this.productDetailModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public MainWindowViewModel(IModelBuilder modelBuilder, IEventAggregator eventAggregator, ITestManager testManager, IViewModelStateSerializer viewModelStateSerializer, IViewModelLocator viewModelLocator) { if (modelBuilder == null) { throw new ArgumentNullException("modelBuilder"); } if (eventAggregator == null) { throw new ArgumentNullException("eventAggregator"); } if (testManager == null) { throw new ArgumentNullException("testManager"); } if (viewModelStateSerializer == null) { throw new ArgumentNullException("viewModelStateSerializer"); } if (viewModelLocator == null) { throw new ArgumentNullException("viewModelLocator"); } _modelBuilder = modelBuilder; _eventAggregator = eventAggregator; _testManager = testManager; _viewModelStateSerializer = viewModelStateSerializer; _viewModelLocator = viewModelLocator; InitializeCommands(); _eventAggregator.GetEvent <ModelAddRequestEvent>().Subscribe(OnAddModelRequest); _cameraSubscriptionToken = _eventAggregator.GetEvent <CameraPositionChangedEvent>().Subscribe(OnCameraChange); _fieldModel = _modelBuilder.BuildModel <Field>(); State = TestState.NotConfigured; _models = new ObservableCollectionEx <IModel>(); ((INotifyPropertyChanged)_models).PropertyChanged += (sender, args) => RaisePropertyChanged(() => Models3D); Configuration = new TestConfiguration(_eventAggregator); }
public async Task <BrandPageViewModel> BuildModelAsync(ComponentModelBase componentModel) { var viewModel = new BrandPageViewModel { Header = await this.headerModelBuilder.BuildModelAsync(componentModel), BrandDetail = await this.brandDetailModelBuilder.BuildModelAsync(componentModel), Catalog = await this.brandCatalogModelBuilder.BuildModelAsync(componentModel), MainNavigation = await this.mainNavigationModelBuilder.BuildModelAsync(componentModel), Breadcrumbs = await this.brandBreadcrumbsModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
public async Task <SearchProductsPageViewModel> BuildModelAsync(SearchProductsComponentModel componentModel) { var viewModel = new SearchProductsPageViewModel { Header = await this.headerModelBuilder.BuildModelAsync(componentModel), MainNavigation = await this.mainNavigationModelBuilder.BuildModelAsync(new ComponentModelBase { Id = componentModel.Id, Token = componentModel.Token, IsAuthenticated = componentModel.IsAuthenticated, Language = componentModel.Language }), Catalog = await this.searchProductsCatalogModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; viewModel.Header.SearchTerm = componentModel.SearchTerm; return(viewModel); }
public async Task <HomePageViewModel> BuildModelAsync(ComponentModelBase componentModel) { var viewModel = new HomePageViewModel { Header = await this.headerModelBuilder.BuildModelAsync(componentModel), MainNavigation = await this.mainNavigationModelBuilder.BuildModelAsync(componentModel), HeroSlider = await this.heroSliderModelBuilder.BuildModelAsync(componentModel), CarouselGrid = await this.carouselGridModelBuilder.BuildModelAsync(componentModel), ContentGrid = await this.contentGridModelBuilder.BuildModelAsync(componentModel), Footer = footerModelBuilder.BuildModel() }; return(viewModel); }
private void OnAddModelRequest(IModelAddRequestDetails addRequestDetails) { if (addRequestDetails == null) { throw new ArgumentNullException("addRequestDetails"); } if ((State != TestState.UpdatingTestConfiguration) && (State != TestState.TestIsRunningAcceptLocationsPhase)) { return; } var model = _modelBuilder.BuildModel(addRequestDetails.ModelType); var modelInitializer = addRequestDetails.ModelInitializer; modelInitializer.InitializeModel(model, Configuration, State); Models.Add(model); }
public void BuildModel_QueryStringDictionary_Throws_If_Passed_Null_Type() { _ModelBuilder.BuildModel(null, new TypeParserResolver(), new QueryStringDictionary("a=b")); }
public void Analyse() { var startTime = DateTime.Now; Console.WriteLine("--- Starting Model Analysis ---"); Console.WriteLine(); Console.WriteLine("--- Reading in Analysed Data ---"); var termsVectorDataFrame = Frame.ReadCsv( _appSettings.TermsVectorFilePath, hasHeaders: true, inferTypes: true); var spamTermFrequencyDataFrame = Frame.ReadCsv( _appSettings.SpamTermsFilePath, hasHeaders: false, inferTypes: false, schema: "string,int"); var fileReadTime = DateTime.Now; Console.WriteLine($"File Read in Duration: {(fileReadTime - startTime).Milliseconds}ms"); Console.WriteLine(); Console.WriteLine("--- Selecting Features ---"); var termFeatures = _termSelector.SelectSpamTerms(spamTermFrequencyDataFrame); var inputs = _featureSelector.SelectInputFeatures(termsVectorDataFrame, termFeatures); var outputs = _featureSelector.SelectOutputClassifications(termsVectorDataFrame); var featureSelectionTime = DateTime.Now; Console.WriteLine( $"Feature Selection Duration: {(featureSelectionTime - fileReadTime).Milliseconds}ms, {(featureSelectionTime - startTime).Milliseconds}ms"); Console.WriteLine(); Console.WriteLine("--- Building Model ---"); var result = _modelBuilder.BuildModel(inputs, outputs); var modelBuildTime = DateTime.Now; Console.WriteLine( $"Model Building Duration: {(modelBuildTime - featureSelectionTime).Milliseconds}ms, {(modelBuildTime - startTime).Milliseconds}ms"); Console.WriteLine(); Console.WriteLine("--- Model Analysis ---"); var numberOfSamples = result.NumberOfSamples; var numberOfInputs = result.NumberOfInputs; var numberOfOutputs = result.NumberOfOutputs; var trainingError = result.Training.Mean; var validationError = result.Validation.Mean; Console.WriteLine(); Console.WriteLine("--- Confusion Matrix ---"); var gcm = result.ToConfusionMatrix(inputs, outputs); Console.WriteLine(); Console.Write("\t\tActual 0\t\tActual 1\n"); for (var i = 0; i < gcm.Matrix.GetLength(0); i++) { Console.Write($"Pred {i} :\t"); for (var j = 0; j < gcm.Matrix.GetLength(1); j++) { Console.Write(gcm.Matrix[i, j] + "\t\t\t"); } Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("--- Sample Size ---"); Console.WriteLine( $"# samples: {numberOfSamples}, # inputs: {numberOfInputs}, # outputs: {numberOfOutputs}"); Console.WriteLine($"training error: {trainingError}"); Console.WriteLine($"validation error: {validationError}"); Console.WriteLine(); Console.WriteLine("--- Calculating Accuracy, Precision, Recall ---"); var truePositive = (float)gcm.Matrix[1, 1]; var trueNegative = (float)gcm.Matrix[0, 0]; var falsePositive = (float)gcm.Matrix[1, 0]; var falseNegative = (float)gcm.Matrix[0, 1]; Console.WriteLine($"Accuracy: {(truePositive + trueNegative) / numberOfSamples}"); Console.WriteLine($"Precision: {(truePositive / (truePositive + falsePositive))}"); Console.WriteLine($"Recall: {(truePositive / (truePositive + falseNegative))}"); var modelAnalysisTime = DateTime.Now; Console.WriteLine(); Console.WriteLine($"Model Building Duration: {(modelAnalysisTime - modelBuildTime).Milliseconds}ms, {(modelAnalysisTime - startTime).Milliseconds}ms"); Console.WriteLine(); Console.WriteLine("--- Model Analysis Complete ---"); Console.ReadKey(); }