Exemplo n.º 1
0
        public IList <InstalledProduct> ScanProducts()
        {
            InstalledProducts = DecodeProducts(ProductsDbPath);

            var clientTypes = EnumExtensions.Values <WowClientType>();

            foreach (var clientType in clientTypes)
            {
                var clientLocation  = GetClientLocation(clientType);
                var productLocation = GetProductLocation(clientType);

                if (string.IsNullOrEmpty(clientLocation) && string.IsNullOrEmpty(productLocation))
                {
                    continue;
                }

                Log.Information($"clientLocation {clientLocation}, productLocation: {productLocation}");
                if (AreEqualPaths(clientLocation, productLocation))
                {
                    continue;
                }

                // If the path that the user selected is valid, then move on.
                if (!string.IsNullOrEmpty(clientLocation) && IsClientFolder(clientType, clientLocation))
                {
                    continue;
                }

                var locationPreference = GetClientLocationPreference(clientType);
                if (locationPreference == null)
                {
                    locationPreference = _preferenceRepository.Create(GetClientLocationPreferenceKey(clientType), string.Empty);
                }

                locationPreference.Value = productLocation;

                Log.Information($"locationPreference {locationPreference}");

                _preferenceRepository.SaveItem(locationPreference);

                var changedClient = new ChangedClient
                {
                    ClientType       = clientType,
                    NewLocation      = productLocation,
                    PreviousLocation = clientLocation
                };

                ProductChanged?.Invoke(this, new WarcraftEventArgs
                {
                    ChangedClient = changedClient
                });
            }

            return(InstalledProducts);
        }
        public ProductSelectorView(IDataSource dataSource) : base("Products")
        {
            products = dataSource.GetAllProducts().OrderBy(e => e.Id).ToList();

            _listView = new ListView(products);

            _listView.SelectedChanged += () =>
            {
                ProductChanged?.Invoke(products[_listView.SelectedItem].Id);
            };

            base.Add(_listView);
        }
Exemplo n.º 3
0
 private void When(ProductChanged @event)
 {
     this.products   = @event.Products.ToList();
     this.TotalPrice = @event.TotalPrice;
 }