Пример #1
0
        /// <summary>
        /// 生成命令对象
        /// </summary>
        /// <returns></returns>
        protected NotificationList <CommandItemBase> CreateCommands(bool edit, bool create, bool ext)
        {
            NotificationList <CommandItemBase> commands = new NotificationList <CommandItemBase>();

            if (edit)
            {
                commands.Add(new CommandItem
                {
                    IsButton  = true,
                    NoConfirm = true,
                    Action    = CopyColumns,
                    Caption   = "复制列",
                    Image     = Application.Current.Resources["tree_item"] as ImageSource
                });
                commands.Add(new CommandItem
                {
                    IsButton  = true,
                    Action    = PasteColumns,
                    NoConfirm = true,
                    Caption   = "粘贴列",
                    Image     = Application.Current.Resources["tree_item"] as ImageSource
                });
                commands.Add(new CommandItem
                {
                    IsButton = true,
                    Action   = ClearColumns,
                    Caption  = "清除列",
                    Image    = Application.Current.Resources["img_del"] as ImageSource
                });
                commands.Add(new CommandItem
                {
                    IsButton = true,
                    Action   = DeleteColumns,
                    Caption  = "删除所选列",
                    Image    = Application.Current.Resources["img_del"] as ImageSource
                });
                commands.Add(new CommandItem
                {
                    IsButton  = true,
                    Action    = AddProperty,
                    NoConfirm = true,
                    Caption   = "新增字段",
                    Image     = Application.Current.Resources["tree_Open"] as ImageSource
                });
            }
            if (create)
            {
                CreateCommands(commands);
            }
            if (ext)
            {
                var extends = CommandCoefficient.CoefficientEditor(typeof(EntityConfig), EditorName);
                if (extends.Count > 0)
                {
                    commands.AddRange(extends);
                }
            }
            return(commands);
        }
Пример #2
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand(new CommandItemBuilder <string, string>(ImportStructParpare, ImportStruct, ImportStructEnd)
     {
         Caption  = "导入MySql数据库",
         Catalog  = "文件",
         IconName = "tree_Assembly"
     });
 }
Пример #3
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand(new CommandItemBuilder <object, int>(BeginImportSqlServer, DoImportSqlServer, EndImportSqlServer)
     {
         Caption  = "导入SqlServer数据库",
         Catalog  = "文件",
         IconName = "tree_Assembly"
     });
 }
Пример #4
0
 public static void Register()
 {
     CommandCoefficient.RegisterConvert <EntityConfig, PropertyConfig>(Entity2Property);
     CommandCoefficient.RegisterConvert <ProjectConfig, PropertyConfig>(Project2Property);
     CommandCoefficient.RegisterConvert <SolutionConfig, PropertyConfig>(Solution2Property);
     CommandCoefficient.RegisterConvert <ProjectConfig, EntityConfig>(Project2Entity);
     CommandCoefficient.RegisterConvert <SolutionConfig, EntityConfig>(Solution2Entity);
     CommandCoefficient.RegisterConvert <SolutionConfig, ProjectConfig>(Solution2Project);
 }
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand <EntityConfig, ActionItem>(new ActionItem
     {
         Action   = ToIDataState,
         Name     = "实现IStateData接口",
         Catalog  = "数据模型",
         Tag      = "Model,Struct",
         Signle   = true,
         NoButton = true,
         Image    = Application.Current.Resources["img_link"] as ImageSource
     });
     CommandCoefficient.RegisterCommand <EntityConfig, ActionItem>(new ActionItem
     {
         Action   = ToIHistory,
         Name     = "实现IHistory接口",
         Catalog  = "数据模型",
         Tag      = "Model,Struct",
         Signle   = true,
         NoButton = true,
         Image    = Application.Current.Resources["img_link"] as ImageSource
     });
     CommandCoefficient.RegisterCommand <EntityConfig, ActionItem>(new ActionItem
     {
         Action   = ToIAudit,
         Name     = "实现IAudit接口",
         Catalog  = "数据模型",
         Tag      = "Model,Struct",
         Signle   = true,
         NoButton = true,
         Image    = Application.Current.Resources["img_link"] as ImageSource
     });
     CommandCoefficient.RegisterCommand <EntityConfig, ActionItem>(new ActionItem
     {
         Action   = ToMemo,
         Name     = "添加备注字段",
         Catalog  = "数据模型",
         Tag      = "Model,Struct",
         Signle   = true,
         NoButton = true,
         Image    = Application.Current.Resources["img_link"] as ImageSource
     });
     CommandCoefficient.RegisterCommand <EntityConfig, ActionItem>(new ActionItem
     {
         Action   = ToSelfRelation,
         Name     = "添加同表上级关联字段",
         Catalog  = "数据模型",
         Tag      = "Model,Struct",
         Signle   = true,
         NoButton = true,
         Image    = Application.Current.Resources["img_link"] as ImageSource
     });
 }
