Example #1
0
 public MainWindow()
 {
     InitializeComponent();
     _settingsFile = SettingsLoader.GetSettings();
     _context      = PrimeWindowVM.Create(_settingsFile, this);
     DataContext   = _context;
 }
Example #2
0
        public override void StateInitialization(IInitializationControl control)
        {
            try
            {
                var settings        = SettingsLoader.GetSettings();          // todo: make examine based fallback
                var settingsService = IO.Container.Resolve <ISettingsService>() as SettingsService;
                if (settingsService != null)
                {
                    settingsService.IncludingVat            = settings.IncludingVat;
                    settingsService.UseLowercaseUrls        = settings.UseLowercaseUrls;
                    settingsService.IncompleteOrderLifetime = settings.IncompleteOrderLifetime;
                    settingsService.RegisterSettingsChangedEvent(s =>
                    {
                        settingsService.IncludingVat            = s.IncludingVat;
                        settingsService.IncompleteOrderLifetime = s.IncompleteOrderLifetime;
                        settingsService.UseLowercaseUrls        = s.UseLowercaseUrls;
                    });
                }

                IO.Container.Resolve <IApplicationCacheManagingService>().Initialize();

                control.Done();
            }
            catch (Exception)
            {
                control.NotNow();
                //control.FatalError("Could not load settings");
            }
        }
        public SettingsViewModel()
        {
            _settingsLoader           = SettingsLoader.Load();
            ProgramSettings           = _settingsLoader.GetSettings();
            _organizationManager      = Directory.GetOrganizationManager();
            _communicationTypeManager = Directory.GetCommunicationTypeManager();

            OrganizationViewModel      = new OrganizationViewModel();
            CommunicationTypeViewModel = new CommunicationTypeViewModel();

            AddedOrganization      = new Organization();
            AddedCommunicationType = new CommunicationType();
        }
        private void ContentOnAfterUpdateDocumentCache(Document sender, DocumentCacheEventArgs documentCacheEventArgs)
        {
            //if (sender.ContentType.Alias.StartsWith("uwbs") && sender.ContentType.Alias != Order.NodeAlias)
            //todo: work with aliasses from config
            var alias = sender.ContentType.Alias;

            // todo: make a nice way for this block
            if (Product.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (ProductVariant.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (Category.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (PaymentProvider.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (PaymentProviderMethod.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (DiscountProduct.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (DiscountOrder.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (ShippingProvider.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (ShippingProviderMethod.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (Store.IsAlias(alias))
            {
                ResetAll(sender.Id, alias);
            }
            else if (alias.StartsWith("uwbs") && alias != Order.NodeAlias)
            {
                ResetAll(sender.Id, alias);
            }

            var storePickerProperty = sender.getProperty(Constants.StorePickerAlias);

            if (storePickerProperty != null)
            {
                int storeId;
                if (storePickerProperty.Value != null && int.TryParse(storePickerProperty.Value.ToString(), out storeId))
                {
                    var storeService = StoreHelper.StoreService;
                    var storeById    = storeService.GetById(storeId, null);
                    if (storeById != null)
                    {
                        storeService.TriggerStoreChangedEvent(storeById);
                    }
                }
            }

            if (alias.StartsWith(Settings.NodeAlias))
            {
                IO.Container.Resolve <ISettingsService>().TriggerSettingsChangedEvent(SettingsLoader.GetSettings());
            }

            if (alias.StartsWith(Store.NodeAlias))
            {
                //todo: naar nieuwe v6+ API omzetten
                var storeService = StoreHelper.StoreService;
                storeService.TriggerStoreChangedEvent(storeService.GetById(sender.Id, null));
                var node = new Node(sender.Id);
                if (!sender.Text.Equals(node.Name))
                {
                    StoreHelper.RenameStore(node.Name, sender.Text);
                }
            }
        }
Example #5
0
 public override void Process(ItemResolverArgs args)
 {
     args.Settings = SettingsLoader.GetSettings();
 }