예제 #1
0
 protected virtual bool ValidateToolboxDataItemName(ToolboxDataItem item, string name)
 {
     return ((name != null) && (name.Length > 0));
 }
예제 #2
0
 public bool RenameToolboxDataItem(ToolboxDataItem item, string newName)
 {
     if (item.CanSetDisplayName && this.ValidateToolboxDataItemName(item, newName))
     {
         item.SetDisplayName(newName);
         return true;
     }
     return false;
 }
예제 #3
0
 internal void AddToolboxDataItem(ToolboxDataItem item, bool fireItemsChanged)
 {
     this._items.Add(item);
     if (fireItemsChanged)
     {
         this.OnItemsChanged(EventArgs.Empty);
     }
 }
예제 #4
0
 public void AddToolboxDataItem(ToolboxDataItem item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     this.AddToolboxDataItem(item, true);
 }
예제 #5
0
 public void RemoveToolboxDataItem(ToolboxDataItem item)
 {
     int index = this._items.IndexOf(item);
     if (index >= 0)
     {
         this._items.RemoveAt(index);
         this.OnItemsChanged(EventArgs.Empty);
     }
 }
예제 #6
0
 void IToolboxClient.OnToolboxDataItemPicked(ToolboxDataItem dataItem)
 {
     this.OnToolboxDataItemPicked(dataItem);
 }
예제 #7
0
 public virtual void OnToolboxDataItemPicked(ToolboxDataItem dataItem)
 {
     IDesignerHost service = (IDesignerHost) this.ServiceProvider.GetService(typeof(IDesignerHost));
     IDataObject dataObject = dataItem.GetDataObject(service);
     string html = string.Empty;
     if (dataObject != null)
     {
         if (dataObject.GetDataPresent(DataFormats.Html))
         {
             html = dataObject.GetData(DataFormats.Html).ToString();
         }
         else if (dataObject.GetDataPresent(DataFormats.Text))
         {
             html = dataObject.GetData(DataFormats.Text).ToString();
         }
         else if (this.DataObjectConverter.CanConvertToHtml(dataObject) == DataObjectConverterInfo.CanConvert)
         {
             DataObject newDataObject = new DataObject();
             if (this.DataObjectConverter.ConvertToHtml(dataObject, newDataObject))
             {
                 html = (string) newDataObject.GetData(DataFormats.Html);
             }
         }
         BatchedUndoUnit unit = this._editor.OpenBatchUndo("Toolbox");
         try
         {
             this._editor.Document.InsertHtml(html);
         }
         finally
         {
             unit.Close();
         }
     }
 }
예제 #8
0
 public virtual void OnToolboxDataItemPicked(ToolboxDataItem dataItem)
 {
     IDesignerHost service = (IDesignerHost) this.ServiceProvider.GetService(typeof(IDesignerHost));
     IDataObject dataObject = dataItem.GetDataObject(service);
     if (dataObject != null)
     {
         base.Paste(dataObject);
     }
 }
예제 #9
0
 public override void OnToolboxDataItemPicked(ToolboxDataItem dataItem)
 {
     if (this.InTemplateMode)
     {
         ((IToolboxClient) this._templateEditingDialog.DesignView).OnToolboxDataItemPicked(dataItem);
     }
     else
     {
         base.OnToolboxDataItemPicked(dataItem);
     }
 }
예제 #10
0
 void IToolboxClient.OnToolboxDataItemPicked(ToolboxDataItem dataItem)
 {
     if (this._viewToolboxClient != null)
     {
         this._viewToolboxClient.OnToolboxDataItemPicked(dataItem);
     }
 }
예제 #11
0
 public ToolboxDataGroupViewItem(ToolboxDataItem item, ToolboxToolWindow owner)
 {
     this._item = item;
     this._owner = owner;
 }
예제 #12
0
 void IToolboxClient.OnToolboxDataItemPicked(ToolboxDataItem dataItem)
 {
     if ((this._currentView != null) && (this._currentView.viewToolboxClient != null))
     {
         this._currentView.viewToolboxClient.OnToolboxDataItemPicked(dataItem);
     }
 }