コード例 #1
0
        /// <summary>
        /// Shows the form as a modal dialog box with the specified owner.
        /// </summary>
        /// <param name="owner">Any object that implements <see cref="T:System.Windows.Forms.IWin32Window" /> that represents the top-level window that will own the modal dialog box. </param>
        /// <param name="xmlDefinitionFile">The XML definition file name.</param>
        public static void ShowDialog(IWin32Window owner, string xmlDefinitionFile)
        {
            try
            {
                var data =
                    DictionaryPackage.GetXmlDefinitionDataFromDefinitionFile(xmlDefinitionFile);

                var assemblyName = Path.Combine(Path.GetDirectoryName(xmlDefinitionFile) ?? string.Empty, data.lib);

                var version = "1.0.0.0";

                try
                {
                    var assembly = Assembly.LoadFile(assemblyName);
                    version = assembly.GetName().Version.ToString();
                }
                catch (Exception ex)
                {
                    // log the exception..
                    ExceptionLogger.LogError(ex);
                }


                var form = new FormDialogCustomSpellCheckerInfo
                {
                    tbName                     = { Text = data.name },
                    tbLibrary                  = { Text = data.lib },
                    tbCompany                  = { Text = data.company },
                    tbCopyright                = { Text = data.copyright },
                    tbCulture                  = { Text = data.cultureName },
                    tbCultureDescription       = { Text = data.cultureDescription },
                    tbCultureDescriptionNative = { Text = data.cultureDescriptionNative },
                    lbUrlValue                 = { Text = data.url },
                    lbSpdxLicenseLinkValue     = { Text = data.spdxLicenseId, Tag = NuGetLicenseUrl + data.spdxLicenseId },
                    tbAssemblyVersion          = { Text = version },
                };

                using (form)
                {
                    form.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                // log the exception..
                ExceptionLogger.LogError(ex);
            }
        }
コード例 #2
0
 /// <summary>
 /// Loads a custom spell checking assembly if defined in the settings file.
 /// </summary>
 public static void Load()
 {
     if (FormSettings.Settings.EditorSpellUseCustomDictionary)
     {
         try
         {
             var data = DictionaryPackage.GetXmlDefinitionDataFromDefinitionFile(FormSettings.Settings
                                                                                 .EditorSpellCustomDictionaryDefinitionFile);
             ExternalSpellChecker.LoadSpellCheck(Path.GetDirectoryName(FormSettings.Settings
                                                                       .EditorSpellCustomDictionaryDefinitionFile), data.lib);
         }
         catch (Exception ex)
         {
             // log the exception..
             ExceptionLogAction?.Invoke(ex);
         }
     }
 }
コード例 #3
0
 private void DisplayXmlData(string fileName, bool fromXmlFile)
 {
     try
     {
         var data = fromXmlFile
             ? DictionaryPackage.GetXmlDefinitionDataFromDefinitionFile(fileName)
             : DictionaryPackage.GetXmlDefinitionData(fileName);
         tbName.Text                     = data.name;
         tbLibrary.Text                  = data.lib;
         tbCompany.Text                  = data.company;
         tbCopyright.Text                = data.copyright;
         tbCulture.Text                  = data.cultureName;
         tbCultureDescription.Text       = data.cultureDescription;
         tbCultureDescriptionNative.Text = data.cultureDescriptionNative;
         tbSpdxLicense.Text              = data.spdxLicenseId;
         tbUrl.Text = data.url;
     }
     catch (Exception ex)
     {
         DisplayException(ex);
     }
 }