private void listBox_role_total_DoubleClick(object sender, EventArgs e) { if (listBox_role_total.SelectedIndex >= 0) { IRoleConfig config = listBox_role_total.Items[listBox_role_total.SelectedIndex] as IRoleConfig; if (config != null) { if (!listBox_role_user.Items.Contains(config)) { listBox_role_user.Items.Add(config); } } } }
public void ShowAddDialog(IConfigManager <IRoleConfig> manager) { Text = "新增角色"; mIsOk = false; mManager = manager; mConfig = null; if (mManager.SystemContext.MonitorSystem.Verify(manager.TypeName, "角色", (ushort)ACOpts.Manager_Add, false)) { InitACList(mManager.SystemContext); if (InitDialog()) { ShowDialog(); } } }
public override void ShowEditDialog(IConfig config) { Text = "编辑角色 - [" + config.Name + "]"; mIsOk = false; mManager = null; mConfig = config as IRoleConfig; if (config.Verify(ACOpts.Manager_Modify, false)) { InitACList(mConfig.SystemContext); if (InitDialog()) { ShowDialog(); } } }
public List<TaskSet> BuildTaskSet(List<Template> templates, IRoleConfig roleConfig) { var roleList = roleConfig.GetRoleListToRunOnThisMachine(); var setList = new List<TaskSet>(); foreach (var template in templates) { foreach (var wi in template.WorkItems) { if (roleList.Contains(wi.RoleName)) { setList.AddRange(wi.TaskSet.ToArray()); } } } return setList; }
protected bool SetConfig() { if (mConfig == null && mManager != null) { mConfig = mManager.CreateConfigInstance(); } if (mConfig != null) { (mConfig as CConfig).Name = textBox_name.Text; mConfig.SetValue("Name", textBox_name.Text); mConfig.Desc = textBox_desc.Text; mConfig.Enabled = checkBox_enabled.Checked; IACItem acitem; IConfig config; CNameDescMap type; bool isview, ismanager, isexec; mConfig.ClearACItem(); foreach (DataGridViewRow row in dataGridView_ACList.Rows) { isview = Convert.ToBoolean(row.Cells[3].Value.ToString()); ismanager = Convert.ToBoolean(row.Cells[4].Value.ToString()); isexec = Convert.ToBoolean(row.Cells[5].Value.ToString()); if (isview || ismanager || isexec) { type = row.Cells[1].Value as CNameDescMap; config = row.Cells[2].Value as IConfig; acitem = mConfig.AppendACItem(); acitem.Type = type != null ? type.Name : row.Cells[1].Value.ToString(); acitem.Name = config != null ? config.Name : row.Cells[2].Value.ToString(); acitem.CtrlOpt = (ushort)((isview ? ACOpts.View : ACOpts.None) | (ismanager ? ACOpts.Manager : ACOpts.None) | (isexec ? ACOpts.Exec : ACOpts.None)); } } return(true); } return(false); }
private void InitUserRoleList() { listBox_role_user.Items.Clear(); if (mConfig != null) { string[] roles = mConfig.RoleList.Split(';'); if (roles != null && roles.Length > 0) { IRoleConfig config = null; foreach (string role in roles) { config = mConfig.SystemContext.RoleConfigManager.GetConfig(role); if (config != null) { listBox_role_user.Items.Add(config); } } } } }
private void contextMenuStrip_func_Opening(object sender, CancelEventArgs e) { ToolStripMenuItem_init.Visible = false; ToolStripMenuItem_start.Visible = false; ToolStripMenuItem_add.Visible = false; ToolStripMenuItem_edit.Visible = false; ToolStripMenuItem_delete.Visible = false; ToolStripMenuItem_refresh.Visible = false; ToolStripMenuItem_refresh.Text = "Ë¢ÐÂ"; ToolStripMenuItem_1.Visible = false; ToolStripMenuItem_2.Visible = false; ToolStripMenuItem_3.Visible = false; if (mCurNode != null) { IConfigManager configManager = mCurNode.ExtConfigObj as IConfigManager; if (configManager != null) { ToolStripMenuItem_add.Visible = configManager.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_refresh.Visible = true; ToolStripMenuItem_3.Visible = configManager.SystemContext.MonitorSystem.IsLogin; return; } IConfigType type = mCurNode.ExtConfigObj as IConfigType; if (type != null) { ToolStripMenuItem_add.Visible = type.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_edit.Visible = type.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_delete.Visible = type.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_refresh.Visible = true; ToolStripMenuItem_3.Visible = type.SystemContext.MonitorSystem.IsLogin; return; } IRoleConfig roleConfig = mCurNode.ExtConfigObj as IRoleConfig; if (roleConfig != null) { ToolStripMenuItem_start.Visible = false; ToolStripMenuItem_edit.Visible = roleConfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_delete.Visible = roleConfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_refresh.Visible = false; ToolStripMenuItem_1.Visible = false; ToolStripMenuItem_3.Visible = false; return; } IUserConfig userConfig = mCurNode.ExtConfigObj as IUserConfig; if (userConfig != null) { ToolStripMenuItem_refresh.Text = "ÐÞ¸ÄÃÜÂë"; bool isLogin = userConfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_start.Visible = false; ToolStripMenuItem_edit.Visible = isLogin; ToolStripMenuItem_delete.Visible = isLogin; ToolStripMenuItem_refresh.Visible = isLogin && userConfig.SystemContext.MonitorSystem.UserName.Equals(userConfig.Name); ToolStripMenuItem_1.Visible = false; ToolStripMenuItem_3.Visible = isLogin && userConfig.SystemContext.MonitorSystem.UserName.Equals(userConfig.Name); return; } IMonitorSystemContext sysContext = mCurNode.ExtConfigObj as IMonitorSystemContext; if (sysContext != null && sysContext.IsLocalSystem) { ToolStripMenuItem_start.Text = mCurNode.IsStart ? "×¢Ïú" : "µÇ¼"; ToolStripMenuItem_start.Visible = true; ToolStripMenuItem_edit.Visible = sysContext.MonitorSystem.IsLogin; ToolStripMenuItem_delete.Visible = false; ToolStripMenuItem_refresh.Visible = true; ToolStripMenuItem_1.Visible = true; ToolStripMenuItem_3.Visible = sysContext.MonitorSystem.IsLogin; return; } IRemoteSystemConfig rsConfig = mCurNode.ExtConfigObj as IRemoteSystemConfig; if (rsConfig != null) { ToolStripMenuItem_start.Text = mCurNode.IsStart ? "×¢Ïú" : "µÇ¼"; ToolStripMenuItem_start.Visible = rsConfig.Enabled && rsConfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_edit.Visible = rsConfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_delete.Visible = rsConfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_refresh.Visible = true; ToolStripMenuItem_1.Visible = rsConfig.Enabled && rsConfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_3.Visible = rsConfig.SystemContext.MonitorSystem.IsLogin; return; } IVideoSourceConfig vsconfig = mCurNode.ExtConfigObj as IVideoSourceConfig; if (vsconfig != null) { ToolStripMenuItem_init.Text = mCurNode.IsInit ? "¹Ø±Õ" : "´ò¿ª"; ToolStripMenuItem_start.Text = mCurNode.IsStart ? "Í£Ö¹" : "²¥·Å"; ToolStripMenuItem_init.Visible = vsconfig.Enabled; ToolStripMenuItem_start.Visible = mCurNode.IsInit; ToolStripMenuItem_edit.Visible = vsconfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_delete.Visible = vsconfig.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_1.Visible = vsconfig.Enabled && mCurNode.IsInit; ToolStripMenuItem_2.Visible = vsconfig.Enabled && vsconfig.SystemContext.MonitorSystem.IsLogin; return; } IConfig config = mCurNode.ExtConfigObj as IConfig; if (config != null) { ToolStripMenuItem_init.Text = mCurNode.IsInit ? "жÔØ" : "¼ÓÔØ"; ToolStripMenuItem_start.Text = mCurNode.IsStart ? "Í£Ö¹" : "Æô¶¯"; ToolStripMenuItem_init.Visible = config.Enabled; ToolStripMenuItem_start.Visible = mCurNode.IsInit; ToolStripMenuItem_edit.Visible = config.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_delete.Visible = config.SystemContext.MonitorSystem.IsLogin; ToolStripMenuItem_1.Visible = config.Enabled && mCurNode.IsInit; ToolStripMenuItem_2.Visible = config.Enabled && config.SystemContext.MonitorSystem.IsLogin; return; } ToolStripMenuItem_refresh.Visible = true; } }
public static void AddRemoteConfig(IMonitorSystemContext context, string name, string data, bool saveConfig) { IConfig config = null; if (data.StartsWith("<Monitor>")) { config = context.MonitorConfigManager.GetConfig(name); if (config == null) { IMonitorConfig monitorConfig = context.MonitorConfigManager.BuildConfigFromXml(data) as IMonitorConfig; if (monitorConfig != null) { context.MonitorConfigManager.Append(monitorConfig, saveConfig); } } } else if (data.StartsWith("<MonitorType>")) { config = context.MonitorTypeManager.GetConfig(name); if (config == null) { IMonitorType monitorType = context.MonitorTypeManager.BuildConfigFromXml(data) as IMonitorType; if (monitorType != null) { context.MonitorTypeManager.Append(monitorType, saveConfig); } } } else if (data.StartsWith("<VideoSource>")) { config = context.VideoSourceConfigManager.GetConfig(name); if (config == null) { IVideoSourceConfig vsConfig = context.VideoSourceConfigManager.BuildConfigFromXml(data) as IVideoSourceConfig; if (vsConfig != null) { context.VideoSourceConfigManager.Append(vsConfig, saveConfig); } } } else if (data.StartsWith("<VideoSourceType>")) { config = context.VideoSourceTypeManager.GetConfig(name); if (config == null) { IVideoSourceType vsType = context.VideoSourceTypeManager.BuildConfigFromXml(data) as IVideoSourceType; if (vsType != null) { context.VideoSourceTypeManager.Append(vsType, saveConfig); } } } else if (data.StartsWith("<Action>")) { config = context.ActionConfigManager.GetConfig(name); if (config == null) { IActionConfig actionConfig = context.ActionConfigManager.BuildConfigFromXml(data) as IActionConfig; if (actionConfig != null) { context.ActionConfigManager.Append(actionConfig, saveConfig); } } } else if (data.StartsWith("<ActionType>")) { config = context.ActionTypeManager.GetConfig(name); if (config == null) { IActionType actionType = context.ActionTypeManager.BuildConfigFromXml(data) as IActionType; if (actionType != null) { context.ActionTypeManager.Append(actionType, saveConfig); } } } else if (data.StartsWith("<Scheduler>")) { config = context.SchedulerConfigManager.GetConfig(name); if (config == null) { ISchedulerConfig schedulerConfig = context.SchedulerConfigManager.BuildConfigFromXml(data) as ISchedulerConfig; if (schedulerConfig != null) { context.SchedulerConfigManager.Append(schedulerConfig, saveConfig); } } } else if (data.StartsWith("<SchedulerType>")) { config = context.SchedulerTypeManager.GetConfig(name); if (config == null) { ISchedulerType schedulerType = context.SchedulerTypeManager.BuildConfigFromXml(data) as ISchedulerType; if (schedulerType != null) { context.SchedulerTypeManager.Append(schedulerType, saveConfig); } } } else if (data.StartsWith("<Task>")) { config = context.TaskConfigManager.GetConfig(name); if (config == null) { ITaskConfig taskConfig = context.TaskConfigManager.BuildConfigFromXml(data) as ITaskConfig; if (taskConfig != null) { context.TaskConfigManager.Append(taskConfig, saveConfig); } } } else if (data.StartsWith("<TaskType>")) { config = context.TaskTypeManager.GetConfig(name); if (config == null) { ITaskType taskType = context.TaskTypeManager.BuildConfigFromXml(data) as ITaskType; if (taskType != null) { context.TaskTypeManager.Append(taskType, saveConfig); } } } else if (data.StartsWith("<RemoteSystem>")) { config = context.RemoteSystemConfigManager.GetConfig(name); if (config == null) { IRemoteSystemConfig rsConfig = context.RemoteSystemConfigManager.BuildConfigFromXml(data) as IRemoteSystemConfig; if (rsConfig != null) { context.RemoteSystemConfigManager.Append(rsConfig, saveConfig); } } } else if (data.StartsWith("<Role>")) { config = context.RoleConfigManager.GetConfig(name); if (config == null) { IRoleConfig roleConfig = context.RoleConfigManager.BuildConfigFromXml(data) as IRoleConfig; if (roleConfig != null) { context.RoleConfigManager.Append(roleConfig, saveConfig); } } } else if (data.StartsWith("<User>")) { config = context.UserConfigManager.GetConfig(name); if (config == null) { IUserConfig userConfig = context.UserConfigManager.BuildConfigFromXml(data) as IUserConfig; if (userConfig != null) { context.UserConfigManager.Append(userConfig, saveConfig); } } } }