Beispiel #1
0
        /// <summary>
        /// Reconfigures this UI (can be called multiple times throughout controls lifetime) to facilitate the population of DemandsInitialization
        /// properties on an underlying type (e.g. if your collection is ProcessTask and your argument type is ProcessTaskArgument then your underlying type could
        /// be AnySeparatorFileAttacher or MDFAttacher).  Note that while T is IArgumentHost, it also should be tied to one or more interfaces (e.g. IAttacher) and able to host
        /// any child of that interface of which argumentsAreForUnderlyingType is the currently configured concrete class (e.g. AnySeparatorFileAttacher).
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="argumentsAreForUnderlyingType"></param>
        /// <param name="catalogueRepository"></param>
        public void Setup(IArgumentHost parent, Type argumentsAreForUnderlyingType, ICatalogueRepository catalogueRepository)
        {
            _parent          = parent;
            _argumentsAreFor = argumentsAreForUnderlyingType;

            lblTypeUnloadable.Visible = _argumentsAreFor == null;

            _valueUisFactory = new ArgumentValueUIFactory();

            if (_argumentsAreFor != null)
            {
                lblClassName.Text = _argumentsAreFor.FullName;
            }

            helpIcon1.Left = lblClassName.Right;

            if (_argumentsAreFor != null)
            {
                btnViewSourceCode.Enabled = ViewSourceCodeDialog.GetSourceForFile(_argumentsAreFor.Name + ".cs") != null;
                btnViewSourceCode.Left    = helpIcon1.Right;

                var summary = catalogueRepository.CommentStore.GetTypeDocumentationIfExists(argumentsAreForUnderlyingType);

                if (summary != null)
                {
                    helpIcon1.SetHelpText(_argumentsAreFor.Name, summary);
                }

                RefreshArgumentList();
            }
        }
        /// <summary>
        /// Reconfigures this UI (can be called multiple times throughout controls lifetime) to facilitate the population of DemandsInitialization
        /// properties on an underlying type (e.g. if your collection is ProcessTask and your argument type is ProcessTaskArgument then your underlying type could
        /// be AnySeparatorFileAttacher or MDFAttacher).  Note that while T is IArgumentHost, it also should be tied to one or more interfaces (e.g. IAttacher) and able to host
        /// any child of that interface of which argumentsAreForUnderlyingType is the currently configured concrete class (e.g. AnySeparatorFileAttacher).
        /// </summary>
        /// <param name="activator"></param>
        /// <param name="parent"></param>
        /// <param name="argumentsAreForUnderlyingType"></param>
        /// <param name="catalogueRepository"></param>
        public void Setup(IActivateItems activator, IArgumentHost parent, Type argumentsAreForUnderlyingType, ICatalogueRepository catalogueRepository)
        {
            _parent          = parent;
            _argumentsAreFor = argumentsAreForUnderlyingType;
            _activator       = activator;

            bool typeLoadable = !(_argumentsAreFor == null);

            lblTypeUnloadable.Visible = !typeLoadable;

            lblClassName.Visible         = typeLoadable;
            helpIcon1.Visible            = typeLoadable;
            lblArgumentsTitle.Visible    = typeLoadable;
            pArguments.Visible           = typeLoadable;
            lblComponentNotFound.Visible = !pArguments.Visible;

            _valueUisFactory = new ArgumentValueUIFactory();

            if (_argumentsAreFor != null)
            {
                lblClassName.Text = UsefulStuff.PascalCaseStringToHumanReadable(_argumentsAreFor.Name);
            }

            helpIcon1.Left = lblClassName.Right;

            if (_argumentsAreFor != null)
            {
                var summary = catalogueRepository.CommentStore.GetTypeDocumentationIfExists(argumentsAreForUnderlyingType);

                if (summary != null)
                {
                    helpIcon1.SetHelpText(_argumentsAreFor.Name, summary);
                }
                else
                {
                    helpIcon1.ClearHelpText();
                }

                RefreshArgumentList();
            }
        }