public void OnSendList(Office.Core.IRibbonControl control) { if (control != null) { try { Outlook.Inspector inspector = (Outlook.Inspector)control.Context; String coffeeText = GetTextFromTaskPane(inspector); // Create a new email from the input parameters, and send it. Outlook._MailItem mi = (Outlook._MailItem) Globals.ThisAddIn.Application.CreateItem( Outlook.OlItemType.olMailItem); mi.Subject = _orderName; mi.Body = coffeeText; mi.To = _mailAddressee; mi.Send(); // Update the count of orders in the form region. UserInterfaceContainer uiContainer = Globals.ThisAddIn._uiElements.GetUIContainerForInspector( inspector); CultureInfo cultureInfo = new CultureInfo("en-us"); uiContainer.FormRegionControls.SetControlText( _ordersTextBoxName, (++_orderCount).ToString(cultureInfo)); } catch (COMException ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } }
private void closeCoffeeList_Click(object sender, EventArgs e) { // 清除并隐藏列表框。 this._coffeeList.Items.Clear(); this._coffeeGroup.Visible = false; // 令外接程序服务功能区按钮再次不可见。 UserInterfaceContainer uiContainer = Globals.ThisAddIn._uiElements.GetUIContainerForUserControl( this); uiContainer.HideRibbonControl(_mailServiceGroup); }
private void closeCoffeeList_Click(object sender, EventArgs e) { // Clear and hide the listbox. this._coffeeList.Items.Clear(); this._coffeeGroup.Visible = false; // Make the add-in service ribbon buttons invisible again. UserInterfaceContainer uiContainer = Globals.ThisAddIn._uiElements.GetUIContainerForUserControl( this); uiContainer.HideRibbonControl(_mailServiceGroup); }
public bool GetVisible(Office.Core.IRibbonControl control) { if (control == null) { return(false); } // Match up this control instance (determined by its inspector) in // the collection, and return the current value of the cached // visibility state. Outlook.Inspector inspector = control.Context as Outlook.Inspector; UserInterfaceContainer uiContainer = Globals.ThisAddIn._uiElements.GetUIContainerForInspector(inspector); return(uiContainer.IsControlVisible); }
public bool GetVisible(Office.Core.IRibbonControl control) { if (control == null) { return(false); } // 在集合中匹配此控件实例(取决于其检查器), // 并返回缓存可见性状态的 // 当前值。 Outlook.Inspector inspector = control.Context as Outlook.Inspector; UserInterfaceContainer uiContainer = Globals.ThisAddIn._uiElements.GetUIContainerForInspector(inspector); return(uiContainer.IsControlVisible); }
// The user has changed the selection in the listbox in the custom // form region. private void _coffeeList_Change() { UserInterfaceContainer uiContainer = Globals.ThisAddIn._uiElements.GetUIContainerForInspector( _inspector); // Make the add-in service ribbon buttons visible. uiContainer.ShowRibbonControl(_mailServiceGroup); // Get the usercontrol in the task pane, and copy the text of the // item selected in the form region's listbox into the taskpane's // listbox. SimpleControl sc = (SimpleControl)uiContainer.TaskPane.ContentControl; sc._coffeeGroup.Visible = true; sc._coffeeList.Items.Add(_coffeeList.Text); }
// 用户已经更改自定义窗体区域中列表框内的 // 选择。 private void _coffeeList_Change() { UserInterfaceContainer uiContainer = Globals.ThisAddIn._uiElements.GetUIContainerForInspector( _inspector); // 令外接程序服务功能区按钮可见。 uiContainer.ShowRibbonControl(_mailServiceGroup); // 获取任务窗格中的用户控件,并将 // 在窗体区域的列表框中选择的项目的文本复制到任务窗格的 // 列表框。 SimpleControl sc = (SimpleControl)uiContainer.TaskPane.ContentControl; sc._coffeeGroup.Visible = true; sc._coffeeList.Items.Add(_coffeeList.Text); }