Пример #1
0
        /// <summary>
        ///     发出属性修改前事件
        /// </summary>
        /// <param name="property">属性</param>
        /// <param name="oldValue">旧值</param>
        /// <param name="newValue">新值</param>
        protected override void BeforePropertyChangedInner(string property, object oldValue, object newValue)
        {
            switch (property)
            {
            case nameof(TargetConfig.Entities):
                if (oldValue != null)
                {
                    ((INotifyCollectionChanged)oldValue).CollectionChanged -= EntitiesCollectionChanged;
                }
                break;

            case nameof(TargetConfig.Projects):
                if (oldValue != null)
                {
                    ((INotifyCollectionChanged)oldValue).CollectionChanged -= ConfigCollectionChanged;
                }
                break;

            case nameof(TargetConfig.NotifyItems):
                if (oldValue != null)
                {
                    ((INotifyCollectionChanged)oldValue).CollectionChanged -= ConfigCollectionChanged;
                }
                break;

            case nameof(TargetConfig.ApiItems):
                if (oldValue != null)
                {
                    ((INotifyCollectionChanged)oldValue).CollectionChanged -= ConfigCollectionChanged;
                }
                break;

            case nameof(TargetConfig.Enums):
                if (oldValue != null)
                {
                    ((INotifyCollectionChanged)oldValue).CollectionChanged -= ConfigCollectionChanged;
                }
                break;

            case nameof(TargetConfig.RootPath):
                SolutionModel model = new SolutionModel
                {
                    Solution = TargetConfig
                };
                model.CheckProjectPath((string)oldValue, (string)newValue);
                break;
            }
        }