Ejemplo n.º 1
0
 /// <summary>Loads configurations from file</summary>
 private void LoadSetting()
 {
     settings = null;
     try
     {
         SettingsManager.Instance.TryLoad(typeof(FetchXmlBuilder), out settings, "[Common]");
     }
     catch (InvalidOperationException) { }
     if (settings == null)
     {
         settings = new FXBSettings();
     }
     repository = null;
     try
     {
         SettingsManager.Instance.TryLoad(typeof(FetchXmlBuilder), out repository, "[QueryRepository]");
     }
     catch (InvalidOperationException) { }
     if (repository == null)
     {
         repository = new QueryRepository();
     }
     repository.SortQueries();
     LoadSettingConnection();
 }
Ejemplo n.º 2
0
        private void PopulateSettings(FXBSettings settings)
        {
            if (settings == null)
            {
                settings = new FXBSettings();
            }
            chkAppFriendly.Checked          = settings.UseFriendlyNames;
            chkAppSingle.Checked            = settings.QueryOptions.UseSingleQuotation;
            chkAppNoSavePrompt.Checked      = settings.DoNotPromptToSave;
            chkAppResultsNewWindow.Checked  = settings.Results.AlwaysNewWindow;
            chkAppAllowUncustViews.Checked  = settings.OpenUncustomizableViews;
            chkAddConditionToFilter.Checked = settings.AddConditionToFilter;
            chkUseSQL4CDS.Checked           = settings.UseSQL4CDS;
            chkUseLookup.Checked            = settings.UseLookup;
            chkShowHelp.Checked             = settings.ShowHelpLinks;
            chkShowNodeTypes.Checked        = settings.ShowNodeType;
            chkShowButtonTexts.Checked      = settings.ShowButtonTexts;
            chkShowValidation.Checked       = settings.ShowValidation;
            switch (settings.Results.ResultOutput)
            {
            case ResultOutput.XML: rbResSerializedXML.Checked = true; break;

            case ResultOutput.JSON: rbResSerializedJSON.Checked = true; break;

            case ResultOutput.JSONWebAPI: rbResSerializedJSONWebAPI.Checked = true; break;

            case ResultOutput.Raw: rbResRaw.Checked = true; break;

            default: rbResGrid.Checked = true; break;
            }
            chkResAllPages.Checked       = settings.Results.RetrieveAllPages;
            propXmlColors.SelectedObject = settings.XmlColors;
            txtFetch.ConfigureForXml(settings);
            txtFetch.FormatXML(settings.QueryOptions.NewQueryTemplate, settings);
            chkEntAll.Checked = settings.Entity.All;
            if (!settings.Entity.All)
            {
                chkEntCustomizable.Checked   = settings.Entity.Customizable;
                chkEntCustom.Checked         = settings.Entity.Custom;
                chkEntIntersect.Checked      = settings.Entity.Intersect;
                chkEntManaged.Checked        = settings.Entity.Managed;
                chkEntOnlyAF.Checked         = settings.Entity.OnlyValidAF;
                chkEntStandard.Checked       = settings.Entity.Standard;
                chkEntUncustomizable.Checked = settings.Entity.Uncustomizable;
                chkEntUnmanaged.Checked      = settings.Entity.Unmanaged;
            }
            chkAttAll.Checked = settings.Attribute.All;
            if (!settings.Attribute.All)
            {
                chkAttCustomizable.Checked   = settings.Attribute.Customizable;
                chkAttCustom.Checked         = settings.Attribute.Custom;
                chkAttManaged.Checked        = settings.Attribute.Managed;
                chkAttOnlyAF.Checked         = settings.Attribute.OnlyValidAF;
                chkAttOnlyRead.Checked       = settings.Attribute.OnlyValidRead;
                chkAttStandard.Checked       = settings.Attribute.Standard;
                chkAttUncustomizable.Checked = settings.Attribute.Uncustomizable;
                chkAttUnmanaged.Checked      = settings.Attribute.Unmanaged;
            }
        }
