Skip to content

Commit

Permalink
Added procedure for updating/setting the checkboxes in the backstage …
Browse files Browse the repository at this point in the history
…area
  • Loading branch information
tduguid authored and tduguid committed Mar 22, 2018
1 parent cd9e8c6 commit 3be3544
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CS/Ribbon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,11 @@ Or use the following tag to remove all other ribbons when this loads
<topItems>
<layoutContainer id="layout2One" layoutChildren="vertical">
<labelControl id="ebox5" label="Select the script you would like to create with this Add-In"/>
<checkBox id="T-SQL" label ="T-SQL"/>
<checkBox id="PL-SQL" label ="PL-SQL"/>
<checkBox id="DQL" label ="DQL"/>
<checkBox id="MARKDOWN" label ="MARKDOWN"/>
<checkBox id="MARKUP" label ="MARKUP"/>
<checkBox id="chkBackstageTsql" label ="T-SQL" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
<checkBox id="chkBackstagePlsql" label ="PL-SQL" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
<checkBox id="chkBackstageDql" label ="DQL" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
<checkBox id="chkBackstageMarkdown" label ="MARKDOWN" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
<checkBox id="chkBackstageMarkup" label ="MARKUP" onAction="OnAction_Checkbox" getPressed="GetPressed"/>
</layoutContainer>
</topItems>
</group>
Expand Down
74 changes: 74 additions & 0 deletions CS/Scripts/Ribbon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,41 @@ public string GetText(Office.IRibbonControl control)
}
}

/// <summary>
///
/// </summary>
/// <param name="control"></param>
/// <returns></returns>
public bool GetPressed(Office.IRibbonControl control)
{
try
{
switch (control.Id)
{

case "chkBackstageTsql":
return Properties.Settings.Default.Visible_mnuScriptType_TSQL;
case "chkBackstagePlsql":
return Properties.Settings.Default.Visible_mnuScriptType_PLSQL;
case "chkBackstageDql":
return Properties.Settings.Default.Visible_mnuScriptType_DQL;
case "chkBackstageMarkdown":
return Properties.Settings.Default.Visible_mnuScriptType_Markdown;
case "chkBackstageMarkup":
return Properties.Settings.Default.Visible_mnuScriptType_Markup;
default:
return true;
}

}
catch (Exception)
{
return true;
//ErrorHandler.DisplayMessage(ex);
}

}

/// <summary>
/// Assigns the visiblity to controls
/// </summary>
Expand Down Expand Up @@ -614,6 +649,45 @@ public void OnAction(Office.IRibbonControl control)

}

/// <summary>
///
/// </summary>
/// <param name="control"></param>
/// <param name="pressed"></param>
public void OnAction_Checkbox(Office.IRibbonControl control, bool pressed)
{
try
{
switch (control.Id)
{

case "chkBackstageTsql":
Properties.Settings.Default.Visible_mnuScriptType_TSQL = pressed;
break;
case "chkBackstagePlsql":
Properties.Settings.Default.Visible_mnuScriptType_PLSQL = pressed;
break;
case "chkBackstageDql":
Properties.Settings.Default.Visible_mnuScriptType_DQL = pressed;
break;
case "chkBackstageMarkdown":
Properties.Settings.Default.Visible_mnuScriptType_Markdown = pressed;
break;
case "chkBackstageMarkup":
Properties.Settings.Default.Visible_mnuScriptType_Markup = pressed;
break;
}

ribbon.Invalidate();

}
catch (Exception)
{
//ErrorHandler.DisplayMessage(ex);
}

}

/// <summary>
/// Return the updated value from the comboxbox
/// </summary>
Expand Down

0 comments on commit 3be3544

Please sign in to comment.