Skip to content

Commit 3be3544

Browse files
tduguidtduguid
tduguid
authored and
tduguid
committed
Added procedure for updating/setting the checkboxes in the backstage area
1 parent cd9e8c6 commit 3be3544

File tree

2 files changed

+79
-5
lines changed

2 files changed

+79
-5
lines changed

CS/Ribbon.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,11 @@ Or use the following tag to remove all other ribbons when this loads
577577
<topItems>
578578
<layoutContainer id="layout2One" layoutChildren="vertical">
579579
<labelControl id="ebox5" label="Select the script you would like to create with this Add-In"/>
580-
<checkBox id="T-SQL" label ="T-SQL"/>
581-
<checkBox id="PL-SQL" label ="PL-SQL"/>
582-
<checkBox id="DQL" label ="DQL"/>
583-
<checkBox id="MARKDOWN" label ="MARKDOWN"/>
584-
<checkBox id="MARKUP" label ="MARKUP"/>
580+
<checkBox id="chkBackstageTsql" label ="T-SQL" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
581+
<checkBox id="chkBackstagePlsql" label ="PL-SQL" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
582+
<checkBox id="chkBackstageDql" label ="DQL" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
583+
<checkBox id="chkBackstageMarkdown" label ="MARKDOWN" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
584+
<checkBox id="chkBackstageMarkup" label ="MARKUP" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
585585
</layoutContainer>
586586
</topItems>
587587
</group>

CS/Scripts/Ribbon.cs

+74
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,41 @@ public string GetText(Office.IRibbonControl control)
433433
}
434434
}
435435

436+
/// <summary>
437+
///
438+
/// </summary>
439+
/// <param name="control"></param>
440+
/// <returns></returns>
441+
public bool GetPressed(Office.IRibbonControl control)
442+
{
443+
try
444+
{
445+
switch (control.Id)
446+
{
447+
448+
case "chkBackstageTsql":
449+
return Properties.Settings.Default.Visible_mnuScriptType_TSQL;
450+
case "chkBackstagePlsql":
451+
return Properties.Settings.Default.Visible_mnuScriptType_PLSQL;
452+
case "chkBackstageDql":
453+
return Properties.Settings.Default.Visible_mnuScriptType_DQL;
454+
case "chkBackstageMarkdown":
455+
return Properties.Settings.Default.Visible_mnuScriptType_Markdown;
456+
case "chkBackstageMarkup":
457+
return Properties.Settings.Default.Visible_mnuScriptType_Markup;
458+
default:
459+
return true;
460+
}
461+
462+
}
463+
catch (Exception)
464+
{
465+
return true;
466+
//ErrorHandler.DisplayMessage(ex);
467+
}
468+
469+
}
470+
436471
/// <summary>
437472
/// Assigns the visiblity to controls
438473
/// </summary>
@@ -614,6 +649,45 @@ public void OnAction(Office.IRibbonControl control)
614649

615650
}
616651

652+
/// <summary>
653+
///
654+
/// </summary>
655+
/// <param name="control"></param>
656+
/// <param name="pressed"></param>
657+
public void OnAction_Checkbox(Office.IRibbonControl control, bool pressed)
658+
{
659+
try
660+
{
661+
switch (control.Id)
662+
{
663+
664+
case "chkBackstageTsql":
665+
Properties.Settings.Default.Visible_mnuScriptType_TSQL = pressed;
666+
break;
667+
case "chkBackstagePlsql":
668+
Properties.Settings.Default.Visible_mnuScriptType_PLSQL = pressed;
669+
break;
670+
case "chkBackstageDql":
671+
Properties.Settings.Default.Visible_mnuScriptType_DQL = pressed;
672+
break;
673+
case "chkBackstageMarkdown":
674+
Properties.Settings.Default.Visible_mnuScriptType_Markdown = pressed;
675+
break;
676+
case "chkBackstageMarkup":
677+
Properties.Settings.Default.Visible_mnuScriptType_Markup = pressed;
678+
break;
679+
}
680+
681+
ribbon.Invalidate();
682+
683+
}
684+
catch (Exception)
685+
{
686+
//ErrorHandler.DisplayMessage(ex);
687+
}
688+
689+
}
690+
617691
/// <summary>
618692
/// Return the updated value from the comboxbox
619693
/// </summary>

0 commit comments

Comments
 (0)