Ejemplo n.º 3
0
        public static void ConfigureForXml(this Scintilla scintilla, FXBSettings settings)
        {
            // Ref: https://gist.github.com/anonymous/63036aa8c1cefcfcb013

            // Reset the styles
            scintilla.StyleResetDefault();
            scintilla.Styles[Style.Default].Font = "Consolas";
            scintilla.Styles[Style.Default].Size = 10;
            scintilla.StyleClearAll();

            // Set the XML Lexer
            scintilla.Lexer = Lexer.Xml;

            // Show line numbers
            scintilla.Margins[0].Width = 20;

            // Enable folding
            scintilla.SetProperty("fold", "1");
            scintilla.SetProperty("fold.compact", "1");
            scintilla.SetProperty("fold.html", "1");

            // Use Margin 2 for fold markers
            scintilla.Margins[2].Type      = MarginType.Symbol;
            scintilla.Margins[2].Mask      = Marker.MaskFolders;
            scintilla.Margins[2].Sensitive = true;
            scintilla.Margins[2].Width     = 20;

            // Reset folder markers
            for (int i = Marker.FolderEnd; i <= Marker.FolderOpen; i++)
            {
                scintilla.Markers[i].SetForeColor(SystemColors.ControlLightLight);
                scintilla.Markers[i].SetBackColor(SystemColors.ControlDark);
            }

            // Style the folder markers
            scintilla.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus;
            scintilla.Markers[Marker.Folder].SetBackColor(SystemColors.ControlText);
            scintilla.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus;
            scintilla.Markers[Marker.FolderEnd].Symbol  = MarkerSymbol.BoxPlusConnected;
            scintilla.Markers[Marker.FolderEnd].SetBackColor(SystemColors.ControlText);
            scintilla.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
            scintilla.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected;
            scintilla.Markers[Marker.FolderSub].Symbol     = MarkerSymbol.VLine;
            scintilla.Markers[Marker.FolderTail].Symbol    = MarkerSymbol.LCorner;

            // Enable automatic folding
            scintilla.AutomaticFold = AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change;

            // Set the Styles
            scintilla.StyleResetDefault();

            // I like fixed font for XML
            scintilla.Styles[Style.Default].Font = "Courier New";
            scintilla.Styles[Style.Default].Size = 10;
            scintilla.StyleClearAll();

            settings.XmlColors.ApplyToControl(scintilla);
        }
Ejemplo n.º 4
0
        private void PopulateSettings(FXBSettings settings)
        {
            if (settings == null)
            {
                settings = new FXBSettings();
            }
            chkAppFriendly.Checked         = settings.UseFriendlyNames;
            chkAppSingle.Checked           = settings.QueryOptions.UseSingleQuotation;
            chkAppNoSavePrompt.Checked     = settings.DoNotPromptToSave;
            chkAppResultsNewWindow.Checked = settings.Results.AlwaysNewWindow;
            chkAppAllowUncustViews.Checked = settings.OpenUncustomizableViews;
            chkUseSQL4CDS.Checked          = settings.UseSQL4CDS;
            chkUseLookup.Checked           = settings.UseLookup;
            switch (settings.Results.ResultOutput)
            {
            case ResultOutput.XML: rbResSerializedXML.Checked = true; break;

            case ResultOutput.JSON: rbResSerializedJSON.Checked = true; break;

            case ResultOutput.Raw: rbResRaw.Checked = true; break;

            default: rbResGrid.Checked = true; break;
            }
            chkResAllPages.Checked       = settings.Results.RetrieveAllPages;
            propXmlColors.SelectedObject = settings.XmlColors;
            settings.XmlColors.ApplyToControl(txtFetch);
            txtFetch.Text = settings.QueryOptions.NewQueryTemplate;
            txtFetch.Process();
            chkEntAll.Checked = settings.Entity.All;
            if (!settings.Entity.All)
            {
                chkEntCustomizable.Checked   = settings.Entity.Customizable;
                chkEntCustom.Checked         = settings.Entity.Custom;
                chkEntIntersect.Checked      = settings.Entity.Intersect;
                chkEntManaged.Checked        = settings.Entity.Managed;
                chkEntOnlyAF.Checked         = settings.Entity.OnlyValidAF;
                chkEntStandard.Checked       = settings.Entity.Standard;
                chkEntUncustomizable.Checked = settings.Entity.Uncustomizable;
                chkEntUnmanaged.Checked      = settings.Entity.Unmanaged;
            }
            chkAttAll.Checked = settings.Attribute.All;
            if (!settings.Attribute.All)
            {
                chkAttCustomizable.Checked   = settings.Attribute.Customizable;
                chkAttCustom.Checked         = settings.Attribute.Custom;
                chkAttManaged.Checked        = settings.Attribute.Managed;
                chkAttOnlyAF.Checked         = settings.Attribute.OnlyValidAF;
                chkAttOnlyRead.Checked       = settings.Attribute.OnlyValidRead;
                chkAttStandard.Checked       = settings.Attribute.Standard;
                chkAttUncustomizable.Checked = settings.Attribute.Uncustomizable;
                chkAttUnmanaged.Checked      = settings.Attribute.Unmanaged;
            }
        }
