示例#1
0
        private static readonly string guidanceIconPath = ""; //"Resources/CommandShowGuidance.png";

        /// <summary>
        /// Ensures the associated commands and launchpoint automation are created and configured correctly.
        /// </summary>
        internal void EnsureGuidanceExtensionAutomation()
        {
            IPatternElementSchema element            = this.Extends as IPatternElementSchema;
            Func <bool>           existanceCondition = () => !string.IsNullOrEmpty(this.ExtensionId);

            // Configure the instantiate command, event.
            var instantiateCommand = element.EnsureCommandAutomation <InstantiateGuidanceWorkflowCommand>(Properties.Resources.GuidanceExtension_InstantiateCommandName,
                                                                                                          existanceCondition);

            if (instantiateCommand != null)
            {
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, string>(cmd => cmd.ExtensionId, this.ExtensionId);
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, string>(cmd => cmd.DefaultInstanceName, this.GuidanceInstanceName);
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, bool>(cmd => cmd.SharedInstance, this.GuidanceSharedInstance);
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, bool>(cmd => cmd.ActivateOnInstantiation, this.GuidanceActivateOnCreation);
            }

            element.EnsureEventLaunchPoint <IOnElementInstantiatedEvent>(Properties.Resources.GuidanceExtension_InstantiateEventName,
                                                                         instantiateCommand, () => !String.IsNullOrEmpty(this.ExtensionId));

            // Configure the activate command and menu.
            var activateCommand = element.EnsureCommandAutomation <ActivateGuidanceWorkflowCommand>(Properties.Resources.GuidanceExtension_ActivateCommandName,
                                                                                                    existanceCondition);

            var activateMenu = element.EnsureMenuLaunchPoint(Resources.GuidanceExtension_ActivateContextMenuName,
                                                             activateCommand, Resources.GuidanceExtension_ActivateMenuItemText, guidanceIconPath,
                                                             existanceCondition);

            if (activateMenu != null)
            {
                // Set the conditions
                activateMenu.Conditions = BindingSerializer.Serialize(
                    new List <ConditionBindingSettings>
                {
                    new ConditionBindingSettings
                    {
                        TypeId     = typeof(ElementReferenceExistsCondition).FullName,
                        Properties =
                        {
                            new PropertyBindingSettings
                            {
                                Name  = Reflector <ElementReferenceExistsCondition> .GetPropertyName(cond => cond.Kind),
                                Value = ReferenceKindConstants.GuidanceTopic
                            },
                        }
                    }
                });
            }
        }
示例#2
0
        /// <summary>
        /// Ensures the associated commands and launchpoint automation are created and configured correctly.
        /// </summary>
        internal void EnsureValidationExtensionAutomation()
        {
            IPatternElementSchema element = this.Extends as IPatternElementSchema;

            // Configure the open command.
            var validateCommand = element.EnsureCommandAutomation <ValidateElementCommand>(
                Resources.ValidationExtension_ValidateCommandName,
                () => (this.ValidationOnBuild || this.ValidationOnMenu || this.ValidationOnSave || !String.IsNullOrEmpty(this.ValidationOnCustomEvent)));

            if (validateCommand != null)
            {
                validateCommand.SetPropertyValue <ValidateElementCommand, bool>(cmd => cmd.ValidateDescendants, true);
            }

            // Configure events.
            element.EnsureEventLaunchPoint <IOnProductStoreSavedEvent>(Resources.ValidationExtension_OnSaveEventName, validateCommand,
                                                                       () => this.ValidationOnSave);
            element.EnsureEventLaunchPoint <IOnBuildStartedEvent>(Resources.ValidationExtension_OnBuildEventName, validateCommand,
                                                                  () => this.ValidationOnBuild);
            element.EnsureEventLaunchPoint(this.ValidationOnCustomEvent, Resources.ValidationExtension_OnCustomEventName, validateCommand,
                                           () => !String.IsNullOrEmpty(this.ValidationOnCustomEvent));

            // Configure menu.
            element.EnsureMenuLaunchPoint(Resources.ValidationExtension_OnMenuContextMenuName, validateCommand,
                                          Resources.ValidationExtension_OnMenuMenuItemText, null,
                                          () => this.ValidationOnMenu);
        }
示例#3
0
        /// <summary>
        /// Ensures the associated commands and launchpoint automation are created and configured correctly.
        /// </summary>
        internal static void EnsureSyncNameExtensionAutomation(IPatternElementSchema pattern)
        {
            // Configure the sync command and menu.
            var syncCommand = pattern.EnsureCommandAutomation <SynchArtifactNameCommand>(
                Resources.SyncNameExtension_SyncNameCommandName,
                () => ShouldSyncName(pattern));

            syncCommand.SetPropertyValue <SynchArtifactNameCommand, string>(s => s.ReferenceTag, SynchArtifactNameCommand.FilteredReferenceTagValue);

            // Configure the sync event.
            pattern.EnsureEventLaunchPoint <IOnElementPropertyChangedEvent>(
                Resources.SyncNameExtension_SyncNameEventName,
                syncCommand,
                () => ShouldSyncName(pattern));
        }
示例#4
0
        /// <summary>
        /// Ensures the associated commands and launchpoint automation are created and configured correctly.
        /// </summary>
        internal static void EnsureSyncNameExtensionAutomation(IPatternElementSchema pattern)
        {
            // Configure the sync command and menu.
            var syncCommand = pattern.EnsureCommandAutomation<SynchArtifactNameCommand>(
                Resources.SyncNameExtension_SyncNameCommandName,
                () => ShouldSyncName(pattern));

            syncCommand.SetPropertyValue<SynchArtifactNameCommand, string>(s => s.ReferenceTag, SynchArtifactNameCommand.FilteredReferenceTagValue);

            // Configure the sync event.
            pattern.EnsureEventLaunchPoint<IOnElementPropertyChangedEvent>(
                Resources.SyncNameExtension_SyncNameEventName,
                syncCommand,
                () => ShouldSyncName(pattern));
        }