IRibbonExtensibility->GetCustomUI 从 Connect 以外的类调用.cs



我正在使用Vs2010 ->可扩展性->共享插件

Connect.cs文件
public class Connect : Object, Extensibility.IDTExtensibility2, IRibbonExtensibility 
{
      public string GetCustomUI(string RibbonID) 
      { 
          return MyResources.customUI; 
      }
}

使用上面的代码创建ribbon。

我有一个类customribbons。cs

public class Create_Custom_Ribbons : IRibbonExtensibility
{
    Outlook.Application applicationObject;
    public Create_Custom_Ribbons(Outlook.Application application)
    {
        try
        {                               
            applicationObject = application;
            GetCustomUI("");
        }
        catch(Exception ex)
        {
            MessageBox.Show(""+ex.StackTrace);
        }
    }
    public string GetCustomUI(string RibbonID)
    {
        return MyResource.customUI;
    }
}

和on Connect.cs

public void OnStartupComplete(ref System.Array custom)
{
        try
        {
            customRibbons.Create_Custom_Ribbons cu = new 
                customRibbons.Create_Custom_Ribbons(applicationObject);
        }
        catch (Exception ex)
        {
            MessageBox.Show("" + ex.StackTrace);
        }
}

但是ribbon没有被创建。请任何人告诉我我做错了什么或任何其他方式来实现这一目标。

查看我在Office Dev组的回复:http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/394ac918-f32f-4c7b-9dee-a6d45f1bdf46

最新更新