Exemple #1
0
        public ShellCommandMenuItem(ShellCommandMenuModel model, IconManager iconManager)
        {
            Model         = model ?? throw new ArgumentNullException(nameof(model));
            m_iconManager = iconManager ?? throw new ArgumentNullException(nameof(iconManager));
            InitializeComponent();
            Click += ShellCommandMenuItem_Click;

            var    command = Model.Command;
            string appFullPath;

            if (command.Application != null)
            {
                appFullPath = Model.OpenWith.ApplicationFullPaths[command.Application];
            }
            else
            {
                appFullPath = command.GetApplication();
            }
            Header = command.FriendlyName ?? FileHelper.DisplayNameForApplication(command.Application, appFullPath);

            var icon  = m_iconManager.GetImageForApplicationName(appFullPath);
            var image = new Image()
            {
                Source = icon
            };

            Icon = image;
        }