private void OnSolverDataChanged(ExtensionCategoryViewModelBase category, ExtensionViewModel oldExtension, ExtensionViewModel newExtension)
        {
            root.CreateSolverData();

            GlobalData.Instance.Configuration.Extensions.SolverData = newExtension.Extension.Name;
            ConfigurationManager.Save(GlobalData.Instance.Configuration);
        }
Ejemplo n.º 2
0
        private ExtensionViewModel GetSingleSelectedExtension(ExtensionCategoryViewModelBase category)
        {
            if (category == null)
            {
                throw new ArgumentNullException(nameof(category));
            }

            return(category.Extensions.Single(x => x.IsActive));
        }
Ejemplo n.º 3
0
        private ExtensionCategoryViewModelBase GetExtensionCategory(ExtensionCategory category)
        {
            ExtensionCategoryViewModelBase categoryViewModel = Extensions.Categories.FirstOrDefault(x => x.Category == category);

            if (categoryViewModel == null)
            {
                throw new InvalidOperationException($"Extension category '{category}' unavailable");
            }

            return(categoryViewModel);
        }
        public ExtensionViewModel(ExtensionCategoryViewModelBase parent, IExtension extension)
        {
            this.parent = parent;
            Extension   = extension;

            if (extension is IConfigurable configurable)
            {
                IsConfigurable   = true;
                ConfigureCommand = new AnonymousCommand(configurable.Configure);
            }
        }
        private void OnSolverChanged(ExtensionCategoryViewModelBase category, ExtensionViewModel oldExtension, ExtensionViewModel newExtension)
        {
            var oldValue = oldExtension?.Extension as ISolver;
            var newValue = newExtension?.Extension as ISolver;

            if (oldValue != null)
            {
                oldValue.SearchProgress -= SolverSearchProgress;
            }

            if (newValue != null)
            {
                newValue.SearchProgress += SolverSearchProgress;
            }

            GlobalData.Instance.Configuration.Extensions.Solver = newValue.Name;
            ConfigurationManager.Save(GlobalData.Instance.Configuration);
        }
Ejemplo n.º 6
0
        private ExtensionViewModel GetSingleSelectedExtension(ExtensionCategory category)
        {
            ExtensionCategoryViewModelBase categoryViewModel = GetExtensionCategory(category);

            return(GetSingleSelectedExtension(categoryViewModel));
        }