Ejemplo n.º 5
0
        public static void FormatXML(this Scintilla scintilla, string text, FXBSettings settings)
        {
            var doc = new XmlDocument();

            doc.LoadXml(text);
            using (var writer = new StringWriter())
                using (var xmlWriter = new XmlFragmentWriter(writer))
                {
                    xmlWriter.QuoteChar  = settings.QueryOptions.UseSingleQuotation ? '\'' : '"';
                    xmlWriter.Formatting = Formatting.Indented;

                    doc.Save(xmlWriter);
                    scintilla.Text = writer.ToString();
                }
        }
Ejemplo n.º 6
0
        private void PopulateSettings(FXBSettings settings)
        {
            if (settings == null)
            {
                settings = new FXBSettings();
            }
            chkAppFriendly.Checked         = settings.UseFriendlyNames;
            chkAppSingle.Checked           = settings.QueryOptions.UseSingleQuotation;
            chkAppNoSavePrompt.Checked     = settings.DoNotPromptToSave;
            chkAppResultsNewWindow.Checked = settings.Results.AlwaysNewWindow;
            chkAppAllowUncustViews.Checked = settings.OpenUncustomizableViews;
            switch (settings.Results.ResultOption)
            {
            case 1: rbResSerialized.Checked = true; break;

            case 3: rbResRaw.Checked = true; break;

            default: rbResGrid.Checked = true; break;
            }
            cmbSeralizationStyle.SelectedIndex = settings.Results.SerializeStyle;
            chkResAllPages.Checked             = settings.Results.RetrieveAllPages;
            txtFetch.Text = settings.QueryOptions.NewQueryTemplate;
            txtFetch.Process();
            chkEntAll.Checked = settings.Entity.All;
            if (!settings.Entity.All)
            {
                chkEntCustomizable.Checked   = settings.Entity.Customizable;
                chkEntCustom.Checked         = settings.Entity.Custom;
                chkEntIntersect.Checked      = settings.Entity.Intersect;
                chkEntManaged.Checked        = settings.Entity.Managed;
                chkEntOnlyAF.Checked         = settings.Entity.OnlyValidAF;
                chkEntStandard.Checked       = settings.Entity.Standard;
                chkEntUncustomizable.Checked = settings.Entity.Uncustomizable;
                chkEntUnmanaged.Checked      = settings.Entity.Unmanaged;
            }
            chkAttAll.Checked = settings.Attribute.All;
            if (!settings.Attribute.All)
            {
                chkAttCustomizable.Checked   = settings.Attribute.Customizable;
                chkAttCustom.Checked         = settings.Attribute.Custom;
                chkAttManaged.Checked        = settings.Attribute.Managed;
                chkAttOnlyAF.Checked         = settings.Attribute.OnlyValidAF;
                chkAttOnlyRead.Checked       = settings.Attribute.OnlyValidRead;
                chkAttStandard.Checked       = settings.Attribute.Standard;
                chkAttUncustomizable.Checked = settings.Attribute.Uncustomizable;
                chkAttUnmanaged.Checked      = settings.Attribute.Unmanaged;
            }
        }
