public void OnAction(Office.IRibbonControl control) { try { switch (control.Id) { case "customButton1": MessageBox.Show("This is the first sample button.", _prodId); break; case "customButton2": MessageBox.Show("This is the second sample button.", _prodId); break; default: MessageBox.Show("Unkown Control Id: " + control.Id, _prodId); break; } } catch (Exception exception) { string message = string.Format("An error occured.{0}{0}{1}", Environment.NewLine, exception.Message); MessageBox.Show(message, _prodId, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// Defined in RibbonUI.xml to track the user clicked ouer checkbutton. Then we upate the panel visibility at hand. public void OnCheckPanelToggle(Office.IRibbonControl control, bool pressed) { if (TaskPanes.Count > 0) { TaskPanes[0].Visible = pressed; } }
public void OnAction(Office.IRibbonControl control) { try { string appInfo = string.Format("\n\nHost application: {0}.{1}\nVersion: {2}", TypeDescriptor.GetComponentName(_application.UnderlyingObject), _application.UnderlyingTypeName, Invoker.Default.PropertyGet(_application, "Version") ); switch (control.Id) { case "customButton1": MessageBox.Show("This is the first sample button. " + appInfo, ADDIN_TITLE, MessageBoxButtons.OK); break; case "customButton2": MessageBox.Show("This is the second sample button. " + appInfo, ADDIN_TITLE, MessageBoxButtons.OK); break; case "btnAbout": MessageBox.Show("Sample add-in using IDTExtensibility2 interface that is registered to multiple Microsoft Office applications.", ADDIN_TITLE, MessageBoxButtons.OK); break; default: MessageBox.Show("Unkown Control Id: " + control.Id, ADDIN_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } } catch (Exception ex) { string message = string.Format("Error occured: {0}", ex.Message); MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void OnAction(NetOffice.OfficeApi.IRibbonControl control) { try { switch (control.Id) { case "customButton1": MessageBox.Show("This is the first sample button. " + Application.FriendlyTypeName, "NetOfficeTools.SuperAddinCS4"); break; case "customButton2": MessageBox.Show("This is the second sample button." + Application.FriendlyTypeName, "NetOfficeTools.SuperAddinCS4"); break; default: MessageBox.Show("Unkown Control Id: " + control.Id, "NetOfficeTools.SuperAddinCS4"); 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, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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." + details, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// Defined in RibbonUI.xml to make sure the checkbutton state is up-to-date and synchronized with taskpane visibility. public bool OnGetPressedPanelToggle(Office.IRibbonControl control) { if (TaskPanes.Count > 0) { return(TaskPanes[0].Visible); } else { return(false); } }
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.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); } }
public void OnRibbonButtonClick(NetOffice.OfficeApi.IRibbonControl control) { try { switch (control.Id) { case "customButton1": MessageBox.Show(String.Format("Hosted in {0}", Application.InstanceFriendlyName)); break; case "customButton2": MessageBox.Show(String.Format("Loading Time {0}", LoadingTimeElapsed)); break; } } catch (Exception throwedException) { Utils.Dialog.ShowError(throwedException, "Unexpected state in SuperAddinCS4 OnClickRibbonButton"); } }
public void SampleButton1_Click(Office.IRibbonControl control) { try { //MessageBox.Show("Me is " + _id.ToString()); if (Parent.HasShimHost) { Parent.CallShimHost(); } else { string message = "I dont have a shim host :("; MessageBox.Show(message, "InnerAddin.MyRibbonExtensibility"); } } catch (Exception exception) { MessageBox.Show(exception.ToString(), "SampleButton1_Click"); throw; } }
public void OnAction(NetOffice.OfficeApi.IRibbonControl control) { try { switch (control.Id) { case "customButton1": Utils.Dialog.ShowMessageBox("This is the first sample button. " + Application.FriendlyTypeName, "NetOfficeTools.SuperAddinCS4", DialogResult.None); break; case "customButton2": Utils.Dialog.ShowMessageBox("This is the second sample button. " + Application.FriendlyTypeName, "NetOfficeTools.SuperAddinCS4", DialogResult.None); break; default: Utils.Dialog.ShowMessageBox("Unkown Control Id: " + control.Id, "NetOfficeTools.SuperAddinCS4", DialogResult.None); break; } } catch (Exception throwedException) { Utils.Dialog.ShowError(throwedException, "Unexpected state in SuperAddinCS4 OnAction"); } }
// Defined in RibbonUI.xml to catch the user click for the about button public void OnClickAboutButton(Office.IRibbonControl control) { Utils.Dialog.ShowDiagnostics(); }
public void OnClickAboutButton(Office.IRibbonControl control) { Current.GetType().InvokeMember("OnClickAboutButton", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, Current, new object[] { control }); }
public string GetButtonLabel(NetOffice.OfficeApi.IRibbonControl control) { return("自定义\n"); }
// defined in RibbonUI.xml to catch the user click for the about button public void OnClickAboutButton(Office.IRibbonControl control) { Utils.Dialog.ShowAbout("NetOffice Addin Example", "http://netoffice.codeplex.com", "<No licence set>"); }
// defined in RibbonUI.xml to make sure the checkbutton state is up-to-date and synchronized with taskpane visibility. public bool OnGetPressedPanelToggle(Office.IRibbonControl control) { return(TaskPanes[0].Visible); }
// defined in RibbonUI.xml to catch the user click for the about button public void OnClickAboutButton(Office.IRibbonControl control) { MessageBox.Show("NetOffice Tools - Extended Sample Addin.", "ExtendedPPointCS4.Addin"); }
public void ButtonAction(NetOffice.OfficeApi.IRibbonControl control) { MessageBox.Show("Hello World"); }
public stdole.IPictureDisp GetButtonImage(NetOffice.OfficeApi.IRibbonControl control) { return(PictureConverter.IconToPictureDisp(Properties.Resources.SampleIcon2)); }
// Defined in RibbonUI.xml to catch the user click for the about button public void OnClickAboutButton(Office.IRibbonControl control) { Utils.Dialog.ShowAbout("NetOffice Add-in Sample", "https://netoffice.io", ""); }
public void OnCheckPanelToggle(Office.IRibbonControl control, bool pressed) { Current.GetType().InvokeMember("OnCheckPanelToggle", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, Current, new object[] { control, pressed }); }
public string GetLabel(Office.IRibbonControl control) { return(Factory.Settings.ExceptionMessage); }
public void SampleButton2_Click(Office.IRibbonControl control) { string message = "I'm alive :)" + Environment.NewLine + "My Hash is: " + GetHashCode(); MessageBox.Show(message, "InnerAddin.MyRibbonExtensibility"); }
public bool OnGetPressedPanelToggle(Office.IRibbonControl control) { return((bool)Current.GetType().InvokeMember("OnGetPressedPanelToggle", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, Current, new object[] { control })); }