public ToolItem(ToolListConfiguration model) { this.Icon = ShellIcon.GetIconFor(string.IsNullOrEmpty(model.Icon) ? model.Path : model.Icon); this.Model = model; this.Header = model.Name; this.Description = model.Path == null ? null : model.Path; this.IsUac = model.AsAdmin; }
public ToolViewModel(IInteractionService interactionService, ToolListConfiguration model) { this.model = model; this.AddChildren( this.Path = new ChangeableFileProperty("Command path", interactionService, model.Path, ValidatePath), this.Name = new ValidatedChangeableProperty <string>("Command name", model.Name, ValidateName), this.Icon = new ChangeableFileProperty("Command icon", interactionService, model.Icon), this.Arguments = new ChangeableProperty <string>(model.Arguments), this.AsAdmin = new ChangeableProperty <bool>(model.AsAdmin) ); this.Path.ValueChanged += (sender, args) => { this.OnPropertyChanged(nameof(Image)); }; this.Icon.ValueChanged += this.IconOnValueChanged; }