Esempio n. 1
0
        /// <summary>Edits the value.</summary>
        /// <param name="hyperlink">The hyperlink.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="parts">The parts.</param>
        private void EditValue([NotNull] Hyperlink hyperlink, [NotNull] Dictionary <string, string> parameters, [NotNull] string[] parts)
        {
            Debug.ArgumentNotNull(hyperlink, "hyperlink");
            Debug.ArgumentNotNull(parameters, "parameters");
            Debug.ArgumentNotNull(parts, "parts");

            string value;

            if (!parameters.TryGetValue(parts[0], out value))
            {
                value = string.Empty;
            }

            var editorName = parts[1];

            var editor = RuleManager.GetParameterEditor(editorName);

            value = editor.GetValue(value, this.Parameter);

            hyperlink.Inlines.Clear();

            if (string.IsNullOrEmpty(value))
            {
                parameters.Remove(parts[0]);
                hyperlink.Inlines.Add(new Run(parts[3]));
            }
            else
            {
                parameters[parts[0]] = value;
                hyperlink.Inlines.Add(new Run(value));
            }
        }