Esempio n. 1
0
        /// <summary>
        /// Handles the property change event for the settings.
        /// </summary>
        /// <param name="e">The event args.</param>
        public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e)
        {
            Guard.NotNull(() => e, e);

            base.ElementPropertyChanged(e);

            var changedCommand = e.ModelElement as CommandSettings;

            if (changedCommand != null && changedCommand.Extends != null)
            {
                if (e.DomainProperty.Id == CommandSettings.PropertiesDomainPropertyId)
                {
                    if (!e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing)
                    {
                        // Find all unfold commands on the same element that changed
                        var element        = changedCommand.Owner;
                        var unfoldCommands = element.AutomationSettings
                                             .Select(s => s.As <ICommandSettings>())
                                             .Where(s => s != null && s.TypeId == typeof(UnfoldVsTemplateCommand).FullName);
                        if (unfoldCommands.Any())
                        {
                            unfoldCommands.ToList().ForEach(cmd =>
                            {
                                tracer.Shield(() =>
                                {
                                    SyncNameExtension.EnsureSyncNameExtensionAutomation(changedCommand.Owner);
                                }, Resources.UnfoldVsCommandChangeRule_ErrorSyncNameFailed, cmd.Name);
                            });
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the property change event for the settings.
        /// </summary>
        /// <param name="e">The event args.</param>
        public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e)
        {
            Guard.NotNull(() => e, e);

            if (e.DomainProperty.Id == TemplateSettings.SyncNameDomainPropertyId)
            {
                var template = e.ModelElement as TemplateSettings;
                if (template != null && template.Extends != null)
                {
                    if (!e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing)
                    {
                        tracer.Shield(() =>
                        {
                            SyncNameExtension.EnsureSyncNameExtensionAutomation(template.Owner);
                        },
                                      Resources.TemplateSettingsChangeRule_ErrorSyncNameFailed, template.Name);
                    }
                }
            }
        }