Skip to content

Commit

Permalink
Option Pages only show info to restart VS when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Mar 7, 2016
1 parent 8bc5d88 commit b8245ab
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 28 deletions.
27 changes: 18 additions & 9 deletions CSHARP/OptionsPage/OptionsPageAsmDoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class OptionsPageAsmDoc : DialogPage
protected override void OnActivate(CancelEventArgs e)
{
base.OnActivate(e);
this._useAsmDoc = Properties.Settings.Default.CodeFolding_On;
this._asmDocUrl = Properties.Settings.Default.CodeFolding_EndTag;
this._useAsmDoc = Properties.Settings.Default.AsmDoc_On;
this._asmDocUrl = Properties.Settings.Default.AsmDoc_url;
}

/// <summary>
Expand Down Expand Up @@ -95,18 +95,27 @@ protected override void OnDeactivate(CancelEventArgs e)
protected override void OnApply(PageApplyEventArgs e) {
//Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "INFO:{0}:OnApply", this.ToString()));

string title = null;// "Save Changes";
string message = "Press OK to save changes. You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
bool changed = false;
bool restartNeeded = false;

if (result == (int)VSConstants.MessageBoxResult.IDCANCEL) {
e.ApplyBehavior = ApplyKind.Cancel;
} else {
if (Properties.Settings.Default.AsmDoc_On != this._useAsmDoc) {
Properties.Settings.Default.AsmDoc_On = this._useAsmDoc;
changed = true;
}
if (Properties.Settings.Default.AsmDoc_url != this._asmDocUrl) {
Properties.Settings.Default.AsmDoc_url = this._asmDocUrl;
changed = true;
restartNeeded = true;
}
if (changed) {
Properties.Settings.Default.Save();
base.OnApply(e);
}
if (restartNeeded) {
string title = null;
string message = "You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
base.OnApply(e);
}

#endregion Event Handlers
Expand Down
56 changes: 49 additions & 7 deletions CSHARP/OptionsPage/OptionsPageCodeCompletion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,71 @@ protected override void OnDeactivate(CancelEventArgs e)
protected override void OnApply(PageApplyEventArgs e) {
//Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "INFO:{0}:OnApply", this.ToString()));

string title = null; //"Save Changes";
string message = "Press OK to save changes. You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
bool changed = false;
bool restartNeeded = false;

if (result == (int)VSConstants.MessageBoxResult.IDCANCEL) {
e.ApplyBehavior = ApplyKind.Cancel;
} else {

if (Properties.Settings.Default.CodeCompletion_On != this._useCodeCompletion) {
Properties.Settings.Default.CodeCompletion_On = this._useCodeCompletion;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_x86 != this._x86) {
Properties.Settings.Default.CodeCompletion_x86 = this._x86;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_i686 != this._i686) {
Properties.Settings.Default.CodeCompletion_i686 = this._i686;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_mmx != this._mmx) {
Properties.Settings.Default.CodeCompletion_mmx = this._mmx;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_sse != this._sse) {
Properties.Settings.Default.CodeCompletion_sse = this._sse;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_sse2 != this._sse2) {
Properties.Settings.Default.CodeCompletion_sse2 = this._sse2;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_sse3 != this._sse3) {
Properties.Settings.Default.CodeCompletion_sse3 = this._sse3;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_ssse3 != this._ssse3) {
Properties.Settings.Default.CodeCompletion_ssse3 = this._ssse3;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_sse41 != this._sse41) {
Properties.Settings.Default.CodeCompletion_sse41 = this._sse41;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_sse42 != this._sse42) {
Properties.Settings.Default.CodeCompletion_sse42 = this._sse42;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_avx != this._avx) {
Properties.Settings.Default.CodeCompletion_avx = this._avx;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_avx2 != this._avx2) {
Properties.Settings.Default.CodeCompletion_avx2 = this._avx2;
changed = true;
}
if (Properties.Settings.Default.CodeCompletion_knc != this._knc) {
Properties.Settings.Default.CodeCompletion_knc = this._knc;
changed = true;
}
if (changed) {
Properties.Settings.Default.Save();
base.OnApply(e);
}
if (restartNeeded) {
string title = null;
string message = "You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
base.OnApply(e);
}

#endregion Event Handlers
Expand Down
35 changes: 31 additions & 4 deletions CSHARP/OptionsPage/OptionsPageCodeFolding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,46 @@ protected override void OnDeactivate(CancelEventArgs e)
protected override void OnApply(PageApplyEventArgs e) {
//Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "INFO:{0}:OnApply", this.ToString()));

string title = null;// "Save Changes";
bool changed = false;
bool restartNeeded = false;

if (Properties.Settings.Default.CodeFolding_On != this._useCodeFolding) {
Properties.Settings.Default.CodeFolding_On = this._useCodeFolding;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.CodeFolding_BeginTag != this._beginTag) {
Properties.Settings.Default.CodeFolding_BeginTag = this._beginTag;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.CodeFolding_EndTag != this._endTag) {
Properties.Settings.Default.CodeFolding_EndTag = this._endTag;
changed = true;
restartNeeded = true;
}
if (changed) {
Properties.Settings.Default.Save();
}
if (restartNeeded) {
string title = null;
string message = "You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
base.OnApply(e);

/*
string title = null;
string message = "Press OK to save changes. You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
if (result == (int)VSConstants.MessageBoxResult.IDCANCEL) {
e.ApplyBehavior = ApplyKind.Cancel;
} else {
Properties.Settings.Default.CodeFolding_On = this._useCodeFolding;
Properties.Settings.Default.CodeFolding_BeginTag = this._beginTag;
Properties.Settings.Default.CodeFolding_EndTag = this._endTag;
Properties.Settings.Default.Save();
base.OnApply(e);
}
*/
}

#endregion Event Handlers
Expand Down
53 changes: 45 additions & 8 deletions CSHARP/OptionsPage/OptionsPageSyntaxHighlighting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,63 @@ protected override void OnDeactivate(CancelEventArgs e)
protected override void OnApply(PageApplyEventArgs e) {
//Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "INFO:{0}:OnApply", this.ToString()));

string title = null; //"Save Changes";
string message = "Press OK to save changes. You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
bool changed = false;
bool restartNeeded = false;

if (result == (int)VSConstants.MessageBoxResult.IDCANCEL) {
e.ApplyBehavior = ApplyKind.Cancel;
} else {
if (Properties.Settings.Default.SyntaxHighlighting_On != this._useSyntaxHighlighting) {
Properties.Settings.Default.SyntaxHighlighting_On = this._useSyntaxHighlighting;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Opcode != this._colorMnemonic) {
Properties.Settings.Default.SyntaxHighlighting_Opcode = this._colorMnemonic;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Register != this._colorRegister) {
Properties.Settings.Default.SyntaxHighlighting_Register = this._colorRegister;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Remark != this._colorRemark) {
Properties.Settings.Default.SyntaxHighlighting_Remark = this._colorRemark;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Directive != this._colorDirective) {
Properties.Settings.Default.SyntaxHighlighting_Directive = this._colorDirective;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Constant != this._colorConstant) {
Properties.Settings.Default.SyntaxHighlighting_Constant = this._colorConstant;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Jump != this._colorJump) {
Properties.Settings.Default.SyntaxHighlighting_Jump = this._colorJump;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Label != this._colorLabel) {
Properties.Settings.Default.SyntaxHighlighting_Label = this._colorLabel;
changed = true;
restartNeeded = true;
}
if (Properties.Settings.Default.SyntaxHighlighting_Misc != this._colorMisc) {
Properties.Settings.Default.SyntaxHighlighting_Misc = this._colorMisc;

changed = true;
restartNeeded = true;
}
if (changed) {
Properties.Settings.Default.Save();
base.OnApply(e);
}
if (restartNeeded) {
string title = null;
string message = "You may need to restart visual studio for the changes to take effect.";
int result = VsShellUtilities.ShowMessageBox(Site, message, title, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
base.OnApply(e);
}

#endregion Event Handlers
Expand Down

0 comments on commit b8245ab

Please sign in to comment.