110,535
社区成员
发帖
与我相关
我的任务
分享
static class GlobalData {
public static Dictionary<string, Action> dict = new Dictionary<string, Action>();
}
GlobalData.dict.Add("菜单设置", () => ShowFunction());
private void wOutlookBar_ItemClicked(object sender, LumiSoft.UI.Controls.WOutlookBar.ItemClicked_EventArgs e)
{
var cmd = GlobalData.dict.Where(x => x.Key == e.Item.Caption).FirstOrDefault();
if (cmd != null) cmd.Value();
}
private void initializeAssemblys()
{
List<string> FileNames = getFileFullNames("FunModules");
Assembly assembly = null;
IChildModule childModule = null;
foreach (string fileName in FileNames)
{
try
{
assembly = Assembly.LoadFile(fileName);
string assemblyString = getNameFromFull(fileName);
Type childModuleType = assembly.GetType(assemblyString + "." + assemblyString + "Assembly");
if (childModuleType == null) continue;
if (!childModuleType.GetType().IsInstanceOfType(typeof(IChildModule))) continue;
childModule = childModuleType.GetConstructor(new Type[] { }).Invoke(new object[] { }) as IChildModule;
childModule.childService.Connection = MainForm.service.Connection;
childModule.LoginUser = MainForm.LoginUser;
childModules.Add(childModule);
}
catch (FileLoadException ex)
{
onChildModuleErr(new Exception(fileName + " load err," + ex.Message));
}
catch (Exception ex)
{
onChildModuleErr(ex);
}
}
}
public interface IChildModule
{
Dictionary<string, Type> childForms { get; }
ChildModuleService childService { get; }
Data_LoginContent LoginUser { get; set; }
TreeNodeInfo moduleTree { get; }
}