예제 #1
0
 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;
 }
예제 #2
0
        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;
        }