private void OnApplyChanges() { var facade = FacadeFactory.Create(); resultOverview = facade.Get <ResultOverview>(Bootstrap.Results); if (resultOverview != null) { // Get the ID of the current id and get the instance var id = CurrentResultOverview.Id; var item = resultOverview.PAOResults.Skip(id).First(); item.Comment = CurrentComment; item.DeckTitle = CurrentDeck; OnRefresh(); } }
//private void OnSelectedSource() //{ // var facade = new ContainerFacade(); // var uiService = facade.Get<IUiService>(); // var result = uiService.ShowOpenFileDialog(); // if (result != null) // { // Source = result; // RaisePropertyChange("Source"); // } //} private void OnLoadFile() { var facade = FacadeFactory.Create(); var uiService = facade.Get <IUiService>(); try { // Load the resutls and refresh the view var result = InternalLoadFile(Source); resultOverview = facade.Get <ResultOverview>(Bootstrap.Results); resultOverview.Reload(result); OnRefresh(); } catch (IOServiceException serviceException) { uiService.ShowDialog(serviceException.Message, "Error"); } }
/// <summary> /// Inits the result overview component /// </summary> /// <param name="overview">the overview instance of the application</param> /// <param name="ioService">the I/O service of the application</param> public void InitResultOverview(ResultOverview overview, IIOService ioService) { // If the default source file exists, try to load the content var sourceFile = overview.Source; if (File.Exists(sourceFile)) { try { var results = ioService.LoadResult(sourceFile); overview.Reload(results); } catch (IOException ioException) { //TODO: What to do?? } } }
public async Task <Result <ResultOverview> > GetHousesWithGardenAmsterdamAsync(CancellationToken cancellationToken) { var result = new ResultOverview(); var taskList = new List <Task <ResultOverview> >(); const int size = 25; var endpointOne = GetBuyHousesAmsterdamWithGardenEndpoint(1, size); var responseOne = await FetchResultOverview(endpointOne, cancellationToken); result.Huizen = responseOne.Huizen; var amount = Math.Ceiling(responseOne.TotaalAantalObjecten / (double)size); for (var i = 2; i < amount; i++) { var endpoint = GetBuyHousesAmsterdamWithGardenEndpoint(page: i, size); var task = FetchResultOverview(endpoint, cancellationToken); taskList.Add(task); } try { var overviews = await Task.WhenAll(taskList); foreach (var overview in overviews) { if (overview == null) { continue; } result.Huizen = result.Huizen == null ? overview.Huizen : result.Huizen.Concat(overview.Huizen).ToList(); } } catch (Exception e) { _logger.LogError(e.Message); return(Result.Failure <ResultOverview>(e.Message)); } return(result); }
private void OnRefresh() { var facade = FacadeFactory.Create(); resultOverview = facade.Get <ResultOverview>(Bootstrap.Results); if (resultOverview != null) { Source = resultOverview.Source; // Create a list and and an ID integer to play with later. var list = new List <PAOResultOverview>(); int id = 0; // Use a temporary list instead of the enumeration of the instance, because we need to add tests items maybe. resultDict = new Dictionary <int, PAOResult>(); var results = new List <PAOResult>(); results.AddRange(resultOverview.PAOResults); // // Create some fake results for debugging if enabled // AddDebugValues(results); foreach (var paoResult in results) { var paoResultOverview = new PAOResultOverview(id); paoResultOverview.Comment = paoResult.Comment; paoResultOverview.Deck = paoResult.DeckTitle; list.Add(paoResultOverview); resultDict.Add(id, paoResult); id++; } // Refresh the UI Results = new ObservableCollection <PAOResultOverview>(list); RaisePropertyChange("Results"); oldComment = null; oldCurrentDeck = null; ApplyChanges.Refresh(); } }
public void InitSettings() { var settings = new GameSetting(); var overview = new ResultOverview(); var ioService = new IoService(); var eventManager = new EventController(); // Init the environment loader.InitDecks(settings); loader.InitResultOverview(overview, ioService); // Adds internal events for the app eventManager.Add(new Event(EventNewCardGame)); // Finally add it to the IOC container var facade = FacadeFactory.Create(); facade.AddUnique(settings, Settings); facade.AddUnique(overview, Results); facade.AddUnique(ioService, IoService); facade.AddUnique(eventManager, EventManager); }
private static void SetupEnvironmentGetEstateAgents(StashMoq stash, ResultOverview resultOverview) { stash.Mock <IFundaConnector>().Setup(c => c.GetHousesAmsterdamAsync(CancellationToken.None)).ReturnsAsync(resultOverview); }