| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Configuration; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Reflection; |
| | | using System.Windows.Forms; |
| | | using DevExpress.XtraBars; |
| | | using DevExpress.XtraBars; |
| | | using DevExpress.XtraBars.FluentDesignSystem; |
| | | using DevExpress.XtraBars.Navigation; |
| | | using DevExpress.XtraTab; |
| | |
| | | using Gs.DevApp.ToolBox; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Configuration; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Reflection; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Gs.DevApp.DevFrm |
| | | { |
| | |
| | | Gs.DevApp.DevFrm.User.SysMenu frm = new SysMenu(); |
| | | frm.ShowDialog(); |
| | | }; |
| | | // tab.ContextMenuStrip = cms1; |
| | | // tab.ContextMenuStrip = cms1; |
| | | } |
| | | |
| | | private void Tab_MouseDown(object sender, MouseEventArgs e) |
| | |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | "User/GetUserLoginInfo", JsonConvert.SerializeObject(_obj)); |
| | | Size _size; string _caption; Color _color; Padding _pad; |
| | | (_size, _caption, _color, _pad) =Gs.DevApp.ToolBox.UtilityHelper.getLoading(); |
| | | (_size, _caption, _color, _pad) = Gs.DevApp.ToolBox.UtilityHelper.getLoading(); |
| | | DevExpress.Utils.WaitDialogForm wdf = new DevExpress.Utils.WaitDialogForm("加载进度:", _caption, _size); |
| | | wdf.BackColor = _color; |
| | | wdf.Padding = _pad; |
| | |
| | | /// <param name="tabText">当前选项卡页Text标题</param> |
| | | /// <param name="newFormName">当前选项卡中的新窗体路径,类名</param> |
| | | public void AddTabpage(XtraTabControl tabControl, string tabPageName, |
| | | string tabText, string newFormName, Image imgIcon) |
| | | string tabText, string newFormName, Image imgIcon,string InitializeVal="") |
| | | { |
| | | if (IsTabpageExsit(tabControl, tabPageName)) return; |
| | | var newPage = new XtraTabPage(); |
| | |
| | | newPage.Tooltip = newPage.Name; |
| | | newPage.Appearance.Header.Font = tab.Appearance.Font; |
| | | newPage.ImageOptions.Image = imgIcon; |
| | | var fm = AddNewForm(newFormName); |
| | | var fm = AddNewForm(newFormName, InitializeVal); |
| | | if (fm != null) |
| | | { |
| | | newPage.Controls.Add(fm); |
| | |
| | | /// 在选项卡中生成窗体 |
| | | /// </summary> |
| | | /// <param name="form">窗体名称</param> |
| | | private Form AddNewForm(string formName) |
| | | private Form AddNewForm(string formName,string InitializeVal) |
| | | { |
| | | try |
| | | { |
| | |
| | | newForm.ControlBox = false; |
| | | newForm.Dock = DockStyle.Fill; |
| | | newForm.Visible = true; |
| | | //实现子窗体的委托beg |
| | | EventInfo evt = newForm.GetType().GetEvent("ToUpdateParent", |
| | | BindingFlags.NonPublic | BindingFlags.Instance |
| | | | BindingFlags.Public |
| | | ); |
| | | if (evt != null) |
| | | evt.AddEventHandler(newForm, new EventHandler<UpdateParentEventArgs>(UpdateParent_OnChange)); |
| | | if (!string.IsNullOrEmpty(InitializeVal)) { |
| | | Assembly assembly = Assembly.GetExecutingAssembly(); |
| | | Type type = assembly.GetType(formName); |
| | | MethodInfo method = type.GetMethod("Initialize"); // 获取Initialize方法的信息 |
| | | if (method != null) |
| | | method.Invoke(newForm, new object[] { InitializeVal }); // 调用Initialize方法并传递参数 |
| | | } |
| | | //实现子窗体的委托end |
| | | return newForm; |
| | | } |
| | | catch (Exception) |
| | |
| | | |
| | | return null; |
| | | } |
| | | //实现子窗体的委托beg |
| | | private void UpdateParent_OnChange(object sender, UpdateParentEventArgs e) |
| | | { |
| | | List<string> _val = e.StringList; |
| | | string _formName = _val[0];//类名 |
| | | string _parm1= _val[1]; |
| | | var _obj = new |
| | | { |
| | | guid = _formName //主建 |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", "MenuAction/GetModelByNameSpace", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | var dy = _rtn.rtnData; |
| | | string tabPageName = dy.guid.ToString() + "_page"; |
| | | string tabText = dy.name.ToString(); //当前选项卡页Text标题 |
| | | string newFormName = dy.formPath.ToString(); //存路径,类名 |
| | | Image imgIcon = UtilityHelper.GetImgFromResource(dy.icon.ToString(), 2); |
| | | //先关闭 |
| | | RemoveTabPage(tab, tabPageName); |
| | | AddTabpage(tab, tabPageName, tabText,newFormName, imgIcon, _parm1); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | //实现子窗体的委托end |
| | | private int _userOut() |
| | | { |
| | | var _obj = new |