Exemple #1
0
        public override void SetDatabaseObject(IActivateItems activator, ProcessTask databaseObject)
        {
            _processTask = databaseObject;
            base.SetDatabaseObject(activator, databaseObject);

            if (_argumentCollection == null)
            {
                var repo = databaseObject.CatalogueRepository;

                _argumentCollection = new ArgumentCollectionUI();

                var className = databaseObject.GetClassNameWhoArgumentsAreFor();

                if (string.IsNullOrWhiteSpace(className))
                {
                    activator.KillForm(ParentForm, new Exception("No class has been specified on ProcessTask '" + databaseObject + "'"));
                    return;
                }

                try
                {
                    _underlyingType = repo.MEF.GetType(className);

                    if (_underlyingType == null)
                    {
                        activator.KillForm(ParentForm, new Exception("Could not find Type '" + className + "' for ProcessTask '" + databaseObject + "'"));
                    }
                }
                catch (Exception e)
                {
                    activator.KillForm(ParentForm, new Exception("MEF crashed while trying to look up Type '" + className + "' for ProcessTask '" + databaseObject + "'", e));
                    return;
                }

                _argumentCollection.Setup(databaseObject, _underlyingType, Activator.RepositoryLocator.CatalogueRepository);

                _argumentCollection.Dock = DockStyle.Fill;
                pArguments.Controls.Add(_argumentCollection);
            }

            CommonFunctionality.Add(_ragSmiley);

            CheckComponent();

            loadStageIconUI1.Setup(Activator.CoreIconProvider, _processTask.LoadStage);

            CommonFunctionality.Add(new ToolStripButton("Check", FamFamFamIcons.arrow_refresh, (s, e) => CheckComponent()));
        }