private CodeJavaScriptLinkedSystemFormCopyToClipboardTabsAndSectionsInConnectionCommand(
     OleMenuCommandService commandService
     , int baseIdStart
     , JavaScriptObjectType jsObjectType
     ) : base(commandService, baseIdStart)
 {
     this._jsObjectType = jsObjectType;
 }
Exemple #2
0
 public CreateFormTabsJavaScriptHandler(
     TextWriter writer
     , CreateFileJavaScriptConfiguration config
     , JavaScriptObjectType javaScriptObjectType
     , IOrganizationServiceExtented service
     ) : base(writer, config.TabSpacer, true)
 {
     this._config  = config;
     this._service = service;
     this._javaScriptObjectType = javaScriptObjectType;
 }
Exemple #3
0
 public JavaScriptObject(JavaScriptObjectType type = JavaScriptObjectType.Null)
 {
     Type = type;
     if (Type == JavaScriptObjectType.Object)
     {
         _objectValue = new Dictionary <string, JavaScriptObject>();
     }
     else if (Type == JavaScriptObjectType.Array)
     {
         _arrayValue = new List <JavaScriptObject>();
     }
 }
Exemple #4
0
 public void SetBoolean(bool value)
 {
     if (Type == JavaScriptObjectType.Null)
     {
         Type = JavaScriptObjectType.Boolean;
     }
     if (Type == JavaScriptObjectType.Boolean)
     {
         _baseValue = value;
     }
     else
     {
         throw new Exception("该对象不是一个布尔值类型");
     }
 }
Exemple #5
0
 public void SetString(string value)
 {
     if (Type == JavaScriptObjectType.Null)
     {
         Type = JavaScriptObjectType.String;
     }
     if (Type == JavaScriptObjectType.String)
     {
         _baseValue = value;
     }
     else
     {
         throw new Exception("该对象不是一个字符串类型");
     }
 }
Exemple #6
0
 public void SetNumber(double value)
 {
     if (Type == JavaScriptObjectType.Null)
     {
         Type = JavaScriptObjectType.Number;
     }
     if (Type == JavaScriptObjectType.Number)
     {
         _baseValue = value;
     }
     else
     {
         throw new Exception("该对象不是一个数值类型");
     }
 }
Exemple #7
0
 public void HandleSystemFormCopyToClipboardTabsAndSectionsCommand(ConnectionData connectionData, JavaScriptObjectType jsObjectType, string entityName, Guid formId, int formType)
 {
     GetConnectionConfigAndExecute(connectionData, (conn, commonConfig) => Controller.StartSystemFormCopyToClipboardTabsAndSections(conn, commonConfig, jsObjectType, entityName, formId, formType));
 }
        private async Task CopingToClipboardSystemFormCurrentTabsAndSections(IOrganizationServiceExtented service, CommonConfiguration commonConfig, JavaScriptObjectType jsObjectType, string entityName, Guid formId, int formType)
        {
            var repositorySystemForm = new SystemFormRepository(service);

            var systemForm = await repositorySystemForm.GetByIdAsync(formId, ColumnSetInstances.AllColumns);

            string formXml = systemForm.FormXml;

            if (string.IsNullOrEmpty(formXml))
            {
                this._iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.InConnectionEntityFieldIsEmptyFormat4, service.ConnectionData.Name, SystemForm.Schema.EntityLogicalName, systemForm.Name, SystemForm.Schema.Headers.formxml);
                this._iWriteToOutput.ActivateOutputWindow(service.ConnectionData);
                return;
            }

            try
            {
                var fileGenerationOptions = FileGenerationConfiguration.GetFileGenerationOptions();

                var config = new CreateFileJavaScriptConfiguration(fileGenerationOptions);

                var doc = XElement.Parse(formXml);

                var descriptor = new SolutionComponentDescriptor(service);

                descriptor.SetSettings(commonConfig);

                var handler = new FormDescriptionHandler(descriptor, new DependencyRepository(service));

                FormInformation formInfo = handler.GetFormInformation(doc);

                var stringBuilder = new StringBuilder();

                using (var writer = new StringWriter(stringBuilder))
                {
                    var handlerCreate = new CreateFormTabsJavaScriptHandler(writer, config, jsObjectType, service);

                    handlerCreate.WriteContentOnlyForm(formInfo);
                }

                ClipboardHelper.SetText(stringBuilder.ToString().Trim(' ', '\r', '\n'));

                this._iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.CopyingEntityJavaScriptContentOnFormCompletedFormat2, systemForm.ObjectTypeCode, systemForm.Name);
                this._iWriteToOutput.ActivateOutputWindow(service.ConnectionData);

                service.TryDispose();
            }
            catch (Exception ex)
            {
                this._iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex);
            }
        }
 public async Task ExecuteCopingToClipboardSystemFormCurrentTabsAndSections(ConnectionData connectionData, CommonConfiguration commonConfig, JavaScriptObjectType jsObjectType, string entityName, Guid formId, int formType)
 {
     await ConnectAndExecuteActionAsync(connectionData
                                        , Properties.OperationNames.CopingToClipboardSystemFormCurrentTabsAndSections
                                        , (service) => CopingToClipboardSystemFormCurrentTabsAndSections(service, commonConfig, jsObjectType, entityName, formId, formType)
                                        );
 }