Exemple #1
0
        /// <summary>
        /// Adds a directive port tracking.
        /// </summary>
        /// <returns>A placeholder identifier that can be used in the document</returns>
        public string AddDirective(string name, IDictionary values)
        {
            if ((0 == String.Compare(name, "Page", true, CultureInfo.InvariantCulture) && directives["Page"] != null) ||
                (0 == String.Compare(name, "Control", true, CultureInfo.InvariantCulture) && directives["Control"] != null))
            {
                throw new Exception("Only one Page or Control directive is allowed in a document");
            }

            DocumentDirective directive = new DocumentDirective(name, values, directivePlaceholderKey);

            directivePlaceholderKey++;

            if (directives[name] == null)
            {
                directives[name] = new ArrayList();
            }

            ((ArrayList)directives[name]).Add(directive);

            return(String.Format(DirectivePlaceholderStructure, directive.Key.ToString()));
        }
Exemple #2
0
        public string RemoveDirective(int placeholderId)
        {
            DocumentDirective directive = null;

            foreach (DictionaryEntry de in directives)
            {
                if (de.Value is DocumentDirective)
                {
                    if (((DocumentDirective)de.Value).Key == placeholderId)
                    {
                        directive = (DocumentDirective)de.Value;
                        directives.Remove(de.Key);
                    }
                }
                else
                {
                    foreach (DocumentDirective d in (ArrayList)de.Value)
                    {
                        if (d.Key == placeholderId)
                        {
                            directive = d;
                            ((ArrayList)de.Value).Remove(d);
                            break;
                        }
                    }
                }
                if (directive != null)
                {
                    break;
                }
            }

            if (directive == null)
            {
                return(string.Empty);
            }
            return(directive.ToString());
        }
Exemple #3
0
		/// <summary>
		/// Adds a directive port tracking.
		/// </summary>
		/// <returns>A placeholder identifier that can be used in the document</returns>
		public string AddDirective (string name, IDictionary values)
		{
			if ((0 == String.Compare (name, "Page", true, CultureInfo.InvariantCulture) && directives["Page"] != null)
				|| (0 == String.Compare (name, "Control", true, CultureInfo.InvariantCulture) && directives["Control"] != null))
				throw new Exception ("Only one Page or Control directive is allowed in a document");

			DocumentDirective directive = new DocumentDirective (name, values, directivePlaceHolderKey);
			directivePlaceHolderKey++;

			if (directives[name] == null)
				directives[name] = new ArrayList ();

			((ArrayList)directives[name]).Add(directive);

			// TODO: placeholder for directives
			return string.Empty;
		}