public UploadProductsWindow() { InitializeComponent(); WindowHelper.CheckAndApplyTheme(this); _servicesService = ObjectLocator.GetInstance<IServicesService>(); _licenseSetService = ObjectLocator.GetInstance<ILicenseSetService>(); _licenseService = ObjectLocator.GetInstance<ILicenseService>(); }
public UploadProductsWindow() { InitializeComponent(); WindowHelper.CheckAndApplyTheme(this); _servicesService = ObjectLocator.GetInstance <IServicesService>(); _licenseSetService = ObjectLocator.GetInstance <ILicenseSetService>(); _licenseService = ObjectLocator.GetInstance <ILicenseService>(); }
public ServicesService(IServicesRepository servicesRepository, IServiceStatusProvider serviceStatusProvider, IPackingService packingService, ILicenseActiviationProvider licenseActiviationProvider, ILicenseKeyService licenseKeyService, ILicenseService licenseService, ILicenseSetService licenseSetService, IClientLicenseService clientLicenseService, IProductsProvider productsProvider) { _servicesRepository = servicesRepository; _serviceStatusProvider = serviceStatusProvider; _packingService = packingService; _licenseActiviationProvider = licenseActiviationProvider; _licenseKeyService = licenseKeyService; _licenseService = licenseService; _licenseSetService = licenseSetService; _clientLicenseService = clientLicenseService; _productsProvider = productsProvider; }
private void btnSynchronize_Click(object sender, RoutedEventArgs e) { if (Service != null && LicenseSet != null) { BackgroundWorker worker = new BackgroundWorker(); loadingAnimation.Visibility = Visibility.Visible; List <string> keysToUpload = new List <string>(); foreach (string k in _localKeys) { if (_serviceKeys.Contains(k) == false) { keysToUpload.Add(k); } } worker.DoWork += delegate(object s, DoWorkEventArgs args) { object[] data = args.Argument as object[]; IServicesService servicesService = ObjectLocator.GetInstance <IServicesService>(); ILicenseSetService licenseSetService = ObjectLocator.GetInstance <ILicenseSetService>(); servicesService.AddLicenseKeysToService(licenseSetService.GetLiceseSetById((int)data[2]), (Service)data[1], (List <string>)data[0]); List <string> serviceKeys = servicesService.GetServiceLicenseKeysForSet(licenseSetService.GetLiceseSetById((int)data[2]), (Service)data[1]); args.Result = serviceKeys; }; worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args) { _serviceKeys = (List <string>)args.Result; UpdateData(); loadingAnimation.Visibility = Visibility.Collapsed; }; worker.RunWorkerAsync(new object[] { keysToUpload, Service, LicenseSet.LicenseSetId }); } }
public LicenseService(ILicensesRepository licensesRepository, ILicenseSetService licenseSetService) { _licensesRepository = licensesRepository; _licenseSetService = licenseSetService; }
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."); } }