目录
- 1.创建类库
- 2.项目引用U8安装路径dll:
- 3.新建类MyLoginable 继承 NetLoginable:
- 4.新建类 MyNetUserControl 实现接口 INetUserControl:
- 5.新建类 NetSampleDelegate 实现上面的CreateToolbar方法
- 6.新建你的用户控件
- 7.最后一步到UAP挂接菜单,到U8上就看到了
1.创建类库
创建类库命名:UFIDA.U8.Portal.+自定义名称…
2.项目引用U8安装路径dll:
F: U8SOFT\Interop\Interop.U8Login.dll //设置嵌入互操作类型为false
F: U8SOFT\Interop\Interop.UFPortalProxylnterface.dll
F: U8SOFT\Portal \UFIDA.U8.Portal.Common.dll
F: U8SOFT\Portal\UFIDA.U8.Portal.Framework.dll
F: U8SOFT\Portal \UFIDA.U8.Portal.Proxy.dll
F: U8SOFT\Framework\UFSoft.U8.Framework.Login.Ul.dl
3.新建类MyLoginable 继承 NetLoginable:
using UFIDA.U8.Portal.Proxy.editors;
using UFIDA.U8.Portal.Proxy.supports;namespace UFIDA.U8.Portal.Produce.Print
{public class MyLoginable : NetLoginable{public override object CallFunction(string cMenuId, string cMenuName, string cAuthId, string cCmdLine){INetUserControl mycontrol = new MyNetUserControl();mycontrol.Title = "生产计划核销物料";base.ShowEmbedControl(mycontrol, cMenuId, true);return null;}public override bool SubSysLogin(){GlobalParameters.gLoginable = this;return base.SubSysLogin();}public override bool SubSysLogOff(){return base.SubSysLogOff();}public static class GlobalParameters{private static MyLoginable _myLoginable = null;public static MyLoginable gLoginable{get{return _myLoginable;}set{_myLoginable = value;}}}}
}
4.新建类 MyNetUserControl 实现接口 INetUserControl:
using System.Windows.Forms;
using UFIDA.U8.Portal.Framework.Actions;
using UFIDA.U8.Portal.Framework.MainFrames;
using UFIDA.U8.Portal.Produce.Print.Utility;
using UFIDA.U8.Portal.Proxy.Actions;
using UFIDA.U8.Portal.Proxy.editors;
using UFSoft.U8.Framework.Login.UI;namespace UFIDA.U8.Portal.Produce.Print
{public class MyNetUserControl : INetUserControl{#region INetUserControl 成员UserControlSummaryPrint summaryPrint = null;private IEditorInput _editInput = null;private IEditorPart _editPart = null;private string _title;/// <summary>/// EditorInput/// </summary>public IEditorInput EditorInput{get{return _editInput;}set{_editInput = value;}}/// <summary>/// EditorPart/// </summary>public IEditorPart EditorPart{get{return _editPart;}set{_editPart = value;}}/// <summary>/// 页签标题/// </summary>public string Title{get{return this._title;}set{this._title = value;}}public bool CloseEvent(){//throw new Exception("The method or operation is not implemented.");return true;}public Control CreateControl(clsLogin login, string MenuID, string Paramters){DBConfig.connStr = login.GetLoginInfo().ConnString.Substring(18).Replace("Provider=SQLOLEDB;", string.Empty);// objConnection = "Data Source=yuyang;Initial Catalog=UFDATA_888_2006;User ID=sa;Password=123";DBConfig.operDate = login.GetLoginInfo().operDate;DBConfig.UserName = login.GetLoginInfo().UserName;DBConfig.UserId = login.GetLoginInfo().UserId;DBConfig.AccID = login.GetLoginInfo().AccID;DBConfig.AppServer = login.GetLoginInfo().AppServer;DBConfig.AccName = login.GetLoginInfo().AccName;DBConfig.iYear = login.GetLoginInfo().iYear;DBConfig.iBeginYear = login.GetLoginInfo().iBeginYear;//构造U8登陆对象U8Login.clsLogin u8login = new U8Login.clsLoginClass();if (login != null){u8login.ConstructLogin(login.userToken);string taskId = login.GetTaskID("DP");u8login.set_TaskId(ref taskId);}summaryPrint = new UserControlSummaryPrint();summaryPrint.Name = "生产计划核销物料";return summaryPrint;}public NetAction[] CreateToolbar(clsLogin login){IActionDelegate nsd = new NetSampleDelegate();//string skey = "mynewcontrol";//NetAction ac = new NetAction("sss", nsd);NetAction[] aclist;aclist = new NetAction[0];//ac.Text = "Sample Button 2";//ac.Tag = summaryPrint;//aclist[0] = ac;return aclist;// throw new Exception("The method or operation is not implemented.");}#endregion}
}
5.新建类 NetSampleDelegate 实现上面的CreateToolbar方法
using UFIDA.U8.Portal.Common.Core;
using UFIDA.U8.Portal.Framework.Actions;namespace UFIDA.U8.Portal.Produce.Print
{public class NetSampleDelegate : IActionDelegate{public void Run(IAction action){//throw new NotImplementedException();}public void SelectionChanged(IAction action, ISelection selection){//throw new NotImplementedException();}}
}