public ExtensionVisualModel(ExtensionCategory owner, IExtensionModel model, bool isChecked, bool isEnabled) { Model = model; IsEnabled = isEnabled; _isChecked = isChecked || !isEnabled; _owner = owner; OpenWebSiteCommand = ActionCommand.Create(OpenWebSite); }
public static InstallerDialogViewModel From(IEnumerable <IExtensionModel> extensions) { var installed = ExtensionInstalledChecker.Instance.GetInstalledExtensions(); InstallerDialogViewModel temp = new InstallerDialogViewModel(); foreach (IGrouping <string, IExtensionModel> grouping in extensions.GroupBy(x => x.Category)) { var children = grouping.Select(x => new ExtensionVisualModel(x, !installed.Any(i => i.Header.Identifier == x.ProductId))).ToList(); temp.AllExtensions.AddRange(children); ExtensionCategory category = new ExtensionCategory { Name = grouping.Key, Extensions = children }; temp.Categories.Add(category); } return(temp); }
public static InstallerDialogViewModel From(IEnumerable <IExtensionModel> extensions) { var installed = ExtensionInstalledChecker.Instance.GetInstalledExtensions(); InstallerDialogViewModel temp = new InstallerDialogViewModel(); foreach (IGrouping <string, IExtensionModel> grouping in extensions.GroupBy(x => x.Category).OrderBy(x => GetConfig(x.Key).SortPriority).ThenBy(x => x.Key)) { CategoryConfiguration config = GetConfig(grouping.Key); ExtensionCategory category = new ExtensionCategory { IsExpanded = config.DefaultExpandedState, Name = grouping.Key }; var children = grouping.Select(x => new ExtensionVisualModel(category, x, config.DefaultCheckedState, installed.All(i => i.Header.Identifier != x.ProductId))).ToList(); category.Extensions = children; temp.AllExtensions.AddRange(children); temp.Categories.Add(category); } return(temp); }