Пример #1
0
        private void buttonAddProjectScreensFunction_Click(object sender, EventArgs e)
        {
            FunctionInfo function = new FunctionInfo(TemplateHelper.CustomNewProjectScreensFunctionName, null, "", false,
                                                     SyntaxEditorHelper.ScriptLanguageTypes.CSharp,
                                                     "Creates a list of custom screens that should be shown during the creation of new Workbench projects.",
                                                     "C#", "General");

            function.AddParameter(new ParamInfo("screens", typeof(List<INewProjectScreen>), "out"));

            Project.Instance.AddFunction(function);

            Controller.Instance.MainForm.ShowFunction(function, this);
            RibbonBarController.RefreshButtonStatus(this);
        }
Пример #2
0
        private void buttonAddLoadFunction_Click(object sender, EventArgs e)
        {
            FunctionInfo function = new FunctionInfo(TemplateHelper.LoadFunctionName, null, "", false,
                                                     SyntaxEditorHelper.ScriptLanguageTypes.CSharp,
                                                     "Loads any additional information from an existing Workbench project",
                                                     "C#", "General");

            function.AddParameter(new ParamInfo("outputFolder", typeof(string)));
            function.AddParameter(new ParamInfo("provider", typeof(IEnumerable<ProviderInfo>)));
            function.AddParameter(new ParamInfo("extraData", typeof(TemplateData)));

            Project.Instance.AddFunction(function);

            Controller.Instance.MainForm.ShowFunction(function, this);
            RibbonBarController.RefreshButtonStatus(this);
        }
Пример #3
0
        private void buttonAddPreGenerationFunction_Click(object sender, EventArgs e)
        {
            FunctionInfo function = new FunctionInfo(TemplateHelper.PreGenerationModelProcessingFunctionName, null, "", false,
                                                     SyntaxEditorHelper.ScriptLanguageTypes.CSharp,
                                                     "Initialises the Provider from the template before generation of the files",
                                                     "C#", "General");

            function.AddParameter(new ParamInfo("providerInfo", typeof(ProviderInfo)));
            function.AddParameter(new ParamInfo("data", typeof(PreGenerationData)));

            Project.Instance.AddFunction(function);

            Controller.Instance.MainForm.ShowFunction(function, this);
            RibbonBarController.RefreshButtonStatus(this);
        }
        protected virtual void ProcessFunctionParameters(FunctionInfo info, XmlNode functionNode)
        {
            var parametersNode = functionNode["Parameters"];
            if (parametersNode == null) throw new DeserialisationException("Could not find Parameters node");

            var parameterNodes = parametersNode.SelectNodes("Parameter");
            if (parameterNodes == null) return;

            foreach (XmlNode paramNode in parameterNodes)
            {
                var name = paramNode.Attributes["name"].Value;
                var typeName = paramNode.Attributes["type"].Value;
                var modifiers = paramNode.Attributes["modifiers"].Value;
                var paramType = GetTypeNamed(typeName);

                ParamInfo pi = new ParamInfo(name, paramType) { Modifiers = modifiers };
                info.AddParameter(pi);
            }
        }