Ejemplo n.º 7
0
        private void PopulateSettings(FXBSettings Settings)
        {
            settings = Settings;
            if (settings == null)
            {
                settings = new FXBSettings();
            }
            chkAppFriendly.Checked     = settings.useFriendlyNames;
            chkAppQuick.Checked        = settings.showQuickActions;
            chkAppSingle.Checked       = settings.useSingleQuotation;
            chkAppNoSavePrompt.Checked = settings.doNotPromptToSave;
            switch (settings.resultOption)
            {
            case 1: rbResSerialized.Checked = true; break;

            case 3: rbResRaw.Checked = true; break;

            default: rbResGrid.Checked = true; break;
            }
            cmbSeralizationStyle.SelectedIndex = settings.resultSerializeStyle;
            chkResAllPages.Checked             = settings.retrieveAllPages;
            chkEntAll.Checked = settings.showEntitiesAll;
            if (!settings.showEntitiesAll)
            {
                chkEntCustomizable.Checked   = settings.showEntitiesCustomizable;
                chkEntCustom.Checked         = settings.showEntitiesCustom;
                chkEntIntersect.Checked      = settings.showEntitiesIntersect;
                chkEntManaged.Checked        = settings.showEntitiesManaged;
                chkEntOnlyAF.Checked         = settings.showEntitiesOnlyValidAF;
                chkEntStandard.Checked       = settings.showEntitiesStandard;
                chkEntUncustomizable.Checked = settings.showEntitiesUncustomizable;
                chkEntUnmanaged.Checked      = settings.showEntitiesUnmanaged;
            }
            chkAttAll.Checked = settings.showAttributesAll;
            if (!settings.showAttributesAll)
            {
                chkAttCustomizable.Checked   = settings.showAttributesCustomizable;
                chkAttCustom.Checked         = settings.showAttributesCustom;
                chkAttManaged.Checked        = settings.showAttributesManaged;
                chkAttOnlyAF.Checked         = settings.showAttributesOnlyValidAF;
                chkAttOnlyRead.Checked       = settings.showAttributesOnlyValidRead;
                chkAttStandard.Checked       = settings.showAttributesStandard;
                chkAttUncustomizable.Checked = settings.showAttributesUncustomizable;
                chkAttUnmanaged.Checked      = settings.showAttributesUnmanaged;
            }
            chkStatAllow.Checked = settings.logUsage != false;
        }
Ejemplo n.º 8
0
 private void PopulateSettings(FXBSettings settings)
 {
     if (settings == null)
     {
         settings = new FXBSettings();
     }
     chkAppFriendly.Checked = settings.UseFriendlyNames;
     chkAppFriendlyResults.Checked = settings.Results.Friendly;
     chkAppSingle.Checked = settings.QueryOptions.UseSingleQuotation;
     chkAppNoSavePrompt.Checked = settings.DoNotPromptToSave;
     chkAppResultsNewWindow.Checked = settings.Results.AlwaysNewWindow;
     chkAppAllowUncustViews.Checked = settings.OpenUncustomizableViews;
     chkAddConditionToFilter.Checked = settings.AddConditionToFilter;
     chkUseSQL4CDS.Checked = settings.UseSQL4CDS;
     chkUseLookup.Checked = settings.UseLookup;
     chkShowHelp.Checked = settings.ShowHelpLinks;
     chkShowNodeTypes.Checked = settings.ShowNodeType;
     chkShowButtonTexts.Checked = settings.ShowButtonTexts;
     chkShowValidation.Checked = settings.ShowValidation;
     chkShowValidationInfo.Checked = settings.ShowValidationInfo;
     chkShowRepository.Checked = settings.ShowRepository;
     chkShowAllAttributes.Checked = settings.QueryOptions.ShowAllAttributes;
     cmbResult.SelectedIndex = SettingResultToComboBoxItem(settings.Results.ResultOutput);
     chkResAllPages.Checked = settings.Results.RetrieveAllPages;
     chkClickableLinks.Checked = settings.Results.ClickableLinks;
     numMaxColumnWidth.Value = settings.Results.MaxColumnWidth;
     chkWorkWithLayout.Checked = settings.Results.WorkWithLayout;
     propXmlColors.SelectedObject = settings.XmlColors;
     txtFetch.ConfigureForXml(settings);
     txtFetch.FormatXML(settings.QueryOptions.NewQueryTemplate, settings);
     chkTryMetadataCache.Checked = settings.TryMetadataCache;
     if (chkTryMetadataCache.Checked)
     {
         chkWaitUntilMetadataLoaded.Enabled = true;
         chkWaitUntilMetadataLoaded.Checked = settings.WaitUntilMetadataLoaded;
     }
     else
     {
         chkWaitUntilMetadataLoaded.Enabled = false;
         chkWaitUntilMetadataLoaded.Checked = false;
     }
 }
Ejemplo n.º 9
0
 public Settings(FXBSettings settings)
 {
     InitializeComponent();
     PopulateSettings(settings);
 }