private void ListConditions(SecurityAction sa) { this.Cursor = Cursors.WaitCursor; this.flowLayoutPanel1.SuspendLayout(); try { ClearFlowPanel(); foreach (SecurityCondition sc in sa.Conditions) { ucCondition ctl = new ucCondition(); ctl.UpdateConditionEvent += new ucCondition.UpdateConditionEventHandler(UpdateCondition); ctl.SetCondition(sc); ctl.ShowEditPanel = false; this.flowLayoutPanel1.Controls.Add(ctl); } } catch (Exception ex) { throw new Exception(string.Format("初始化用户行为{0}的条件列表失败,错误消息为:{1}", sa.Name, ex.Message)); } finally { this.flowLayoutPanel1.ResumeLayout(); this.Cursor = Cursors.Default; } }
private void AddConditon2Action(string eventGuid, string actionGuid, SecurityCondition sc) { TreeNode pNode = null; if (!FindParentNode(eventGuid, actionGuid, out pNode)) { MessageBox.Show("添加条件前,请先选中条件所属安全行为"); return; } ucCondition ctl = FindConditon(sc.ConditionGuid); if (ctl != null) { MessageBox.Show("已经存在相同标识符的条件"); ctl.IsRuleSelected = true; return; } ctl = new ucCondition(); ctl.SetCondition(sc); ctl.UpdateConditionEvent += new ucCondition.UpdateConditionEventHandler(UpdateCondition); this.flowLayoutPanel1.Controls.Add(ctl); }
private void RemoveConditon(string eventGuid, string actionGuid, string conditionGuid) { TreeNode pNode = null; if (!FindParentNode(eventGuid, actionGuid, out pNode)) { MessageBox.Show("删除条件前,请先选中条件所属安全行为"); return; } ucCondition ctl = FindConditon(conditionGuid); if (ctl == null) { MessageBox.Show("要删除的条件不存在"); return; } this.flowLayoutPanel1.Controls.Remove(ctl); }
private void RefreshCondition(string eventGuid, string actionGuid, SecurityCondition sc) { TreeNode pNode = null; if (!FindParentNode(eventGuid, actionGuid, out pNode)) { MessageBox.Show("更新条件前,请先选中条件所属安全行为"); return; } ucCondition ctl = FindConditon(sc.ConditionGuid); if (ctl == null) { MessageBox.Show("要更新的条件不存在"); return; } ctl.SetCondition(sc); }