From fbf1369cdaf60fe01d69f6dd7f8aa051c8abc29d Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Mon, 25 Sep 2017 12:55:57 -0700 Subject: [PATCH] Spell check now only happens if Word is not already opened. Word must now be closed before starting spell check. --- SpellCheckAddIn/Config.Designer.cs | Bin 12342 -> 12348 bytes SpellCheckAddIn/Config.esriaddinx | 4 +-- SpellCheckAddIn/Properties/AssemblyInfo.cs | 9 ++++--- SpellCheckAddIn/SpellCheckAddIn.csproj | 1 + SpellCheckAddIn/SpellCheckButton.cs | 29 ++++++++++++--------- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/SpellCheckAddIn/Config.Designer.cs b/SpellCheckAddIn/Config.Designer.cs index 12ee66b4a00d79fb25190258ade3eed9bf6bf3ba..c0e42d4a6a29a99d4179dbb08f9c73722641a50d 100644 GIT binary patch delta 23 fcmdm%uqR=|BQ9n=2E)w{xe}QfjW#>-eN_YiaCr!R delta 21 dcmdm!uq|Q3Bd*DhIQur2a9?8D?7{a%5de3&3I6~9 diff --git a/SpellCheckAddIn/Config.esriaddinx b/SpellCheckAddIn/Config.esriaddinx index 0718528..9b0c02d 100644 --- a/SpellCheckAddIn/Config.esriaddinx +++ b/SpellCheckAddIn/Config.esriaddinx @@ -2,11 +2,11 @@ Spell-Check {7d90a5f5-bfe3-483a-be83-21fa5be6f97d} Provides spell-check capability in ArcMap. - 1.0 + 1.0.1 Images\SpellCheckAddIn.png Jeff Jacobson WSDOT - 9/5/2017 + 9/25/2017 diff --git a/SpellCheckAddIn/Properties/AssemblyInfo.cs b/SpellCheckAddIn/Properties/AssemblyInfo.cs index 125f18b..08becd6 100644 --- a/SpellCheckAddIn/Properties/AssemblyInfo.cs +++ b/SpellCheckAddIn/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System.Resources; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -32,5 +33,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.1.0")] +[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: NeutralResourcesLanguage("en-US")] + diff --git a/SpellCheckAddIn/SpellCheckAddIn.csproj b/SpellCheckAddIn/SpellCheckAddIn.csproj index 9387509..b8dfa29 100644 --- a/SpellCheckAddIn/SpellCheckAddIn.csproj +++ b/SpellCheckAddIn/SpellCheckAddIn.csproj @@ -75,6 +75,7 @@ + diff --git a/SpellCheckAddIn/SpellCheckButton.cs b/SpellCheckAddIn/SpellCheckButton.cs index f7e9e8f..0ca085c 100644 --- a/SpellCheckAddIn/SpellCheckButton.cs +++ b/SpellCheckAddIn/SpellCheckButton.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using ESRI.ArcGIS.ArcMapUI; +using ESRI.ArcGIS.ArcMapUI; using ArcMapSpellCheck; +using System.Diagnostics; +using System.Windows.Forms; namespace SpellCheckAddIn { @@ -15,14 +13,21 @@ public SpellCheckButton() protected override void OnClick() { - // - // TODO: Sample code showing how to access button host - // - ////ArcMap.Application.CurrentTool = null; - IMxDocument doc = ArcMap.Application.Document as IMxDocument; - using (var spellchecker = new Spellchecker()) + // Check to see if Word is already opened. + var processes = Process.GetProcessesByName("WINWORD"); + + if (processes.Length > 0) + { + string message = "The spell check operation needs to use Microsoft Word, which is already opened. Please close Word and try again."; + MessageBox.Show(message, "Word is already open", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0); + } + else { - spellchecker.CheckDocument(doc); + IMxDocument doc = ArcMap.Application.Document as IMxDocument; + using (var spellchecker = new Spellchecker()) + { + spellchecker.CheckDocument(doc); + } } } protected override void OnUpdate()