private void OnDragDropped(object sender, DragEventArgs e) { 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 FloatCollectionSidebarEditor) { FloatCollectionSidebarEditor editorparent = (FloatCollectionSidebarEditor)Parent.Parent; if ((idx >= 0) && (idx < editorparent.SelectedCollection.Count)) { editorparent.SelectedCollection.Move(idx, _SelectedIndex); } } } } } } }
private void DoTextToFloatInput() { if (EditorUI.GetParentVD2DataIsReadOnly(this)) { if (Parent != null) { if (Parent.Parent != null) { if (Parent.Parent is FloatCollectionSidebarEditor) { FloatCollectionSidebarEditor editorparent = (FloatCollectionSidebarEditor)Parent.Parent; if (_SelectedIndex < editorparent.SelectedCollection.Count) { FloatEditor.Text = editorparent.SelectedCollection[_SelectedIndex].ToString(); } } } } return; } if (Parent != null) { if (Parent.Parent != null) { if (Parent.Parent is FloatCollectionSidebarEditor) { FloatCollectionSidebarEditor editorparent = (FloatCollectionSidebarEditor)Parent.Parent; float parseresult; if (float.TryParse(FloatEditor.Text, out parseresult)) { if (_SelectedIndex < editorparent.SelectedCollection.Count) { if (editorparent.SelectedCollection[_SelectedIndex] != parseresult) { editorparent.SelectedCollection.CollectionChanged -= SelectedCollection_CollectionChanged; editorparent.SelectedCollection[_SelectedIndex] = parseresult; editorparent.SelectedCollection.CollectionChanged += SelectedCollection_CollectionChanged; } } } else { if (_SelectedIndex < editorparent.SelectedCollection.Count) { FloatEditor.Text = editorparent.SelectedCollection[_SelectedIndex].ToString(); } } } } } }
private void FloatCollectionSidebarEditorItem_Load(object sender, EventArgs e) { if (Parent != null) { if (Parent.Parent != null) { if (Parent.Parent is FloatCollectionSidebarEditor) { FloatCollectionSidebarEditor editorparent = (FloatCollectionSidebarEditor)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 FloatCollectionSidebarEditor) { FloatCollectionSidebarEditor editorparent = (FloatCollectionSidebarEditor)Parent.Parent; if (_SelectedIndex < editorparent.SelectedCollection.Count) { FloatEditor.Text = editorparent.SelectedCollection[_SelectedIndex].ToString(); } } } } }
private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) { if (EditorUI.GetParentVD2DataIsReadOnly(this)) { return; } if (Parent != null) { if (Parent.Parent != null) { if (Parent.Parent is FloatCollectionSidebarEditor) { FloatCollectionSidebarEditor editorparent = (FloatCollectionSidebarEditor)Parent.Parent; if ((_SelectedIndex >= 0) && (_SelectedIndex < editorparent.SelectedCollection.Count)) { editorparent.SelectedCollection.Add(editorparent.SelectedCollection[_SelectedIndex]); } } } } }