/// <summary> /// Adds a new rule to the end of the list and selects it. /// </summary> private void AddRule() { UserScore_Rule newRule = new UserScore_Rule(GlobalStrings.AutoCatUserScore_NewRuleName, 0, 100, 0, 0); ruleList.Add(newRule); lstRules.SelectedIndex = lstRules.Items.Count - 1; }
public UserScore_Rule( UserScore_Rule other ) { Name = other.Name; MinScore = other.MinScore; MaxScore = other.MaxScore; MinReviews = other.MinReviews; MaxReviews = other.MaxReviews; }
public UserScore_Rule(UserScore_Rule other) { Name = other.Name; MinScore = other.MinScore; MaxScore = other.MaxScore; MinReviews = other.MinReviews; MaxReviews = other.MaxReviews; }
/// <summary> /// Moves the specified rule a certain number of spots up or down in the list. Does nothing if the spot would be off /// the list. /// </summary> /// <param name="mainIndex">Index of the rule to move.</param> /// <param name="offset">Number of spots to move the rule. Negative moves up, positive moves down.</param> /// <param name="selectMoved">If true, select the moved element afterwards</param> private void MoveItem(int mainIndex, int offset, bool selectMoved) { int alterIndex = mainIndex + offset; if ((mainIndex < 0) || (mainIndex >= lstRules.Items.Count) || (alterIndex < 0) || (alterIndex >= lstRules.Items.Count)) { return; } UserScore_Rule mainItem = ruleList[mainIndex]; ruleList[mainIndex] = ruleList[alterIndex]; ruleList[alterIndex] = mainItem; if (selectMoved) { lstRules.SelectedIndex = alterIndex; } }
private bool CheckRule(UserScore_Rule rule, int score, int reviews) { return((score >= rule.MinScore && score <= rule.MaxScore) && rule.MinReviews <= reviews && (rule.MaxReviews == 0 || rule.MaxReviews >= reviews)); }
private bool CheckRule( UserScore_Rule rule, int score, int reviews ) { return ( score >= rule.MinScore && score <= rule.MaxScore ) && rule.MinReviews <= reviews && ( rule.MaxReviews == 0 || rule.MaxReviews >= reviews ); }
/// <summary> /// Adds a new rule to the end of the list and selects it. /// </summary> private void AddRule() { UserScore_Rule newRule = new UserScore_Rule( GlobalStrings.AutoCatUserScore_NewRuleName, 0, 100, 0, 0 ); ruleList.Add( newRule ); lstRules.SelectedIndex = lstRules.Items.Count - 1; }