/// <exclude /> public static void FunctionRenamed(IInlineFunction newFunction, IInlineFunction oldFunction) { newFunction.UpdateCodePath(); string directoryPath = PathUtil.Resolve(GlobalSettingsFacade.InlineCSharpFunctionDirectory); string oldFilepath = Path.Combine(directoryPath, oldFunction.CodePath); string newFilepath = Path.Combine(directoryPath, newFunction.CodePath); C1File.Move(oldFilepath, newFilepath); }
private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e) { IInlineFunction function = this.GetBinding <IInlineFunction>("NewFunction"); function.UpdateCodePath(); string selectedTemplate = this.GetBinding <string>("SelectedTemplate"); string codeTemplate; switch (selectedTemplate) { case "clean": codeTemplate = _cleanTemplate; break; case "parameter": codeTemplate = _parameterTemplate; List <ManagedParameterDefinition> parameters = new List <ManagedParameterDefinition>(); ManagedParameterDefinition parameter1 = new ManagedParameterDefinition(); parameter1.Id = Guid.NewGuid(); parameter1.Name = "myIntValue"; parameter1.Label = "myIntValue"; parameter1.HelpText = "myIntValue"; parameter1.Position = 0; parameter1.Type = typeof(int); parameter1.TestValueFunctionMarkup = "<f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Constant.Integer\"><f:param name=\"Constant\" value=\"0\" /></f:function>"; parameter1.WidgetFunctionMarkup = "<f:widgetfunction xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Widgets.Integer.TextBox\" label=\"myIntValue\" bindingsourcename=\"\"><f:helpdefinition xmlns:f=\"http://www.composite.net/ns/function/1.0\" helptext=\"myIntValue\" /></f:widgetfunction>"; parameters.Add(parameter1); ManagedParameterDefinition parameter2 = new ManagedParameterDefinition(); parameter2.Id = Guid.NewGuid(); parameter2.Name = "myStringValue"; parameter2.Label = "myStringValue"; parameter2.HelpText = "myStringValue"; parameter2.Position = 1; parameter2.Type = typeof(string); parameter2.TestValueFunctionMarkup = "<f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Constant.String\"><f:param name=\"Constant\" value=\"Hello world!\" /></f:function>"; parameter2.WidgetFunctionMarkup = "<f:widgetfunction xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Widgets.String.TextBox\" label=\"myStringValue\" bindingsourcename=\"\"><f:helpdefinition xmlns:f=\"http://www.composite.net/ns/function/1.0\" helptext=\"myStringValue\" /></f:widgetfunction>"; parameters.Add(parameter2); ManagedParameterManager.Save(function.Id, parameters); break; case "dataconnection": codeTemplate = _dataConnectionTemplate; break; default: throw new NotImplementedException(); } string code = string.Format(codeTemplate, function.Namespace, InlineFunctionHelper.MethodClassContainerName, function.Name); code = code.Replace('и', '\t'); using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope()) { foreach (string assemblyPath in InlineFunctionHelper.DefaultAssemblies) { IInlineFunctionAssemblyReference reference = DataFacade.BuildNew <IInlineFunctionAssemblyReference>(); reference.Id = Guid.NewGuid(); reference.Function = function.Id; reference.Name = System.IO.Path.GetFileName(assemblyPath); reference.Location = InlineFunctionHelper.GetAssemblyLocation(assemblyPath); DataFacade.AddNew(reference); } function.SetFunctinoCode(code); function = DataFacade.AddNew(function); UserSettings.LastSpecifiedNamespace = function.Namespace; transactionScope.Complete(); } this.CloseCurrentView(); this.CreateAddNewTreeRefresher(this.EntityToken).PostRefreshMesseges(function.GetDataEntityToken()); this.ExecuteWorklow(function.GetDataEntityToken(), WorkflowFacade.GetWorkflowType("Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.EditInlineFunctionWorkflow")); }
/// <exclude /> public static void FunctionRenamed(IInlineFunction newFunction, IInlineFunction oldFunction) { newFunction.UpdateCodePath(); string directoryPath = PathUtil.Resolve(GlobalSettingsFacade.InlineCSharpFunctionDirectory); string oldFilepath = Path.Combine(directoryPath, oldFunction.CodePath); string newFilepath = Path.Combine(directoryPath, newFunction.CodePath); C1File.Move(oldFilepath, newFilepath); }