コード例 #1
0
        protected override void OnOK(object sender, EventArgs args)
        {
            CustomItemSettings settings = new CustomItemSettings(HttpContext.Current);

            ICustomItemNamespaceProvider namespaceProvider = AssemblyUtil.GetNamespaceProvider(settings.NamespaceProvider);
            ICustomItemFolderPathProvider filePathProvider = AssemblyUtil.GetFilePathProvider(settings.FilepathProvider);

            CustomItemInformation customItemInformation = new CustomItemInformation(template, CustomItemNamespace.Value,
                                                                                    CustomItemFilePath.Value, filePathProvider, namespaceProvider);

            if (settings.AutoUpdate) {
                new CodeGenerator(customItemInformation, true, false, false, false).GenerateCode();
            }
            else {
                CodeGenerator codeGenerator = new CodeGenerator(customItemInformation,
                            GenerateBaseFile.Checked, GenerateInstanceFile.Checked, GenerateInterfaceFile.Checked, GenerateStaticFile.Checked);
                codeGenerator.GenerateCode();

                SheerResponse.Alert(codeGenerator.GenerationMessage, new string[0]);
            }
            base.OnOK(sender, args);
        }
コード例 #2
0
        protected override void OnOK(object sender, EventArgs args)
        {
            foreach (ChecklistItem template in TemplateList.Items)
            {
                //Do nothing if the template has not been selected
                if (!template.Checked) continue;

                //Try and get the template
                TemplateItem templateItem = masterDb.GetItem(template.Value);
                if (templateItem == null) continue;

                //Using the settings item get the providers needed for creating both the namespaces for the custom items
                // as well as the file/folder strucutre.
                CustomItemSettings settings = new CustomItemSettings(HttpContext.Current);

                ICustomItemNamespaceProvider namespaceProvider =
                    AssemblyUtil.GetNamespaceProvider(settings.NamespaceProvider);

                ICustomItemFolderPathProvider filePathProvider = AssemblyUtil.GetFilePathProvider(settings.FilepathProvider);

                //Get all the custom item information
                CustomItemInformation customItemInformation = new CustomItemInformation(templateItem, CustomItemNamespace.Value,
                                                                                        CustomItemFilePath.Value,
                                                                                        filePathProvider,
                                                                                        namespaceProvider);
                //Generate the class file(s)
                CodeGenerator codeGenerator =
                    new CodeGenerator(customItemInformation,
                                      GenerateBaseFile.Checked, GenerateInstanceFile.Checked, GenerateInterfaceFile.Checked,
                                      GenerateStaticFile.Checked);

                codeGenerator.GenerateCode();
            }

            SheerResponse.Alert("Custom items sucessfully generated.", new string[0]);

            base.OnOK(sender, args);
        }