Exemplo n.º 1
0
 public static void SetHighlightRule(TextBlock textBlock, HighlightRule value)
 {
     textBlock.SetValue(HighlightRuleProperty, value);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Adds a rule to the current object
 /// </summary>
 /// <param name="key">Key to associate the rule with</param>
 /// <param name="rule">HighlightRule object</param>
 public void AddRule(string key, HighlightRule rule)
 {
     this._highlightRules.Add(key, rule);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Edit an existing rule
 /// </summary>
 /// <param name="keys">Array of existing keys</param>
 /// <param name="type">Type of edit</param>
 /// <param name="newValue">New value of parameter</param>
 /// <returns>Self</returns>
 public HighlightRules EditRules(string[] keys, HighlightRule.EditType type, object newValue)
 {
     foreach (string key in keys)
     {
         if (type == HighlightRule.EditType.Dependencies)
         {
             if (this._highlightDependencies.ContainsKey(key))
             {
                 if (newValue == null)
                     this._highlightDependencies.Remove(key);
                 else
                     this._highlightDependencies[key] = newValue as string[];
             }
             else if (newValue != null)
                 this._highlightDependencies.Add(key, newValue as string[]);
         }
         else
             this._highlightRules[key] = this._highlightRules[key].GetModifiedObject(type, newValue);
     }
     return this;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the value of an existing rule.
 /// </summary>
 /// <param name="key">Key of an existing rule</param>
 /// <param name="rule">HighlightRule object</param>
 /// <param name="dependencies">A string array containing the keys of other rules. [CAUTION!]: DO NOT USE THE CURRENT GROUP NAME.</param>
 public void SetRule(string key, HighlightRule rule, string[] dependencies)
 {
     if (this._highlightRules.ContainsKey(key) && this._highlightDependencies.ContainsKey(key))
     {
         this._highlightRules[key] = rule;
         this._highlightDependencies[key] = dependencies;
     }
     else
         throw new KeyNotFoundException("The key `" + key + "` was not found.");
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds a rule to the current object with recursive dependencies
 /// </summary>
 /// <param name="key">Key to associate the rule with</param>
 /// <param name="rule">HighlightRule object</param>
 /// <param name="dependencies">A string array containing the keys of other rules. [CAUTION!]: DO NOT USE THE CURRENT GROUP NAME.</param>
 public void AddRule(string key, HighlightRule rule, string[] dependencies)
 {
     this._highlightRules.Add(key, rule);
     this._highlightDependencies.Add(key, dependencies);
 }