public void OnAction(Office.IRibbonControl control) { try { switch (control.Id) { case "customButton1": MessageBox.Show("This is the first sample button.", _progId); break; case "customButton2": MessageBox.Show("This is the second sample button.", _progId); break; default: MessageBox.Show("Unkown Control Id: " + control.Id, _progId); break; } } catch (Exception throwedException) { string details = string.Format("{1}{1}Details:{1}{1}{0}", throwedException.Message, Environment.NewLine); MessageBox.Show("An error occured in OnAction: " + details, _progId, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void commandBarBtn_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault) { Ctrl.Dispose(); }
public void OnAction(Office.IRibbonControl control) { try { string message = string.Format("Thanks for click on a Ribbon.\r\nHostApp is {0}.{1} Version:{2}", TypeDescriptor.GetComponentName(_application.UnderlyingObject), _application.UnderlyingTypeName, Invoker.Default.PropertyGet(_application, "Version")); MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exception) { string message = string.Format("An error occured.{0}{0}{1}", Environment.NewLine, exception.Message); MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AttributePane_DockPositionStateChange(Office._CustomTaskPane CustomTaskPaneInst) { try { CallTaskPaneDockPositionStateChange(CustomTaskPaneInst); } catch(Exception exception) { Factory.Console.WriteException(exception); } }
private void commandBarBtn_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault) { textBoxEvents.BeginInvoke(_updateDelegate, new object[] { "Click called." }); Ctrl.Dispose(); }
// Using the msi installer rather than relying on regsvr32 //[ComRegisterFunctionAttribute()] //public static void RegisterFunction(Type pType) { //} //[ComUnregisterFunctionAttribute()] //public static void UnregisterFunction(Type pType) { //} // show the main screen public void showWiimoteSetup(Office.IRibbonControl control = null, bool wait = false) { if (App.ui != null) { // if already created App.ui.Show(); App.ui.Focus(); } else { // otherwise create it App.ui = new AppWindow(); App.ui.Show(); } }
public Image ReturnImage(Office.IRibbonControl Control) { // Since only ONE custom image is used for the addin, simply return that image. // Otherwise if multiple images were used, add some code here... return Properties.Resources.ribbonButtonLogo; }
public void LaunchRemoveAllWiimotes(Office.IRibbonControl control = null, bool wait = false) { }