Skip to content

Commit 5121b65

Browse files
committed
Merge branch 'ignore-spelling'
2 parents 092f5c2 + abbf74c commit 5121b65

File tree

5 files changed

+82
-58
lines changed

5 files changed

+82
-58
lines changed

NoteHighlightAddin/AddIn.cs

+73-49
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,18 @@ public void OnStartupComplete(ref Array custom)
138138
//public async Task AddInButtonClicked(IRibbonControl control)
139139
public void AddInButtonClicked(IRibbonControl control)
140140
{
141-
tag = control.Tag;
141+
try
142+
{
143+
tag = control.Tag;
142144

143-
Thread t = new Thread(new ThreadStart(ShowForm));
144-
t.SetApartmentState(ApartmentState.STA);
145-
t.Start();
145+
Thread t = new Thread(new ThreadStart(ShowForm));
146+
t.SetApartmentState(ApartmentState.STA);
147+
t.Start();
148+
}
149+
catch (Exception e)
150+
{
151+
MessageBox.Show("Exception from AddInButtonClicked: "+ e.ToString());
152+
}
146153

147154
//t.Join(5000);
148155

@@ -151,49 +158,56 @@ public void AddInButtonClicked(IRibbonControl control)
151158

152159
private void ShowForm()
153160
{
154-
string outFileName = Guid.NewGuid().ToString();
155-
156-
//try
157-
//{
158-
//ProcessHelper processHelper = new ProcessHelper("NoteHighLightForm.exe", new string[] { control.Tag, outFileName });
159-
//processHelper.IsWaitForInputIdle = true;
160-
//processHelper.ProcessStart();
161+
try
162+
{
163+
string outFileName = Guid.NewGuid().ToString();
161164

162-
//CodeForm form = new CodeForm(tag, outFileName);
163-
//form.ShowDialog();
165+
//try
166+
//{
167+
//ProcessHelper processHelper = new ProcessHelper("NoteHighLightForm.exe", new string[] { control.Tag, outFileName });
168+
//processHelper.IsWaitForInputIdle = true;
169+
//processHelper.ProcessStart();
164170

165-
//TestForm t = new TestForm();
166-
var pageNode = GetPageNode();
167-
string selectedText = "";
168-
XElement outline = null;
169-
bool selectedTextFormated = false;
171+
//CodeForm form = new CodeForm(tag, outFileName);
172+
//form.ShowDialog();
170173

171-
if (pageNode != null)
172-
{
173-
var existingPageId = pageNode.Attribute("ID").Value;
174-
selectedText = GetSelectedText(existingPageId, out selectedTextFormated);
174+
//TestForm t = new TestForm();
175+
var pageNode = GetPageNode();
176+
string selectedText = "";
177+
XElement outline = null;
178+
bool selectedTextFormated = false;
175179

176-
if (selectedText.Trim() != "")
180+
if (pageNode != null)
177181
{
178-
outline = GetOutline(existingPageId);
182+
var existingPageId = pageNode.Attribute("ID").Value;
183+
selectedText = GetSelectedText(existingPageId, out selectedTextFormated);
184+
185+
if (selectedText.Trim() != "")
186+
{
187+
outline = GetOutline(existingPageId);
188+
}
179189
}
180-
}
181190

182191
MainForm form = new MainForm(tag, outFileName, selectedText);
183192

184-
System.Windows.Forms.Application.Run(form);
185-
//}
186-
//catch (Exception ex)
187-
//{
188-
// MessageBox.Show("Error executing NoteHighLightForm.exe:" + ex.Message);
189-
// return;
190-
//}
193+
System.Windows.Forms.Application.Run(form);
194+
//}
195+
//catch (Exception ex)
196+
//{
197+
// MessageBox.Show("Error executing NoteHighLightForm.exe:" + ex.Message);
198+
// return;
199+
//}
191200

192-
string fileName = Path.Combine(Path.GetTempPath(), outFileName + ".html");
201+
string fileName = Path.Combine(Path.GetTempPath(), outFileName + ".html");
193202

194-
if (File.Exists(fileName))
203+
if (File.Exists(fileName))
204+
{
205+
InsertHighLightCodeToCurrentSide(fileName, form.Parameters, outline, selectedTextFormated);
206+
}
207+
}
208+
catch (Exception e)
195209
{
196-
InsertHighLightCodeToCurrentSide(fileName, form.Parameters, outline, selectedTextFormated);
210+
MessageBox.Show("Exception from ShowForm: " + e.ToString());
197211
}
198212
}
199213

@@ -231,24 +245,31 @@ public IStream GetImage(string imageName)
231245
/// </summary>
232246
private void InsertHighLightCodeToCurrentSide(string fileName, HighLightParameter parameters, XElement outline, bool selectedTextFormated)
233247
{
234-
// Trace.TraceInformation(System.Reflection.MethodBase.GetCurrentMethod().Name);
235-
string htmlContent = File.ReadAllText(fileName, Encoding.UTF8);
248+
try
249+
{
250+
// Trace.TraceInformation(System.Reflection.MethodBase.GetCurrentMethod().Name);
251+
string htmlContent = File.ReadAllText(fileName, Encoding.UTF8);
236252

237-
var pageNode = GetPageNode();
253+
var pageNode = GetPageNode();
238254

239-
if (pageNode != null)
240-
{
241-
var existingPageId = pageNode.Attribute("ID").Value;
242-
string[] position=null;
243-
if (outline == null)
255+
if (pageNode != null)
244256
{
245-
position = GetMousePointPosition(existingPageId);
246-
}
257+
var existingPageId = pageNode.Attribute("ID").Value;
258+
string[] position = null;
259+
if (outline == null)
260+
{
261+
position = GetMousePointPosition(existingPageId);
262+
}
247263

248-
var page = InsertHighLightCode(htmlContent, position, parameters, outline, selectedTextFormated);
249-
page.Root.SetAttributeValue("ID", existingPageId);
264+
var page = InsertHighLightCode(htmlContent, position, parameters, outline, selectedTextFormated);
265+
page.Root.SetAttributeValue("ID", existingPageId);
250266

251-
OneNoteApplication.UpdatePageContent(page.ToString(), DateTime.MinValue);
267+
OneNoteApplication.UpdatePageContent(page.ToString(), DateTime.MinValue);
268+
}
269+
}
270+
catch (Exception e)
271+
{
272+
MessageBox.Show("Exception from InsertHighLightCodeToCurrentSide: "+e.ToString());
252273
}
253274
}
254275

@@ -402,6 +423,7 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High
402423
XElement cell2 = new XElement(ns + "Cell");
403424
cell2.Add(new XAttribute("shadingColor", colorString));
404425

426+
405427
string defaultStyle = "";
406428

407429
var arrayLine = htmlContent.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
@@ -412,6 +434,8 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High
412434
if(item.StartsWith("<pre"))
413435
{
414436
defaultStyle = item.Substring(0,item.IndexOf("<span"));
437+
//Sets language to Latin to disable spell check
438+
defaultStyle = defaultStyle.Insert(defaultStyle.Length - 1, " lang=la");
415439
item = item.Substring(item.IndexOf("<span"));
416440
}
417441

@@ -452,7 +476,7 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High
452476
//string s = item.Replace(@"style=""", string.Format(@"style=""font-family:{0}; ", GenerateHighlightContent.GenerateHighLight.Config.OutputArguments["Font"].Value));
453477
//string s = string.Format(@"<body style=""font-family:{0}"">", GenerateHighlightContent.GenerateHighLight.Config.OutputArguments["Font"].Value) +
454478
// itemLine.Replace("&apos;", "'") + "</body>";
455-
string s = defaultStyle + itemLine.Replace("&apos;", "'") + "</body>";
479+
string s = defaultStyle + itemLine.Replace("&apos;", "'") + "</pre>";
456480

457481
cell2.Add(new XElement(ns + "OEChildren",
458482
new XElement(ns + "OE",

NoteHighlightAddin/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
//
3434
// You can specify all the values or you can default the Build and Revision Numbers
3535
// by using the '*' as shown below:
36-
[assembly: AssemblyVersion("3.0.*")]
37-
[assembly: AssemblyFileVersion("3.0.*")]
36+
[assembly: AssemblyVersion("3.1.*")]
37+
[assembly: AssemblyFileVersion("3.1.*")]

NoteHighlightAddin/ribbon.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<button id="buttonR" label="R" size="large" screentip="Enter R Code" onAction="AddInButtonClicked" tag="r" image="Other.png" visible="false"/>
3838
<button id="buttonBash" label="Bash" size="large" screentip="Enter Bash Code" onAction="AddInButtonClicked" tag="sh" image="Other.png" visible="false"/>
3939
<button id="buttonSwift" label="Swift" size="large" screentip="Enter Swift Code" onAction="AddInButtonClicked" tag="swift" image="Other.png" visible="false"/>
40-
<button id="buttonVisaulBasic" label="Visual Basic" size="large" screentip="Enter Visual Basic Code" onAction="AddInButtonClicked" tag="vb" image="Other.png" visible="false"/>
40+
<button id="buttonVisualBasic" label="Visual Basic" size="large" screentip="Enter Visual Basic Code" onAction="AddInButtonClicked" tag="vb" image="Other.png" visible="false"/>
4141
</group>
4242
</tab>
4343
</tabs>

Setup/Setup.vdproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,15 @@
640640
{
641641
"Name" = "8:NoteHighlightAddin"
642642
"ProductName" = "8:NoteHighlight2016"
643-
"ProductCode" = "8:{765DAFF3-F505-4A51-9064-DA725395E959}"
644-
"PackageCode" = "8:{D8D12432-A651-4151-A0DF-5EDC3C77D310}"
643+
"ProductCode" = "8:{FB571ECB-7A79-4417-BC88-04EADC1CAEE0}"
644+
"PackageCode" = "8:{AFFAB118-BED9-4D10-967A-1D8018F1F910}"
645645
"UpgradeCode" = "8:{0025873C-20C5-48D6-A93A-FBD3891A9233}"
646646
"AspNetVersion" = "8:4.0.30319.0"
647647
"RestartWWWService" = "11:FALSE"
648648
"RemovePreviousVersions" = "11:TRUE"
649649
"DetectNewerInstalledVersion" = "11:TRUE"
650650
"InstallAllUsers" = "11:TRUE"
651-
"ProductVersion" = "8:3.0"
651+
"ProductVersion" = "8:3.1"
652652
"Manufacturer" = "8:CodingRoad"
653653
"ARPHELPTELEPHONE" = "8:"
654654
"ARPHELPLINK" = "8:"

SetupX86/SetupX86.vdproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,15 @@
640640
{
641641
"Name" = "8:NoteHighlightAddin"
642642
"ProductName" = "8:NoteHighlight2016"
643-
"ProductCode" = "8:{455472A6-9763-40E5-B034-9760EA7F7CEB}"
644-
"PackageCode" = "8:{D93582F6-076B-4D28-BFCC-972ACDBD422F}"
643+
"ProductCode" = "8:{95B19903-BDE2-4560-A55D-5BDA0EF8D70C}"
644+
"PackageCode" = "8:{8AA95C85-7AA6-44AA-8BFA-50A9071A33A5}"
645645
"UpgradeCode" = "8:{0025873C-20C5-48D6-A93A-FBD3891A9233}"
646646
"AspNetVersion" = "8:4.0.30319.0"
647647
"RestartWWWService" = "11:FALSE"
648648
"RemovePreviousVersions" = "11:TRUE"
649649
"DetectNewerInstalledVersion" = "11:TRUE"
650650
"InstallAllUsers" = "11:TRUE"
651-
"ProductVersion" = "8:3.0"
651+
"ProductVersion" = "8:3.1"
652652
"Manufacturer" = "8:CodingRoad"
653653
"ARPHELPTELEPHONE" = "8:"
654654
"ARPHELPLINK" = "8:"

0 commit comments

Comments
 (0)