private void OnDragDropped(object sender, DragEventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         return;
     }
     if (e.Data.GetDataPresent("System.Int32"))
     {
         object data = e.Data.GetData("System.Int32");
         if (data is Int32)
         {
             int idx = (int)data;
             if (Parent != null)
             {
                 if (Parent.Parent != null)
                 {
                     if (Parent.Parent is IntegerCollectionEditor)
                     {
                         IntegerCollectionEditor editorparent = (IntegerCollectionEditor)Parent.Parent;
                         if ((idx >= 0) && (idx < editorparent.SelectedCollection.Count))
                         {
                             editorparent.SelectedCollection.Move(idx, _SelectedIndex);
                         }
                     }
                 }
             }
         }
     }
 }
 private void IntegerCollectionSidebarEditorItem_Load(object sender, EventArgs e)
 {
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is IntegerCollectionEditor)
             {
                 IntegerCollectionEditor editorparent = (IntegerCollectionEditor)Parent.Parent;
                 editorparent.SelectedCollection.CollectionChanged += SelectedCollection_CollectionChanged;
             }
         }
     }
 }
 private void SelectedCollection_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is IntegerCollectionEditor)
             {
                 IntegerCollectionEditor editorparent = (IntegerCollectionEditor)Parent.Parent;
                 if (_SelectedIndex < editorparent.SelectedCollection.Count)
                 {
                     IntegerEditor.ValueChanged -= IntegerEditor_ValueChanged;
                     IntegerEditor.Value         = editorparent.SelectedCollection[_SelectedIndex];
                     IntegerEditor.ValueChanged += IntegerEditor_ValueChanged;
                 }
             }
         }
     }
 }
 private void duplicateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         return;
     }
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is IntegerCollectionEditor)
             {
                 IntegerCollectionEditor editorparent = (IntegerCollectionEditor)Parent.Parent;
                 if ((_SelectedIndex >= 0) && (_SelectedIndex < editorparent.SelectedCollection.Count))
                 {
                     editorparent.SelectedCollection.Add(editorparent.SelectedCollection[_SelectedIndex]);
                 }
             }
         }
     }
 }
 private void IntegerEditor_ValueChanged(object sender, EventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         if (Parent != null)
         {
             if (Parent.Parent != null)
             {
                 if (Parent.Parent is IntegerCollectionEditor)
                 {
                     IntegerCollectionEditor editorparent = (IntegerCollectionEditor)Parent.Parent;
                     if (_SelectedIndex < editorparent.SelectedCollection.Count)
                     {
                         IntegerEditor.ValueChanged -= IntegerEditor_ValueChanged;
                         IntegerEditor.Value         = editorparent.SelectedCollection[_SelectedIndex];
                         IntegerEditor.ValueChanged += IntegerEditor_ValueChanged;
                     }
                 }
             }
         }
         return;
     }
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is IntegerCollectionEditor)
             {
                 IntegerCollectionEditor editorparent = (IntegerCollectionEditor)Parent.Parent;
                 if (_SelectedIndex < editorparent.SelectedCollection.Count)
                 {
                     editorparent.SelectedCollection.CollectionChanged -= SelectedCollection_CollectionChanged;
                     editorparent.SelectedCollection[_SelectedIndex]    = (int)IntegerEditor.Value;
                     editorparent.SelectedCollection.CollectionChanged += SelectedCollection_CollectionChanged;
                 }
             }
         }
     }
 }