// attached in ctor to trigger taskpane visibility has been changed and update the checkbutton in the ribbon ui for show/hide taskpane private void TaskPane_VisibleStateChange(Office._CustomTaskPane CustomTaskPaneInst) { // ouer taskpane visibility has been changed. we send a message to the host application // and say please refresh the checkbutton state. now the host application want call ouer OnGetPressedPanelToggle method to update the checkstate. if(null != RibbonUI) RibbonUI.InvalidateControl("paneVisibleToogleButton"); }
// 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) { TaskPanes[0].Visible = pressed; }
// 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 get a instance for ouer ribbon ui. public void OnLoadRibonUI(Office.IRibbonUI ribbonUI) { RibbonUI = ribbonUI; }
// 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 catch the user click for the about button public void OnClickAboutButton(Office.IRibbonControl control) { MessageBox.Show("NetOffice Tools - Extended Sample Addin.", "ExtendedAccessCS4.Addin"); }
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); } }
// taskpane visibility has been changed. we upate the checkbutton in the ribbon ui for show/hide taskpane protected override void TaskPaneVisibleStateChanged(Office._CustomTaskPane customTaskPaneInst) { if (null != RibbonUI) RibbonUI.InvalidateControl("paneVisibleToogleButton"); }
// attached in ctor to trigger taskpane visibility has been changed and update the checkbutton in the ribbon ui for show/hide taskpane private void TaskPane_VisibleStateChange(Office._CustomTaskPane CustomTaskPaneInst) { if(null != RibbonUI) // may no ribbon supported RibbonUI.InvalidateControl("paneVisibleToogleButton"); }
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); } }
public void OnAction(Office.IRibbonControl control) { try { switch (control.Id) { case "btnStartSlideShow": // Set the event listener for the beginning of the show _powerApplication.SlideShowBeginEvent += new PowerPoint.Application_SlideShowBeginEventHandler(powerApplication_SlideShowBeginEvent); // Set the event listener for the end of the show _powerApplication.SlideShowEndEvent += new PowerPoint.Application_SlideShowEndEventHandler(powerApplication_SlideShowEndEvent); // Start the Slide show _powerApplication.ActiveWindow.Presentation.SlideShowSettings.Run(); 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); } }
public string GetLabel(Office.IRibbonControl control) { return Factory.Settings.ExceptionMessage; }
private void TaskPane_VisibleStateChange(Office._CustomTaskPane CustomTaskPaneInst) { }
private void commandBarBtn_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault) { textBoxEvents.BeginInvoke(_updateDelegate, new object[] { "Click called." }); Ctrl.Dispose(); }
public Font(Office.Font2 font, Func<object> parentInvoke) { this.font = font; this.parentInvoke = parentInvoke; }