Пример #6
0
 /// <summary>
 ///     初始化
 /// </summary>
 protected override void DoInitialize()
 {
     CommandCoefficient.RegisterCommand <ClassUpgradeConfig>(new CommandItemBuilder
     {
         Command  = new DelegateCommand <ClassUpgradeConfig>(AddProperty),
         Name     = "增加字段",
         IconName = "img_add"
     });
     base.DoInitialize();
     Load();
     CreateTree();
     TreeRoot.SelectItemChanged += OnTreeSelectItemChanged;
 }
Пример #7
0
        /// <summary>
        /// 注册代码
        /// </summary>
        void IAutoRegister.AutoRegist()
        {
            var commands = CreateCommands();

            foreach (var command in commands)
            {
                if (command.Catalog == null)
                {
                    command.Catalog = Catalog;
                }
                CommandCoefficient.RegisterCommand(command);
            }
        }
Пример #8
0
        /// <summary>
        /// 生成命令对象
        /// </summary>
        /// <returns></returns>
        protected virtual List <CommandItem> CreateCommands()
        {
            var commands = new List <CommandItem>();

            CreateCommands(commands);

            var extends = CommandCoefficient.Coefficient(typeof(EntityConfig), Catalog);

            if (extends.Count > 0)
            {
                commands.AddRange(extends);
            }
            return(commands);
        }
Пример #9
0
        /// <summary>
        /// 生成命令对象
        /// </summary>
        /// <returns></returns>
        public override ObservableCollection <CommandItemBase> CreateCommands()
        {
            ObservableCollection <CommandItemBase> commands = new ObservableCollection <CommandItemBase>
            {
                new CommandItem
                {
                    IsButton = true,
                    Action   = (CopyColumns),
                    Caption  = "复制列",
                    Image    = Application.Current.Resources["tree_item"] as ImageSource
                },
                new CommandItem
                {
                    IsButton = true,
                    Action   = (PasteColumns),
                    Caption  = "粘贴列",
                    Image    = Application.Current.Resources["tree_item"] as ImageSource
                },
                new CommandItem
                {
                    IsButton = true,
                    Action   = (ClearColumns),
                    Caption  = "清除列",
                    Image    = Application.Current.Resources["img_del"] as ImageSource
                },
                new CommandItem
                {
                    IsButton = true,
                    Action   = (DeleteColumns),
                    Caption  = "删除所选列",
                    Image    = Application.Current.Resources["img_del"] as ImageSource
                },
                new CommandItem
                {
                    IsButton = true,
                    Action   = (AddProperty),
                    Caption  = "新增字段",
                    Image    = Application.Current.Resources["tree_Open"] as ImageSource
                }
            };

            CreateCommands(commands);
            var extends = CommandCoefficient.CoefficientEditor(typeof(EntityConfig), EditorName);

            if (extends.Count > 0)
            {
                commands.AddRange(extends);
            }
            return(commands);
        }
Пример #10
0
        /// <summary>
        /// 生成命令对象
        /// </summary>
        /// <returns></returns>
        public virtual ObservableCollection <CommandItemBase> CreateCommands()
        {
            var commands = new ObservableCollection <CommandItemBase>();

            CreateCommands(commands);

            var extends = CommandCoefficient.CoefficientEditor(typeof(EntityConfig), EditorName);

            if (extends.Count > 0)
            {
                commands.AddRange(extends);
            }

            return(commands);
        }
Пример #11
0
        /// <summary>
        /// 构建命令列表
        /// </summary>
        public void CreateCommandList()
        {
            _commands = new List <CommandItem>();
            var actions = CommandCoefficient.Coefficient(Source);

            foreach (var action in actions)
            {
                action.Tag       = Source;
                action.Parameter = Source;
                _commands.Add(action);
            }
            CreateCommandList(_commands);
            RaisePropertyChanged(nameof(Buttons));
            RaisePropertyChanged(nameof(Menus));
        }
Пример #12
0
        /// <summary>
        /// 注册代码
        /// </summary>
        void IAutoRegister.AutoRegist()
        {
            var commands = CreateCommands();

            foreach (var command in commands)
            {
                if (command.Catalog == null)
                {
                    command.Catalog = Catalog;
                }
                if (command.SourceType == null)
                {
                    command.SourceType = SourceType;
                }
                CommandCoefficient.RegisterCommand <TConfig>(command);
            }
        }
Пример #13
0
        protected override ObservableCollection <CommandItemBase> CreateCommands()
        {
            var commands = new ObservableCollection <CommandItemBase>();

            var extends = CommandCoefficient.CoefficientEditor(typeof(EnumConfig));

            foreach (var cms in extends)
            {
                cms.SignleSoruce = true;
                if (cms.TargetType != typeof(EnumConfig))
                {
                    continue;
                }
                cms.OnPrepare = Model.OnCommandExec;
                commands.Add(cms);
            }
            return(commands);
        }
