private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            string functionName = this.GetBinding<string>(Binding_Name);
            string functionNamespace = this.GetBinding<string>(Binding_Namespace);
            string copyFromFunctionName = this.GetBinding<string>(Binding_CopyFromFunctionName);
            string functionFullName = functionNamespace + "." + functionName;

            var provider = GetFunctionProvider<UserControlFunctionProvider>();

            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);

            string fileName = functionName + ".ascx";
            string folder = Path.Combine(provider.PhysicalPath, functionNamespace.Replace('.', '\\'));
            string markupFilePath = Path.Combine(folder, fileName);
            string codeFilePath = markupFilePath + ".cs";

            string markupTemplate = NewUserControl_Markup;
            string code = NewUserControl_CodeFile;
            if (!copyFromFunctionName.IsNullOrEmpty())
            {
                GetFunctionCode(copyFromFunctionName, out markupTemplate, out code);
            }

            C1Directory.CreateDirectory(folder);
            C1File.WriteAllText(codeFilePath, code);
            C1File.WriteAllText(markupFilePath, markupTemplate.Replace(Marker_CodeFile, functionName + ".ascx.cs"));


            UserSettings.LastSpecifiedNamespace = functionNamespace;

            provider.ReloadFunctions();

            var newFunctionEntityToken = new FileBasedFunctionEntityToken(provider.Name, functionFullName);

            addNewTreeRefresher.PostRefreshMesseges(newFunctionEntityToken);

            var container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
            var executionService = container.GetService<IActionExecutionService>();
            executionService.Execute(newFunctionEntityToken, new WorkflowActionToken(typeof(EditUserControlFunctionWorkflow)), null);
        }
        private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            var provider = GetFunctionProvider<RazorFunctionProvider>();

            string functionName = this.GetBinding<string>(Binding_Name);
            string functionNamespace = ChangeNamespaceAccordingToExistingFolders(provider,this.GetBinding<string>(Binding_Namespace));
            string functionFullName = functionNamespace + "." + functionName;

            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);

            string fileName = functionName + ".cshtml";
            string folder = Path.Combine(provider.PhysicalPath, functionNamespace.Replace('.', '\\'));

            string cshtmlFilePath = Path.Combine(folder, fileName);

            string code;

            string copyFromFunction = this.GetBinding<string>(Binding_CopyFromFunctionName);
            if(string.IsNullOrEmpty(copyFromFunction))
            {
                code = NewRazorFunction_CSHTML;
            }
            else
            {
                code = GetFunctionCode(copyFromFunction);
            }

            C1Directory.CreateDirectory(folder);
            C1File.WriteAllText(cshtmlFilePath, code);

            UserSettings.LastSpecifiedNamespace = functionNamespace;

            provider.ReloadFunctions();

            var newFunctionEntityToken = new FileBasedFunctionEntityToken(provider.Name, functionFullName);

            addNewTreeRefresher.PostRefreshMesseges(newFunctionEntityToken);

            var container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);
            var executionService = container.GetService<IActionExecutionService>();
            executionService.Execute(newFunctionEntityToken, new WorkflowActionToken(typeof(EditRazorFunctionWorkflow)), null);
        }