Beispiel #1
0
        private void GetCommandMetadataCallback(IPowerShellCommandMetadata result)
        {
            Model = CommandModelFactory.GenerateCommandModel(result);

            if (Model != null)
            {
                UpdateCommandPreview();
                Model.PropertyChanged += OnCommandModelPropertyChanged;
            }

            IsBusy = false;
        }
        internal static CommandModel GenerateCommandModel(IPowerShellCommandMetadata metadata)
        {
            if (metadata == null)
            {
                return(null);
            }

            var commandName   = metadata.Name;
            var parameters    = GetParameters(metadata.Parameters);
            var parameterSets = GetParameterSets(metadata.Parameters);

            return(new CommandModel(commandName, parameters, parameterSets));
        }
        private void GetCommandMetadataCallback(IPowerShellCommandMetadata result)
        {
            try
            {
                Model = CommandModelFactory.GenerateCommandModel(result);

                if (Model != null)
                {
                    _hostWindow.SetCaption(Model.Name);
                    UpdateCommandPreview();
                    Model.PropertyChanged += OnCommandModelPropertyChanged;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error while creating command model", ex);
            }
            finally
            {
                IsBusy = false;
            }
        }