Пример #14
0
        /// <summary>
        /// 生成命令对象
        /// </summary>
        /// <returns></returns>
        protected override List <CommandItem> CreateCommands()
        {
            List <CommandItem> commands = new List <CommandItem>
            {
                new CommandItem
                {
                    Command = new DelegateCommand(CopyColumns),
                    Name    = "复制列",
                    Image   = Application.Current.Resources["tree_item"] as ImageSource
                },
                new CommandItem
                {
                    Command = new DelegateCommand(PasteColumns),
                    Name    = "粘贴列",
                    Image   = Application.Current.Resources["tree_item"] as ImageSource
                },
                new CommandItem
                {
                    NoButton = true,
                    Command  = new DelegateCommand(ClearColumns),
                    Name     = "清除列",
                    Image    = Application.Current.Resources["img_del"] as ImageSource
                },
                new CommandItem
                {
                    NoButton = true,
                    Command  = new DelegateCommand(DeleteColumns),
                    Name     = "删除所选列",
                    Image    = Application.Current.Resources["img_del"] as ImageSource
                }
            };

            CreateCommands(commands);
            var extends = CommandCoefficient.Coefficient(typeof(EntityConfig), Catalog);

            if (extends.Count > 0)
            {
                commands.AddRange(extends);
            }
            return(commands);
        }
Пример #15
0
        /// <summary>
        /// 注册代码
        /// </summary>
        void IAutoRegister.AutoRegist()
        {
            CommandCoefficient.RegisterCommand(new CommandItemBuilder <ConfigBase>
            {
                Action  = Name2CaptionChiness,
                Caption = "翻译成中文(名称到标题)",
                Catalog = "翻译",

                IconName = "imgBaidu"
            });
            CommandCoefficient.RegisterCommand(new CommandItemBuilder <ConfigBase>
            {
                Action      = ToChiness,
                Caption     = "翻译成中文(标题与说明)",
                Catalog     = "翻译",
                Description = "通过百度翻译接口,将字段的标题与说明从英文翻译成中文(需要网络连接)",

                IconName = "imgBaidu"
            });
            CommandCoefficient.RegisterCommand(new CommandItemBuilder <ConfigBase>
            {
                Catalog     = "翻译",
                Caption     = "翻译标题(中译英)",
                Action      = CaptionToEnglish,
                Description = "通过百度翻译接口,将标题从中文翻译成英文(需要网络连接)",

                IconName = "imgBaidu"
            });
            CommandCoefficient.RegisterCommand(new CommandItemBuilder <ConfigBase>
            {
                Catalog = "翻译",
                Caption = "翻译名称(中译英)",
                Action  = NameToEnglish,

                Description = "通过百度翻译接口,将名称从中文翻译成英文(需要网络连接)",
                IconName    = "imgBaidu"
            });
        }
Пример #16
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand <ConfigBase, ActionItem>(new ActionItem
     {
         Action     = ToChiness2,
         Name       = "翻译成中文(名称到标题)",
         Catalog    = "数据模型",
         NoButton   = true,
         Tag        = "Model,Struct",
         SourceType = "EntityConfig,PropertyConfig",
         Image      = Application.Current.Resources["img_link"] as ImageSource
     });
     CommandCoefficient.RegisterCommand <ConfigBase, ActionItem>(new ActionItem
     {
         Action     = ToChiness,
         Name       = "翻译成中文(标题到注释)",
         Catalog    = "数据模型",
         NoButton   = true,
         Tag        = "Model,Struct",
         SourceType = "EntityConfig,PropertyConfig",
         Image      = Application.Current.Resources["img_link"] as ImageSource
     });
 }
Пример #17
0
 protected override void OnSourceChanged(bool isRemove)
 {
     if (_commands == null)
     {
         return;
     }
     if (isRemove)
     {
         foreach (var cmd in _commands.Where(p => p.Tag == Source).ToArray())
         {
             _commands.Remove(cmd);
         }
     }
     else
     {
         var actions = CommandCoefficient.Coefficient(Source);
         foreach (var action in actions)
         {
             action.Tag = Source;
             _commands.Add(action);
         }
     }
 }
Пример #18
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand <InterfaceHelper>();
 }
Пример #19
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand <EntityHelper>();
 }
Пример #20
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand <EntityConfig, InterfaceHelper>();
 }
Пример #21
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     NoButton = true;
     Signle   = true;
     CommandCoefficient.RegisterCommand <ProjectConfig, SqlServerImporter>();
 }
Пример #22
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand <EntityConfig, LinkFieldCheck>();
 }
Пример #23
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     NoButton = true;
     Signle   = true;
     CommandCoefficient.RegisterCommand <SolutionConfig, MySqlImporter>();
 }
Пример #24
0
 /// <summary>
 /// 注册代码
 /// </summary>
 void IAutoRegister.AutoRegist()
 {
     CommandCoefficient.RegisterCommand <LinkFieldCheck>();
 }