예제 #1
0
 public void OnMyButtonClick(Office.IRibbonControl control)
 {
     if (control.Context is Microsoft.Office.Interop.Outlook.Selection)
     {
         Microsoft.Office.Interop.Outlook.Selection   sel = control.Context as Microsoft.Office.Interop.Outlook.Selection;
         Microsoft.Office.Interop.Outlook.ContactItem cnt = sel[1];
         System.Diagnostics.Process.Start(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "CallMyPhone", "CallMyPhone.exe"), "\"" + control.Tag + "\"" + " \"" + cnt.FullName.ToString() + "\"");
     }
 }
예제 #2
0
        public string CallbackGetContent(Office.IRibbonControl control)
        {
            StringBuilder xmlString = new StringBuilder(@"<menu xmlns=""http://schemas.microsoft.com/office/2009/07/customui"" >");

            if (control.Context is Microsoft.Office.Interop.Outlook.Selection)

            {
                Microsoft.Office.Interop.Outlook.Selection selection = control.Context as Microsoft.Office.Interop.Outlook.Selection;
                if (selection.Count == 1)

                {
                    Microsoft.Office.Interop.Outlook.ContactItem contact1 = selection[1] as Microsoft.Office.Interop.Outlook.ContactItem;

                    if (contact1.MobileTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='MobileTelephoneNumber' tag='" + contact1.MobileTelephoneNumber + "' label='Мобильный: " + contact1.MobileTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.BusinessTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='BusinessTelephoneNumber' tag='" + contact1.BusinessTelephoneNumber + "' label='Рабочий: " + contact1.BusinessTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.AssistantTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='AssistantTelephoneNumber' tag='" + contact1.AssistantTelephoneNumber + "' label='Помощник: " + contact1.AssistantTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.Business2TelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='Business2TelephoneNumber' tag='" + contact1.Business2TelephoneNumber + "' label='Рабочий 2: " + contact1.Business2TelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.BusinessFaxNumber != null)
                    {
                        xmlString.Append(@"<button id='BusinessFaxNumber' tag='" + contact1.BusinessFaxNumber + "' label='Факс (рабочий): " + contact1.BusinessFaxNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.CallbackTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='CallbackTelephoneNumber' tag='" + contact1.CallbackTelephoneNumber + "' label='Ответ на звонок: " + contact1.CallbackTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.CarTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='CarTelephoneNumber' tag='" + contact1.CarTelephoneNumber + "' label='Автомобиль: " + contact1.CarTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.CompanyMainTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='CompanyMainTelephoneNumber' tag='" + contact1.CompanyMainTelephoneNumber + "' label='Организация: " + contact1.CompanyMainTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.Home2TelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='Home2TelephoneNumber' tag='" + contact1.Home2TelephoneNumber + "' label='Домашний 2: " + contact1.Home2TelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.HomeFaxNumber != null)
                    {
                        xmlString.Append(@"<button id='HomeFaxNumber' tag='" + contact1.HomeFaxNumber + "' label='Факс дом.: " + contact1.HomeFaxNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.HomeTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='HomeTelephoneNumber' tag='" + contact1.HomeTelephoneNumber + "' label='Домашний: " + contact1.HomeTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.OtherTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='OtherTelephoneNumber' tag='" + contact1.OtherTelephoneNumber + "' label='Другой: " + contact1.OtherTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                    if (contact1.RadioTelephoneNumber != null)
                    {
                        xmlString.Append(@"<button id='RadioTelephoneNumber' tag='" + contact1.RadioTelephoneNumber + "' label='Радио: " + contact1.RadioTelephoneNumber + "' onAction='OnMyButtonClick'/>");
                    }
                }
            }

            xmlString.Append(@"</menu>");

            return(xmlString.ToString());
        }