| | |
| | | using System.Windows.Forms; |
| | | using Gs.DevApp.ToolBox; |
| | | using Newtonsoft.Json; |
| | | using Gs.DevApp.Models; |
| | | using Gs.DevApp.Entity; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace Gs.DevApp.DevFrm |
| | |
| | | tab.CloseButtonClick += Tab_CloseButtonClick; |
| | | tooLoading.Click += TooLoading_Click; |
| | | getTree(); |
| | | barPwd.ItemClick += BarPwd_ItemClick; |
| | | barExit.ItemClick += BarExit_ItemClick; |
| | | this.FormClosing += FrmMain_FormClosing; |
| | | } |
| | | |
| | | private void FrmMain_FormClosing(object sender, FormClosingEventArgs e) |
| | | { |
| | | if (MsgHelper.AskQuestion("确定要退出系统吗?")) |
| | | { |
| | | int i = _userOut(); |
| | | if (i > 0) |
| | | { |
| | | this.FormClosing -= new FormClosingEventHandler(this.FrmMain_FormClosing); |
| | | Application.Exit(); |
| | | } |
| | | else |
| | | e.Cancel = true;//取消。返回窗体 |
| | | } |
| | | else |
| | | e.Cancel = true;//取消。返回窗体 |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 退出 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void BarExit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (MsgHelper.AskQuestion("确定要退出系统吗?")) |
| | | { |
| | | int i = _userOut(); |
| | | if (i > 0) |
| | | { |
| | | this.FormClosing -= new FormClosingEventHandler(this.FrmMain_FormClosing); |
| | | Application.Exit(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置用户密码 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void BarPwd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | User.UserSetPwd frm = new User.UserSetPwd(LoginInfoModel.CurrentUser.LoginUserGuid); |
| | | frm.ShowDialog(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重新加载系统 |
| | | /// </summary> |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private int _userOut() |
| | | { |
| | | var _obj = new |
| | | { |
| | | userGuid = LoginInfoModel.CurrentUser.LoginUserGuid, |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", "User/UserOut", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | return _rtn.rtnCode; |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnData.outMsg); |
| | | return _rtn.rtnCode; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | this.DialogResult = DialogResult.Cancel; |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | } |