pluginName = "SuperMap.Desktop.Frame";
actionName = "SuperMap.Desktop._CtrlActionWindowsHorizontal";
ctrlAction = DesktopHelper.GetCtrlAction(pluginName, actionName);
ctrlAction.Run();
public static ICtrlAction GetCtrlAction(string pluginName, string actionName)
{
ICtrlAction ctrlAction = null;
try
{
Type typeCtrlAction = null;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
if (assembly.FullName.Contains(pluginName))
{
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
if (type.FullName.CompareTo(actionName) == 0)
{
typeCtrlAction = type;
}
}
break;
}
}
IFormMain formMain = GetActiveAppMainForm();
ctrlAction = formMain.RibbonManager[typeCtrlAction].CtrlAction;
}
catch (Exception ex)
{
DesktopLog("获取 " + pluginName + " , " + actionName + " 命令失败!" + ex.ToString());
}
return ctrlAction;
}
在“ ctrlAction = formMain.RibbonManager[typeCtrlAction].CtrlAction;”中 formMain.RibbonManager[typeCtrlAction]为null,该如何调用呢?