729 lines
24 KiB
C#
729 lines
24 KiB
C#
|
using DevExpress.XtraBars;
|
|||
|
using DevExpress.XtraBars.Ribbon;
|
|||
|
using DevExpress.XtraSpreadsheet.TileLayout.Print;
|
|||
|
using DeviceRepair.Models.Common;
|
|||
|
using DeviceRepair.Utils;
|
|||
|
using System;
|
|||
|
using System.Linq;
|
|||
|
using System.Windows.Forms;
|
|||
|
using TsSFCDevice.Client.Biz.Base.Utils;
|
|||
|
using TsSFCDevice.Control;
|
|||
|
|
|||
|
namespace TsSFCDevice.Client.Launch
|
|||
|
{
|
|||
|
public partial class frm_Launch : RibbonForm
|
|||
|
{
|
|||
|
private BarButtonItem CurrentMenu;
|
|||
|
|
|||
|
public frm_Launch()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
AuthLayOut(false);
|
|||
|
}
|
|||
|
|
|||
|
private void frm_Launch_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//Scheduler.Instance.CallBack += InvokeChangeFormText;
|
|||
|
//Scheduler.Instance.Run();
|
|||
|
|
|||
|
this.FormClosing += (ss, ee) =>
|
|||
|
{
|
|||
|
if (XtraMessageBoxHelper.AskYesNo("确认现在退出系统吗?") != DialogResult.Yes)
|
|||
|
{
|
|||
|
ee.Cancel = true;
|
|||
|
}
|
|||
|
|
|||
|
//UserManager.Instance.LogOut();
|
|||
|
};
|
|||
|
|
|||
|
//获取 tips 保养计划弹窗数据
|
|||
|
try
|
|||
|
{
|
|||
|
// 检测是否首次登录及超过3个月未修改密码
|
|||
|
//APIResponseData apiResponseData2 = UserManager.Instance.CheckChangePwdDate(GlobalInfo.CurrentUser.LoginCode);
|
|||
|
//if (apiResponseData2.IsSuccess && apiResponseData2.ToBool())
|
|||
|
//{
|
|||
|
//PassChange:
|
|||
|
// if (new frmPwdModify(false).ShowDialog(this) == DialogResult.OK)
|
|||
|
// {
|
|||
|
// XtraMessageBoxHelper.Info("操作成功!");
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// goto PassChange;
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
//btn_VerNo.Caption = "V " + Application.ProductVersion;
|
|||
|
|
|||
|
//if (string.IsNullOrWhiteSpace(GlobalInfo.CurrentUser.RealName) || string.IsNullOrWhiteSpace(GlobalInfo.CurrentUser.LoginCode))
|
|||
|
// bSubLblUser.Visibility = BarItemVisibility.Never;
|
|||
|
//else
|
|||
|
// bSubLblUser.Caption = GlobalInfo.CurrentUser.LoginCode + "-" + GlobalInfo.CurrentUser.RealName;
|
|||
|
|
|||
|
//using (page_PlanDialog pd = new page_PlanDialog())
|
|||
|
//{
|
|||
|
// if (GlobalInfo.HasRole(AuthCodeConstValue.BIZ_PRESERVE))
|
|||
|
// {
|
|||
|
// if (pd.ShowDialog(this) == DialogResult.Cancel)
|
|||
|
// {
|
|||
|
// this.Close();
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// if (GlobalInfo.HasRole(AuthCodeConstValue.BIZ_PLAN))
|
|||
|
// {
|
|||
|
// //进入主程序
|
|||
|
// pnl_Content.ShowInPanel<page_MaintenancePlan>();
|
|||
|
// CurrentMenu = btn_DrivePlan;
|
|||
|
// SetButtonDown();
|
|||
|
// //SetPlansScheduleText();
|
|||
|
// }
|
|||
|
//}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBoxHelper.Error(ex.Message, "错误");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 委托更新显示值
|
|||
|
/// </summary>
|
|||
|
/// <param name="arg"></param>
|
|||
|
/// <param name="Value"></param>
|
|||
|
protected void InvokeChangeFormText(string arg, object Value)
|
|||
|
{
|
|||
|
this.Invoke(new Action(() =>
|
|||
|
{
|
|||
|
switch (arg)
|
|||
|
{
|
|||
|
case "SchedulerPlanTips":
|
|||
|
btn_PlanCount.Caption = Value + "";
|
|||
|
break;
|
|||
|
case "CurrentYearPlanSchedule":
|
|||
|
if (Value != null)
|
|||
|
{
|
|||
|
if (Value is CurrentYearPlanSchedule)
|
|||
|
barLb_Schedule.Caption = ((CurrentYearPlanSchedule)Value).ToString();
|
|||
|
else
|
|||
|
barLb_Schedule.Caption = Value + "";
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
}));
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 设备类型
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_Maintenance_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 报表
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_Import_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 设备保养计划
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_DrivePlan_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!Utility.SystemRuntimeInfo.AuthValidate(OperationAuthConstValue.PM_PLAN))
|
|||
|
{
|
|||
|
throw new Exception($"当前账号缺少此操作的权限");
|
|||
|
}
|
|||
|
|
|||
|
using (Plan.pageDevicePlanView view = new Plan.pageDevicePlanView())
|
|||
|
{
|
|||
|
view.ShowDialog(this);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
XtraMessageBoxHelper.Error(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 文档维护
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_FormVersionMaintenence_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!Utility.SystemRuntimeInfo.AuthValidate(OperationAuthConstValue.PM_CheckFORM))
|
|||
|
{
|
|||
|
throw new Exception($"当前账号缺少此操作的权限");
|
|||
|
}
|
|||
|
|
|||
|
using (CheckForm.pageCheckFormView view = new CheckForm.pageCheckFormView())
|
|||
|
{
|
|||
|
view.ShowDialog(this);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
XtraMessageBoxHelper.Error(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 设备台账
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_Report01_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!Utility.SystemRuntimeInfo.AuthValidate(OperationAuthConstValue.PM_Device_KH)
|
|||
|
&& !Utility.SystemRuntimeInfo.AuthValidate(OperationAuthConstValue.PM_Device_OEM)
|
|||
|
)
|
|||
|
{
|
|||
|
throw new Exception($"当前账号缺少此操作的权限");
|
|||
|
}
|
|||
|
|
|||
|
using (Device.pageDeviceView view = new Device.pageDeviceView())
|
|||
|
{
|
|||
|
view.ShowDialog(this);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
|
|||
|
XtraMessageBoxHelper.Error(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
// pnl_Content.ShowInPanel<page_Setting>();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 设备保养记录
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_MaintenanceLst_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 密码修改
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 用户管理
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_UserManager_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 角色管理
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void barButtonItem5_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void SetButtonDown()
|
|||
|
{
|
|||
|
|
|||
|
var DownControl = ribbonControl.Items.FirstOrDefault(x => x is BarBaseButtonItem && (x as BarBaseButtonItem).Down && x != CurrentMenu);
|
|||
|
if (DownControl != null)
|
|||
|
{
|
|||
|
(DownControl as BarBaseButtonItem).Down = false;
|
|||
|
}
|
|||
|
|
|||
|
if (CurrentMenu != null)
|
|||
|
{
|
|||
|
CurrentMenu.ButtonStyle = BarButtonStyle.Check;
|
|||
|
CurrentMenu.Down = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 显示计划提醒小窗
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btn_PlanCount_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!Utility.SystemRuntimeInfo.AuthValidate(OperationAuthConstValue.PM_CheckFORM_Add))
|
|||
|
{
|
|||
|
throw new Exception($"当前账号缺少此操作的权限");
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
splashScreenManager1.ShowWaitForm();
|
|||
|
using (page_PlanDialog view = new page_PlanDialog())
|
|||
|
{
|
|||
|
splashScreenManager1.TryCloseWait();
|
|||
|
view.ShowDialog(this);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
splashScreenManager1.TryCloseWait();
|
|||
|
XtraMessageBoxHelper.Error(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void barButtonItem6_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 现象区分
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void bar_SymptomlDistinction_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 维修方式
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void bar_Maintenance_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 设备维修台账 - (新)
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void bar_btn_EquipmentMaintenanceLst_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!Utility.SystemRuntimeInfo.AuthValidate(OperationAuthConstValue.Device_REPAIRRECORD))
|
|||
|
{
|
|||
|
throw new Exception($"当前账号缺少此操作的权限");
|
|||
|
}
|
|||
|
|
|||
|
using (Maintain.pageMaintainView view = new Maintain.pageMaintainView())
|
|||
|
{
|
|||
|
view.ShowDialog(this);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
splashScreenManager1.TryCloseWait();
|
|||
|
XtraMessageBoxHelper.Error(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 配件维护
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 故障发生地
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void barButtonItem8_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 系统设置
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btnSystemSetting_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 用户登录登出日志
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void barButtonItem13_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// AM 的树形设备清单
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void Am_List_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// AM的保养计划
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void Am_Plans_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// tag
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btnTagMgr_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// AM 的点检表维护
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void Am_Form_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// AM的保养记录
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void Am_Record_ItemClick(object sender, ItemClickEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#region 方法
|
|||
|
|
|||
|
void AuthLayOut(bool beRefreshAuths)
|
|||
|
{
|
|||
|
if (beRefreshAuths)
|
|||
|
{
|
|||
|
#region 重新加载用户权限角色集合 Myl20210531
|
|||
|
|
|||
|
//UserRepository vUserRepos = new UserRepository(false);
|
|||
|
//Utility.SystemRuntimeInfo.CurrentUser.Roles = vUserRepos.UserRolesGet(Utility.SystemRuntimeInfo.CurrentUser.GUID.Value.ToString());
|
|||
|
//Utility.SystemRuntimeInfo.CurrentUser.Auths = vUserRepos.UserAuthsGet(Utility.SystemRuntimeInfo.CurrentUser.UserCode);
|
|||
|
|
|||
|
//if (Utility.SystemRuntimeInfo.CurrentUser.Roles == null || Utility.SystemRuntimeInfo.CurrentUser.Auths == null)
|
|||
|
//{
|
|||
|
// XtraMessageBoxHelper.Warn("用户重新分配了角色或权限,重现分配后,角色或者权限为空!");
|
|||
|
// ribbon.Enabled = false;
|
|||
|
//}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
ribbonControl.Pages.ForEach(x => { PageControlAuthLayOut(x); });
|
|||
|
}
|
|||
|
|
|||
|
void PageControlAuthLayOut(RibbonPage vRPage)
|
|||
|
{
|
|||
|
vRPage.Groups.ForEach(A => { PageGroupAuthLayOut(A); });
|
|||
|
|
|||
|
var vVisibleGroup = vRPage.Groups.FirstOrDefault(A =>
|
|||
|
{
|
|||
|
return A.Visible == true;
|
|||
|
});
|
|||
|
|
|||
|
if (vVisibleGroup == null)
|
|||
|
{
|
|||
|
vRPage.Visible = false;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
vRPage.Visible = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void PageGroupAuthLayOut(RibbonPageGroup vRPageGroup)
|
|||
|
{
|
|||
|
bool bShow = false;
|
|||
|
if (vRPageGroup.ItemLinks.Count > 0)
|
|||
|
{
|
|||
|
foreach (var item in vRPageGroup.ItemLinks)
|
|||
|
{
|
|||
|
if (item is BarButtonItemLink)
|
|||
|
{
|
|||
|
#region BarButtonItemLink
|
|||
|
|
|||
|
var vBar = (BarButtonItemLink)item;
|
|||
|
if (vBar.Item != null)
|
|||
|
{
|
|||
|
if (vBar.Item.Tag != null)
|
|||
|
{
|
|||
|
if (Utility.SystemRuntimeInfo.AuthValidate(vBar.Item.Tag.ToString()))
|
|||
|
{
|
|||
|
if (vBar.Item.ButtonStyle != BarButtonStyle.DropDown)
|
|||
|
{
|
|||
|
vBar.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PopMenuBarButtonItemAuthLayOut(vBar.Item);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (vBar.Item.ButtonStyle != BarButtonStyle.DropDown)
|
|||
|
{
|
|||
|
vBar.Item.Visibility = BarItemVisibility.Never;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PopMenuBarButtonItemAuthLayOut(vBar.Item);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
vBar.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
vBar.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
if (vBar.Item.Visibility == BarItemVisibility.Always)
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
var vVisibleGroup = vRPageGroup.ItemLinks.FirstOrDefault(
|
|||
|
A =>
|
|||
|
{
|
|||
|
if (A is BarButtonItemLink)
|
|||
|
{
|
|||
|
return ((BarButtonItemLink)A).Item.Visibility == BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else if (A is BarSubItemLink)
|
|||
|
{
|
|||
|
return ((BarSubItemLink)A).Item.Visibility == BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
);
|
|||
|
if (vVisibleGroup == null)
|
|||
|
{
|
|||
|
vRPageGroup.Visible = false;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
vRPageGroup.Visible = true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
vRPageGroup.Visible = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void PopMenuBarButtonSubItemAuthLayOut(BarSubItem barItem, ref bool bShow)
|
|||
|
{
|
|||
|
if ((barItem.ItemLinks?.Count() ?? 0) == 0)
|
|||
|
{
|
|||
|
barItem.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
foreach (var item in barItem.ItemLinks)
|
|||
|
{
|
|||
|
if (item is BarButtonItemLink)
|
|||
|
{
|
|||
|
#region BarButtonItemLink
|
|||
|
var vPopBarItem = item as BarButtonItemLink;
|
|||
|
if (vPopBarItem.Item != null)
|
|||
|
{
|
|||
|
if (vPopBarItem.Item.Tag != null)
|
|||
|
{
|
|||
|
if (Utility.SystemRuntimeInfo.AuthValidate(vPopBarItem.Item.Tag.ToString()))
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (Utility.SystemRuntimeInfo.AuthStartWithValidate(vPopBarItem.Item.Tag.ToString()))
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Never;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
else if (item is BarSubItemLink)
|
|||
|
{
|
|||
|
var vPopSubBarItem = item as BarSubItemLink;
|
|||
|
if (vPopSubBarItem != null)
|
|||
|
{
|
|||
|
var vSubBarItem = vPopSubBarItem.Item as BarSubItem;
|
|||
|
var vShowFlag = false;
|
|||
|
PopMenuBarButtonSubItemAuthLayOut(vSubBarItem, ref vShowFlag);
|
|||
|
if (vShowFlag)
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if (bShow)
|
|||
|
{
|
|||
|
barItem.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
barItem.Visibility = BarItemVisibility.Never;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void PopMenuBarButtonItemAuthLayOut(BarButtonItem barItem)
|
|||
|
{
|
|||
|
bool bShow = false;
|
|||
|
var pm = barItem.DropDownControl as PopupMenu;
|
|||
|
if (pm == null)
|
|||
|
{
|
|||
|
barItem.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
foreach (var item in pm.ItemLinks)
|
|||
|
{
|
|||
|
if (item is BarButtonItemLink)
|
|||
|
{
|
|||
|
#region BarButtonItemLink
|
|||
|
var vPopBarItem = item as BarButtonItemLink;
|
|||
|
if (vPopBarItem.Item != null)
|
|||
|
{
|
|||
|
if (vPopBarItem.Item.Tag != null)
|
|||
|
{
|
|||
|
if (Utility.SystemRuntimeInfo.AuthValidate(vPopBarItem.Item.Tag.ToString()))
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (Utility.SystemRuntimeInfo.AuthStartWithValidate(vPopBarItem.Item.Tag.ToString()))
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Never;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
vPopBarItem.Item.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
else if (item is BarSubItemLink)
|
|||
|
{
|
|||
|
var vPopSubBarItem = item as BarSubItemLink;
|
|||
|
if (vPopSubBarItem != null)
|
|||
|
{
|
|||
|
var vSubBarItem = vPopSubBarItem.Item as BarSubItem;
|
|||
|
var vShowFlag = false;
|
|||
|
PopMenuBarButtonSubItemAuthLayOut(vSubBarItem, ref vShowFlag);
|
|||
|
if (vShowFlag)
|
|||
|
{
|
|||
|
bShow = true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if (bShow)
|
|||
|
{
|
|||
|
barItem.Visibility = BarItemVisibility.Always;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
barItem.Visibility = BarItemVisibility.Never;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|