示例#1
0
        private void InitializeCommands()
        {
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (!type.IsSubclassOf(typeof(CommandBase)) || type.IsAbstract)
                {
                    continue;
                }

                var instance = (CommandBase)Activator.CreateInstance(type, new object[] { this });

                if (instance.Command != "TEMPLATE")
                {
                    AllCommands.Add(instance);
                }
            }

            AllCommands = AllCommands.OrderBy(c => c.Command).ToList();
        }