private async Task showData(string pageName) { try { IonPage page = await Ion.getInstance(AppController.instance.ampConfig).getPageAsync(pageName); _allContent = DataConverters.convertContent(page.getContents()); // Load files for page content await Ion.getInstance(AppController.instance.ampConfig).loadContentFilesAsync(_allContent); //await Ion.getInstance( AppController.instance.ampConfig ).DownloadSearchDatabase(); //List<SearchResult> results = await Ion.getInstance( AppController.instance.ampConfig ).FullTextSearch("test", "de_DE"); // Set the data context of the lists imageContentList.DataContext = _allContent.imageContent; textContentList.DataContext = _allContent.textContent; colorContentList.DataContext = _allContent.colorContent; flagContentList.DataContext = _allContent.flagContent; fileContentList.DataContext = _allContent.fileContent; mediaContentList.DataContext = _allContent.mediaContent; dateTimeContentList.DataContext = _allContent.dateTimeContent; optionContentList.DataContext = _allContent.optionContent; } catch (Exception exception) { // Error handling, if no data could be loaded Debug.WriteLine("Error loading page: " + exception.Message); } setDataLoaded(); initPage(); }
private void cboServices_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (cboServices.SelectedValue != null) { BackgroundWorker worker = new BackgroundWorker(); loadingAnimation.Visibility = Visibility.Visible; worker.DoWork += delegate(object s, DoWorkEventArgs args) { object[] data = args.Argument as object[]; IServicesService servicesService = ObjectLocator.GetInstance <IServicesService>(); Dictionary <License, List <LicenseSet> > _servicesData = servicesService.GetServiceLicenses((Service)data[0]); args.Result = _servicesData; }; worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args) { servicesData = (Dictionary <License, List <LicenseSet> >)args.Result; gridRemoteServices.ItemsSource = DataConverters.ConvertAllLicensesSetsToDisplay(servicesData); loadingAnimation.Visibility = Visibility.Collapsed; }; worker.RunWorkerAsync(new object[] { cboServices.SelectedValue }); } }
protected override void SetContext() { DataConverters = new DataConverters(); var displayStrategy = new AverageDisplayValue(); SUT = new WeatherAppModel(DataConverters, displayStrategy); }
public void Then_KPH_Should_Be_12() { SUT.AddSpeedData(8.0d); SUT.AddSpeedData(DataConverters.MPHtoKPH(10.0d)); SUT.CurrentSpeedType = "KPH"; Assert.AreEqual(12, SUT.DisplaySpeed, 0.1); }
public void Then_MPH_Should_Be_7_Point_5() { SUT.AddSpeedData(8.0d); SUT.AddSpeedData(DataConverters.MPHtoKPH(10.0d)); SUT.CurrentSpeedType = "MPH"; Assert.AreEqual(7.5, SUT.DisplaySpeed, 0.1); }
public void Then_Fahrenheit_Should_Be_59() { SUT.AddTemperatureData(10.0d); SUT.AddTemperatureData(DataConverters.FahrenHeightToCelcius(68.0d)); SUT.CurrentTempType = "Fahrenheit"; Assert.AreEqual(59, SUT.DisplayTemperature); }
public void Then_Celcuis_Should_Be_15() { SUT.AddTemperatureData(10.0d); SUT.AddTemperatureData(DataConverters.FahrenHeightToCelcius(68.0d)); SUT.CurrentTempType = "Celsius"; Assert.AreEqual(15, SUT.DisplayTemperature); }
/// <summary> /// Creates a terrain node from an instances' attributes and byte array /// </summary> protected BaseTerrainNode(IntPtr pointer) { X = Functions.vp_int(pointer, Attributes.TerrainNodeX); Z = Functions.vp_int(pointer, Attributes.TerrainNodeZ); Revision = Functions.vp_int(pointer, Attributes.TerrainNodeRevision); var data = Functions.GetData(pointer, Attributes.TerrainNodeData); Cells = DataConverters.NodeDataTo2DArray <TTerrainCell>(data); }
private async Task <bool> getPageNames() { // Get all pagePreviews of the collection List <IonPagePreview> pagePreviews = await Ion.getInstance(_ampConfig).getPagePreviewsAsync(PageFilter.all); // Extract the page names from the pages list List <string> pageNames = DataConverters.getPageIdentifier(pagePreviews); allPagesList.DataContext = pageNames; disableProgressIndicator(); return(true); }
/// <summary> /// Gets the converter for this member. If a converter type is specified, that type is instantiated /// and returned. Otherwise, the built-in convert for this member's type is returned. If no built-in /// converter is found, <see cref="UnsupportedTypeConverter"/> is returned. /// </summary> /// <param name="converterType">The converter type specified in the <see cref="FixedWidthFieldAttribute"/>.</param> /// <returns>A data converter for this member.</returns> /// <exception cref="InvalidOperationException"></exception> private IDataConverter GetConverter(Type?converterType) { if (converterType != null) { if (!typeof(IDataConverter).IsAssignableFrom(converterType)) { throw new InvalidOperationException($"The data converter type specified for member '{Member.Name}' must derive from '{nameof(IDataConverter)}'."); } if (Activator.CreateInstance(converterType) is not IDataConverter converter) { throw new Exception($"Unable to create instance of type {converterType.FullName}."); } return(converter); } return(DataConverters.GetConverter(Member.Type)); }
private void UpdateServiceGrid() { servicesData = _servicesService.GetServiceLicenses((Service)cboServices.SelectedValue); gridRemoteServices.ItemsSource = DataConverters.ConvertAllLicensesSetsToDisplay(servicesData); }
private void btnUploadLicenseSets_Click(object sender, RoutedEventArgs e) { if (cboServices.SelectedValue != null) { if (gridLocalServices.SelectedItem != null) { if (DoesLicenseSetExistOnService() == false) { BackgroundWorker worker = new BackgroundWorker(); loadingAnimation.Visibility = Visibility.Visible; var productDisplayData = gridLocalServices.SelectedItem as UploadProductDisplayData; worker.DoWork += delegate(object s, DoWorkEventArgs args) { object[] data = args.Argument as object[]; IServicesService servicesService = ObjectLocator.GetInstance <IServicesService>(); ILicenseSetService licenseSetService = ObjectLocator.GetInstance <ILicenseSetService>(); ILicenseService licenseService = ObjectLocator.GetInstance <ILicenseService>(); //LicenseSet licenseSet = (LicenseSet) data[0]; License license = licenseService.GetLicenseById(((UploadProductDisplayData)data[0]).LicenseId); LicenseSet licenseSet = licenseSetService.GetLiceseSetById(((UploadProductDisplayData)data[0]).LicenseSetId); List <LicenseSet> sets = new List <LicenseSet>(); sets.Add(licenseSet); servicesService.AddProductToService(license, sets, data[1] as Service); Dictionary <License, List <LicenseSet> > _servicesData = servicesService.GetServiceLicenses((Service)data[1]); args.Result = _servicesData; }; worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args) { servicesData = (Dictionary <License, List <LicenseSet> >)args.Result; gridRemoteServices.ItemsSource = DataConverters.ConvertAllLicensesSetsToDisplay(servicesData); loadingAnimation.Visibility = Visibility.Collapsed; }; worker.RunWorkerAsync(new object[] { productDisplayData, cboServices.SelectedValue }); } else { MessageBox.Show("The License Set you selected already exists in the service"); } } else { MessageBox.Show("You must select a License/LicenseSet to upload"); } } else { MessageBox.Show("You must select a service to upload to."); } }
protected override void SetContext() { SUT = new DataConverters(); }