public virtual void UpdateContents()
 {
     foreach (Control c in InnerPanel.Controls)
     {
         if (c is DataStructureSidebarItemView)
         {
             DataStructureSidebarItemView dsitemview = (DataStructureSidebarItemView)c;
             if (Parent != null)
             {
                 if (Parent.Parent != null)
                 {
                     if (Parent.Parent is ObjectIDRefCollectionSidebarEditor)
                     {
                         ObjectIDRefCollectionSidebarEditor editorparent = (ObjectIDRefCollectionSidebarEditor)Parent.Parent;
                         if ((_SelectedIndex >= 0) && (_SelectedIndex < editorparent.SelectedCollection.Count))
                         {
                             //editorparent.SelectedCollection.Move(idx, _SelectedIndex);
                         }
                     }
                     else if (Parent.Parent is DataStructureCollectionsEditor)
                     {
                         DataStructureCollectionsEditor editorparent = (DataStructureCollectionsEditor)Parent.Parent;
                         if ((_SelectedIndex >= 0) && (_SelectedIndex < editorparent.SelectedCollection.Count))
                         {
                             dsitemview.Item = editorparent.SelectedCollection[_SelectedIndex];
                         }
                     }
                 }
             }
         }
     }
 }
Example #2
0
 private void SelectedCollection_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if ((flowLayoutPanel1.Controls.Count - 1) > _SelectedCollection.Count)
     {
         for (int i = flowLayoutPanel1.Controls.Count - 1; i > _SelectedCollection.Count; i--)
         {
             flowLayoutPanel1.Controls.RemoveAt(i);
         }
     }
     else if ((flowLayoutPanel1.Controls.Count - 1) < _SelectedCollection.Count)
     {
         for (int i = flowLayoutPanel1.Controls.Count - 1; i < _SelectedCollection.Count; i++)
         {
             SidebarCollectionsEditorItem editoritem = new SidebarCollectionsEditorItem();
             DataStructureSidebarItemView dsitemview = new DataStructureSidebarItemView();
             dsitemview.Item = _SelectedCollection[i];
             dsitemview.Dock = DockStyle.Fill;
             editoritem.InnerPanel.Controls.Add(dsitemview);
             flowLayoutPanel1.Controls.Add(editoritem);
             editoritem.SelectedIndex = i;
             editoritem.Size          = new Size((int)((flowLayoutPanel1.Size.Width - flowLayoutPanel1.Margin.Size.Width) * 0.95f), editoritem.Size.Height);
         }
     }
     foreach (Control c in flowLayoutPanel1.Controls)
     {
         if (c is SidebarCollectionsEditorItem)
         {
             SidebarCollectionsEditorItem editoritem = (SidebarCollectionsEditorItem)c;
             editoritem.UpdateContents();
         }
     }
 }
 private void SidebarCollectionsEditorItem_DragDrop(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 (_SelectedIndex != idx)
             {
                 if (Parent != null)
                 {
                     if (Parent.Parent != null)
                     {
                         if (Parent.Parent is ObjectIDRefCollectionSidebarEditor)
                         {
                             ObjectIDRefCollectionSidebarEditor editorparent = (ObjectIDRefCollectionSidebarEditor)Parent.Parent;
                             if ((idx >= 0) && (idx < editorparent.SelectedCollection.Count))
                             {
                                 editorparent.SelectedCollection.Move(idx, _SelectedIndex);
                             }
                         }
                         else if (Parent.Parent is DataStructureCollectionsEditor)
                         {
                             DataStructureCollectionsEditor editorparent = (DataStructureCollectionsEditor)Parent.Parent;
                             if ((idx >= 0) && (idx < editorparent.SelectedCollection.Count))
                             {
                                 editorparent.SelectedCollection.Move(idx, _SelectedIndex);
                             }
                         }
                     }
                 }
             }
             else
             {
                 foreach (Control c in InnerPanel.Controls)
                 {
                     if (c is DataStructureSidebarItemView)
                     {
                         DataStructureSidebarItemView dsitemview = (DataStructureSidebarItemView)c;
                         dsitemview.ToggleCollectionsItemModeCollapse();
                     }
                 }
             }
         }
     }
 }
 private void SidebarCollectionsEditorItem_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         if (EditorUI.GetParentVD2DataIsReadOnly(this))
         {
             foreach (Control c in InnerPanel.Controls)
             {
                 if (c is DataStructureSidebarItemView)
                 {
                     DataStructureSidebarItemView dsitemview = (DataStructureSidebarItemView)c;
                     dsitemview.ToggleCollectionsItemModeCollapse();
                 }
             }
             return;
         }
         DoDragDrop(_SelectedIndex, DragDropEffects.Move);
     }
 }