You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.2 KiB
C#

using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using Mesnac.Action.Base;
using Mesnac.Basic;
using Mesnac.Codd.Session;
using Mesnac.Controls.Base;
using Mesnac.Gui.Workbench;
using Mesnac.Gui.Run.Global;
using Mesnac.PlugIn.View;
using System.Reflection;
namespace Mesnac.Action.Default.Purview
{
public class RefreshSystemPurview : DatabaseAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime);//必须调用
//WorkbenchSingleton.Workbench.CloseAllViews(); //关闭所有视图面板
foreach(IViewContent vc in WorkbenchSingleton.Workbench.ViewContentCollection)
{
vc.IsRealClose = false;
WorkbenchSingleton.Workbench.CloseView(vc);
}
List<string> purviewList = Mesnac.Basic.UserInfo.Instance.PurviewList; //当前用户的权限列表
string[] keys = new string[WorkbenchSingleton.Workbench.ViewContentDic.Keys.Count];
WorkbenchSingleton.Workbench.ViewContentDic.Keys.CopyTo(keys, 0);
foreach (string key in keys)
{
IViewContent vc = WorkbenchSingleton.Workbench.ViewContentDic[key];
PropertyInfo p = vc.GetType().GetProperty("MCPurview");
bool isControlPruview = false;
if (bool.TryParse(p.GetValue(vc,null).ToString(),out isControlPruview))
{
if (isControlPruview == true) //需要权限控制
{
//if (!purviewList.Contains(key))
//{
//}
WorkbenchSingleton.Workbench.CloseViewByKey(key, true); //因为需要重新设定画面上按钮的权限,因此正真关闭
}
}
}
//WorkbenchSingleton.Workbench.CloseAllViews(false); //隐藏所有视图面板
//Mesnac.Gui.Common.RunEngine.Instance.CloseAllForms();
AppConfigHandler.Instance.InitCustomerMenuAndToolStrip(WorkbenchSingleton.Workbench.TopMenu, WorkbenchSingleton.Workbench.ToolStrip); //初始化自定义系统菜单和工具栏
}
}
}