/// <summary> /// 从文件加载函数 /// </summary> /// <param name="Title">函数名</param> /// <param name="ID">ID</param> public PicFunctionTabPage LoadFunctionPage(string Title, int ID, OpenType opentype, OverrideType overridetype) { foreach (PicFunctionTabPage fun in ListFunction) { if (fun.Title == Title) { return(null); } } PicFunctionTabPage function = new PicFunctionTabPage(ID, this.CallBackFunction, Title); function.MyOpenType = opentype; function.MyOverride = overridetype; ListFunction.Add(function); return(function); }
/// <summary> /// 创建一个函数 /// </summary> /// <param name="Title">函数的名字</param> public bool CreatePicFunctionPage(string Title) { foreach (PicFunctionTabPage fun in ListFunction) { if (fun.Title == Title) { return(false); } } PicFunctionTabPage function = new PicFunctionTabPage(1, this.CallBackFunction, Title); ///给函数里面的函数代码创建数据 ObservableCollection <MyXTreeItem> funcitondata = new ObservableCollection <MyXTreeItem>(); foreach (MyXTreeItem item in PopContentCode.MyData) { funcitondata.Add(item); } ///函数属性更新事件 function.XAributeChangeMessage = (tcp) => { XObjectData tcpmessagedata = new XObjectData(tcp); tcpmessagedata.additional_Information = MessageOption.Update.ToString(); ///消息回调 MessageUpdateCall(this, MouseState.XUpdateTreeViewData, tcpmessagedata); }; ///绑定数据 function.PopContentCode.MyData = funcitondata; ListFunction.Add(function); ///通知更新数据 MessageOption option = MessageOption.Add; XObjectData messagedata = new XObjectData(function); messagedata.additional_Information = option.ToString(); MessageUpdateCall(this, MouseState.XUpdateTreeViewData, messagedata); return(true); }