From 3be3544fc035f24351c71f88b2416df71d86263a Mon Sep 17 00:00:00 2001 From: tduguid Date: Thu, 22 Mar 2018 11:06:23 +1100 Subject: [PATCH] Added procedure for updating/setting the checkboxes in the backstage area --- CS/Ribbon.xml | 10 +++--- CS/Scripts/Ribbon.cs | 74 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 5 deletions(-) diff --git a/CS/Ribbon.xml b/CS/Ribbon.xml index 1937000..d089484 100644 --- a/CS/Ribbon.xml +++ b/CS/Ribbon.xml @@ -577,11 +577,11 @@ Or use the following tag to remove all other ribbons when this loads - - - - - + + + + + diff --git a/CS/Scripts/Ribbon.cs b/CS/Scripts/Ribbon.cs index 0cc291b..ac23088 100644 --- a/CS/Scripts/Ribbon.cs +++ b/CS/Scripts/Ribbon.cs @@ -433,6 +433,41 @@ public string GetText(Office.IRibbonControl control) } } + /// + /// + /// + /// + /// + 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); + } + + } + /// /// Assigns the visiblity to controls /// @@ -614,6 +649,45 @@ public void OnAction(Office.IRibbonControl control) } + /// + /// + /// + /// + /// + 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); + } + + } + /// /// Return the updated value from the comboxbox ///