コード例 #1
0
 private void generateADictionaryPackageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (odDll.ShowDialog() == DialogResult.OK)
         {
             var dll = odDll.FileName;
             fbFolder.Description = @"Select library location";
             if (fbFolder.ShowDialog() == DialogResult.OK)
             {
                 var input = fbFolder.SelectedPath;
                 fbFolder.Description = @"Select package output folder";
                 if (fbFolder.ShowDialog() == DialogResult.OK)
                 {
                     var output = fbFolder.SelectedPath;
                     var result = DictionaryPackage.CreatePackage(input, output, dll);
                     MessageBox.Show(this, $@"DictionaryPackage.CreatePackage call: '{result}'.", @"Result",
                                     MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         DisplayException(ex);
     }
 }
コード例 #2
0
 private void mnuUnInstall_Click(object sender, EventArgs e)
 {
     try
     {
         if (odXml.ShowDialog() == DialogResult.OK)
         {
             var xml = odXml.FileName;
             DictionaryPackage.UnInstallPackage(xml);
         }
     }
     catch (Exception ex)
     {
         DisplayException(ex);
     }
 }
コード例 #3
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);
            }
        }
コード例 #4
0
        private void mnuGenerateXmlDefinition_Click(object sender, EventArgs e)
        {
            try
            {
                if (odDll.ShowDialog() == DialogResult.OK)
                {
                    var result = DictionaryPackage.GenerateXmlDefinition(odDll.FileName, tbName.Text,
                                                                         tbCompany.Text, tbCopyright.Text, tbCulture.Text, tbCultureDescription.Text,
                                                                         tbCultureDescriptionNative.Text, tbSpdxLicense.Text, tbUrl.Text);

                    DisplayXmlData(result, true);
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
        }
コード例 #5
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);
         }
     }
 }
コード例 #6
0
 private void testInstallADictionaryPackageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (odZip.ShowDialog() == DialogResult.OK)
         {
             var zip = odZip.FileName;
             fbFolder.Description = @"Select install folder";
             if (fbFolder.ShowDialog() == DialogResult.OK)
             {
                 var output = fbFolder.SelectedPath;
                 var result = DictionaryPackage.InstallPackage(zip, output);
                 DisplayXmlData(result, true);
             }
         }
     }
     catch (Exception ex)
     {
         DisplayException(ex);
     }
 }
コード例 #7
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);
     }
 }
コード例 #8
0
        private void tbSpdxLicense_TextChanged(object sender, EventArgs e)
        {
            var textBox = (TextBox)sender;

            lbSpdxLicenseLinkValue.Text = DictionaryPackage.GetSpdxLicenseUrl(textBox.Text);
        }