/// <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); }
//private void GenerateLayoutDocumentContainer(FanLayoutDock body) //{ // DevExpress.XtraBars.Docking2010.DocumentManager documentManager = new DevExpress.XtraBars.Docking2010.DocumentManager(Container.GetComponents()); // DevExpress.XtraBars.Docking2010.Views.Tabbed.TabbedView tabbedView = new DevExpress.XtraBars.Docking2010.Views.Tabbed.TabbedView(Container.GetComponents()); // DevExpress.XtraBars.Docking2010.Views.Tabbed.DocumentGroup documentGroup = new DevExpress.XtraBars.Docking2010.Views.Tabbed.DocumentGroup(Container.GetComponents()); // DevExpress.XtraBars.Docking2010.Views.Tabbed.Document document = new DevExpress.XtraBars.Docking2010.Views.Tabbed.Document(Container.GetComponents()); // DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer dockingContainer = new DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer(); // ((System.ComponentModel.ISupportInitialize)(documentManager)).BeginInit(); // ((System.ComponentModel.ISupportInitialize)(tabbedView)).BeginInit(); // ((System.ComponentModel.ISupportInitialize)(documentGroup)).BeginInit(); // ((System.ComponentModel.ISupportInitialize)(document)).BeginInit(); // this.Container.SuspendLayout(); // //TabbedView tabbedView = Container.GetTabbedView(); // documentManager.ContainerControl = Container; // documentManager.View = tabbedView; // documentManager.ViewCollection.AddRange(new DevExpress.XtraBars.Docking2010.Views.BaseView[] {tabbedView}); // document.Caption = body.DocumentContainer.Title; // document.ControlName = body.DocumentContainer.Name; // document.FloatLocation = new System.Drawing.Point(0, 0); // document.FloatSize = new System.Drawing.Size(200, 200); // document.Properties.AllowClose = DevExpress.Utils.DefaultBoolean.True; // document.Properties.AllowFloat = DevExpress.Utils.DefaultBoolean.True; // document.Properties.AllowFloatOnDoubleClick = DevExpress.Utils.DefaultBoolean.True; // documentGroup.Items.Add(document); // tabbedView.DocumentGrouSF.Add(documentGroup); // tabbedView.Documents.Add(document); // //tabbedView.Orientation = System.Windows.Forms.Orientation.Vertical; // tabbedView.RootContainer.Element = null; // dockingContainer.Element = documentGroup; // tabbedView.RootContainer.Nodes.Add(dockingContainer); // //tabbedView.RootContainer.Orientation = System.Windows.Forms.Orientation.Vertical; // ((System.ComponentModel.ISupportInitialize)(documentManager)).EndInit(); // ((System.ComponentModel.ISupportInitialize)(tabbedView)).EndInit(); // ((System.ComponentModel.ISupportInitialize)(documentGroup)).EndInit(); // ((System.ComponentModel.ISupportInitialize)(document)).EndInit(); // this.Container.ResumeLayout(); //} #endregion #endregion void dockPanel_ClosingPanel(object sender, DockPanelCancelEventArgs e) { DialogResult dr = FanMessageBox.Question("是否要关闭该面板?如果要恢复该面板,请App.conf中layout_enable_save配置项改成false", "系统提示", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { } else { e.Cancel = true; } }
public void CallMethod01(string param) { FanMessageBox.Show("参数:" + param); }