コード例 #1
0
        /// <summary>
        /// Raises event for the selected field to be added.
        /// </summary>
        private void OnFieldSelectedForAdd()
        {
            ListViewItem        lvi   = (ListViewItem)this.listViewFields.SelectedItems[0];
            ITfsFieldDefinition field = (ITfsFieldDefinition)lvi.Tag;

            // TODO: How to check that this is really the document that is the destination and not something else.
            if (this.AddField != null)
            {
                this.AddField(this, new FieldDefinitionEventArgs(field));
            }
        }
コード例 #2
0
        /// <summary>
        /// Adds a field to the document.
        /// </summary>
        /// <param name="field">The field to be added.</param>
        public void AddField(ITfsFieldDefinition field)
        {
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            WdContentControlType controlType = WdContentControlType.wdContentControlText;

            if (field.FieldType == FieldType.Html || field.FieldType == FieldType.History)
            {
                controlType = WdContentControlType.wdContentControlRichText;
            }
            else if (field.FieldType == FieldType.DateTime)
            {
                controlType = WdContentControlType.wdContentControlDate;
            }

            this.wordDocument.AddContentControl(field.FriendlyName, field.ReferenceName, (int)controlType);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldDefinitionEventArgs"/> class.
 /// </summary>
 /// <param name="fieldDefinition">The field definition associated with the event.</param>
 public FieldDefinitionEventArgs(ITfsFieldDefinition fieldDefinition)
 {
     this.FieldDefinition = fieldDefinition;
 }