/// <summary> /// 将Assembly加载到面板中,构建面板内容 /// </summary> /// <param name="controlContainer"></param> /// <param name="uiView"></param> private void LoadAssemblyToPanel(DockPanel dockPanel, ControlContainer controlContainer, string assembly, string assemblyType) { if (string.IsNullOrWhiteSpace(assembly)) { return; } string[] temp = assembly.Split(','); if (temp.Length < 2) { return; } string assembleName = temp[1] + "." + assemblyType; string typeName = temp[0]; object obj = AssemblyHelper.GetInstanceFromAssembly(assembleName, typeName); if (obj == null) { logger.Error("加载【" + typeName + "】插件中的【" + assembleName + "】失败,并忽略该插件"); FanMessageBox.Warning("加载【" + typeName + "】插件中的【" + assembleName + "】失败,并忽略该插件", "系统消息"); return; } if (obj is FanUserControl) { FanUserControl userControl = (FanUserControl)obj; userControl.Name = dockPanel.Name; // +"_UserControl"; userControl.OwnerPanel = dockPanel; userControl.Dock = DockStyle.Fill; //将图标集转递给各个面板 userControl.LoadImage16Collection(GlobalParamService.SystemSettingParam.Image16CollectionList); userControl.LoadImage32Collection(GlobalParamService.SystemSettingParam.Image32CollectionList); controlContainer.Controls.Add(userControl); //将面板中的用户控件注册到寻址服务中 this.GetAddressService().Register(userControl.Name, userControl, ControlTypeEnum.UserControl); //this.Container.HookHolder.AddControlHook(userControl.ControlHookHolder); //this.Container.HookHolder.AddUiViewHook(userControl); //_uiViews_cache.Add(userControl); } else { logger.Error("加载【" + typeName + "】插件中的【" + assembleName + "】不是FanUserControl标准用户控件,并忽略该插件"); FanMessageBox.Show("加载【" + typeName + "】插件中的【" + assembleName + "】不是FanUserControl标准用户控件,并忽略该插件", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //else if (obj is UserControl) //{ // UserControl userControl = (UserControl)obj; // userControl.Dock = DockStyle.Fill; // controlContainer.Controls.Add(userControl); //} }
private void addButton_Click(object sender, EventArgs e) { //IInvokeMethod service = ServiceContainer.CreateInstance().Resolve<IInvokeMethod>("InvokeMethodService"); //service.Invoke("Form.Test01.UserControl01", "SelectedItemText", "SelectedItemText"); //string value = this.PropertyAccessService.GetValue(typeof(UserControl01), "SelectedItemText").ToString(); string value = this.PropertyAccessService.GetValue("Form.Test01.UserControl01", "SelectedItemText1").ToString(); FanMessageBox.Show(value); }
public void CallMethod01(string param) { FanMessageBox.Show("参数:" + param); }