void rule_browser_ReloadDataEvent(RuleActiveSet RuleActiveSetS) { if (d_RuleActiveSet == true) { #region 添加新规则 if (RuleActiveSetS.OptState == OptState.Add && RuleActiveSetS.StartStateName != "" && RuleActiveSetS.EndStateName != "") { //检测是否已添加此状态 for (int i = 0; i < Rules.Count; i++) { if (Rules[i].StrStartActive == RuleActiveSetS.StartStateName && Rules[i].StrEndActive == RuleActiveSetS.EndStateName) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("PROMPT"), Utility.GetResourceStr("M00008"), Utility.GetResourceStr("CONFIRMBUTTON")); //MessageBox.Show("此规则已添加,不能添加相同的规则!"); return; } } if ((string.IsNullOrEmpty(BOSystem.Name) || string.IsNullOrEmpty(BOObject.Name)) && !string.IsNullOrEmpty(RuleActiveSetS.BOSystem.Name) && !string.IsNullOrEmpty(RuleActiveSetS.BOObject.Name)) { BOSystem = RuleActiveSetS.BOSystem; BOObject = RuleActiveSetS.BOObject; //this.tbSystemAndBusinessObject.Text = } RuleLine a = new RuleLine(); a.Name = System.Guid.NewGuid().ToString(); a.StrStartActive = RuleActiveSetS.StartStateName; a.StrEndActive = RuleActiveSetS.EndStateName; a.Container = this; a.ruleCoditions = new RuleConditions(); a.ruleCoditions.subCondition.Clear(); if (RuleActiveSetS.CoditionList.Count > 0) { a.ruleCoditions.ConditionObject = BOObject.Name; foreach (CompareCondition cpItem in RuleActiveSetS.CoditionList) { a.ruleCoditions.subCondition.Add(cpItem); } } // StartFlow.GetValue(Canvas.TopProperty) ; //Double X1 = 60 + Convert.ToDouble((FindName(a.StrStartActive) as StateActive).GetValue(Canvas.TopProperty).ToString()); //Double Y1 = 50 + Convert.ToDouble((FindName(a.StrStartActive) as StateActive).GetValue(Canvas.LeftProperty).ToString()); //a.SetValue(Canvas.TopProperty, X1);//(double)110); //a.SetValue(Canvas.LeftProperty, Y1);//(double)450); if (!cnsDesignerContainer.Children.Contains(a)) { cnsDesignerContainer.Children.Add(a); SetRuleLinePos(a.Name); Rules.Add(a); // a.ActivityChanged += new ActivityChangeDelegate(OnActivityChanged); } } #endregion #region 修改规则 else if (RuleActiveSetS.OptState == OptState.Update && RuleActiveSetS.StartStateName != "" && RuleActiveSetS.EndStateName != "") { if ((string.IsNullOrEmpty(BOSystem.Name) || string.IsNullOrEmpty(BOObject.Name)) && !string.IsNullOrEmpty(RuleActiveSetS.BOSystem.Name) && !string.IsNullOrEmpty(RuleActiveSetS.BOObject.Name)) { BOSystem = RuleActiveSetS.BOSystem; BOObject = RuleActiveSetS.BOObject; } RuleLine a = FindName(RuleActiveSetS.RuleName) as RuleLine; a.StrStartActive = RuleActiveSetS.StartStateName; a.StrEndActive = RuleActiveSetS.EndStateName; if (a.ruleCoditions == null) { a.ruleCoditions = new RuleConditions(); } a.ruleCoditions.subCondition.Clear(); if (RuleActiveSetS.CoditionList.Count > 0) { a.ruleCoditions.ConditionObject = BOObject.Name; foreach (CompareCondition cpItem in RuleActiveSetS.CoditionList) { a.ruleCoditions.subCondition.Add(cpItem); } } SetRuleLinePos(a.Name); } #endregion #region 除规则 else if (RuleActiveSetS.OptState == OptState.Delete) { RuleLine a = FindName(RuleActiveSetS.RuleName) as RuleLine; if (a == null) { return; } if (a.ruleCoditions != null) { a.ruleCoditions.subCondition.Clear(); } Rules.Remove(a); cnsDesignerContainer.Children.Remove(a); } #endregion } }
void rule_browser_ReloadDataEvent(RuleActiveSet RuleActiveSetS) { if (d_RuleActiveSet == true) { #region 添加新规则 if (RuleActiveSetS.OptState == OptState.Add && RuleActiveSetS.StartStateName != "" && RuleActiveSetS.EndStateName != "") { //检测是否已添加此状态 for (int i = 0; i < Rules.Count; i++) { if (Rules[i].StrStartActive == RuleActiveSetS.StartStateName && Rules[i].StrEndActive == RuleActiveSetS.EndStateName) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("PROMPT"), Utility.GetResourceStr("M00008"), Utility.GetResourceStr("CONFIRMBUTTON")); //MessageBox.Show("此规则已添加,不能添加相同的规则!"); return; } } if ((string.IsNullOrEmpty(BOSystem.Name) || string.IsNullOrEmpty(BOObject.Name)) && !string.IsNullOrEmpty(RuleActiveSetS.BOSystem.Name) && !string.IsNullOrEmpty(RuleActiveSetS.BOObject.Name)) { BOSystem = RuleActiveSetS.BOSystem; BOObject = RuleActiveSetS.BOObject; //this.tbSystemAndBusinessObject.Text = } RuleLine a = new RuleLine(); a.Name = System.Guid.NewGuid().ToString(); a.StrStartActive = RuleActiveSetS.StartStateName; a.StrEndActive = RuleActiveSetS.EndStateName; a.Container = this; a.ruleCoditions = new RuleConditions(); a.ruleCoditions.subCondition.Clear(); if (RuleActiveSetS.CoditionList.Count > 0) { a.ruleCoditions.ConditionObject = BOObject.Name; foreach (CompareCondition cpItem in RuleActiveSetS.CoditionList) { a.ruleCoditions.subCondition.Add(cpItem); } } // StartFlow.GetValue(Canvas.TopProperty) ; //Double X1 = 60 + Convert.ToDouble((FindName(a.StrStartActive) as StateActive).GetValue(Canvas.TopProperty).ToString()); //Double Y1 = 50 + Convert.ToDouble((FindName(a.StrStartActive) as StateActive).GetValue(Canvas.LeftProperty).ToString()); //a.SetValue(Canvas.TopProperty, X1);//(double)110); //a.SetValue(Canvas.LeftProperty, Y1);//(double)450); if (!cnsDesignerContainer.Children.Contains(a)) { cnsDesignerContainer.Children.Add(a); SetRuleLinePos(a.Name); Rules.Add(a); // a.ActivityChanged += new ActivityChangeDelegate(OnActivityChanged); } } #endregion #region 修改规则 else if (RuleActiveSetS.OptState == OptState.Update && RuleActiveSetS.StartStateName != "" && RuleActiveSetS.EndStateName != "") { if ((string.IsNullOrEmpty(BOSystem.Name) || string.IsNullOrEmpty(BOObject.Name)) && !string.IsNullOrEmpty(RuleActiveSetS.BOSystem.Name) && !string.IsNullOrEmpty(RuleActiveSetS.BOObject.Name)) { BOSystem = RuleActiveSetS.BOSystem; BOObject = RuleActiveSetS.BOObject; } RuleLine a = FindName(RuleActiveSetS.RuleName) as RuleLine; a.StrStartActive = RuleActiveSetS.StartStateName; a.StrEndActive = RuleActiveSetS.EndStateName; if (a.ruleCoditions == null) a.ruleCoditions = new RuleConditions(); a.ruleCoditions.subCondition.Clear(); if (RuleActiveSetS.CoditionList.Count > 0) { a.ruleCoditions.ConditionObject = BOObject.Name; foreach (CompareCondition cpItem in RuleActiveSetS.CoditionList) { a.ruleCoditions.subCondition.Add(cpItem); } } SetRuleLinePos(a.Name); } #endregion #region 删除规则 else if (RuleActiveSetS.OptState == OptState.Delete) { RuleLine a = FindName(RuleActiveSetS.RuleName) as RuleLine; if (a == null) return; if (a.ruleCoditions != null) a.ruleCoditions.subCondition.Clear(); Rules.Remove(a); cnsDesignerContainer.Children.Remove(a); } #endregion } }