/// <summary> /// Event when mouse is moved on DataGridView. /// </summary> /// <param name="sender">DataGridView</param> /// <param name="e">MouseEventArgs</param> private void MouseMoveOnDataGridView(object sender, MouseEventArgs e) { DataGridView v = sender as DataGridView; DataGridView.HitTestInfo hti = v.HitTest(e.X, e.Y); if (hti.RowIndex <= 0) return; if (e.Button != MouseButtons.Left) return; string name = v[0, hti.RowIndex].Value as string; if (string.IsNullOrEmpty(name)) return; // Get EcellData. EcellData data = m_current.GetEcellData(name); if (data == null) return; if (!data.Logable && !data.Settable) return; if (!data.Value.IsDouble) return; // Create new EcellDragObject. EcellDragObject dobj = new EcellDragObject(m_current.ModelID); // Add Entry. dobj.Entries.Add(new EcellDragEntry( m_current.Key, m_current.Type, data.EntityPath, data.Settable, data.Logable)); // Drag & Drop Event. v.DoDragDrop(dobj, DragDropEffects.Move | DragDropEffects.Copy); }
public void TearDown() { _dragObject = null; }
public void TestEcellDragObjectConstructor() { EcellDragObject dragObj = new EcellDragObject(); Assert.IsNotNull(dragObj, "Constructor of type, EcellDragObject failed to create instance."); Assert.AreEqual("", dragObj.ModelID, "Key is unexpected value."); Assert.AreEqual(false, dragObj.IsEnableChange, "IsEnableChange is unexpected value."); dragObj.IsEnableChange = true; Assert.AreEqual(true, dragObj.IsEnableChange, "IsEnableChange is unexpected value."); Assert.IsEmpty(dragObj.LogList, "LogList is unexpected value."); Assert.IsEmpty(dragObj.Entries, "Entries is unexpected value."); dragObj = new EcellDragObject("Model"); Assert.IsNotNull(dragObj, "Constructor of type, EcellDragObject failed to create instance."); Assert.AreEqual("Model", dragObj.ModelID, "Key is unexpected value."); Assert.IsEmpty(dragObj.LogList, "LogList is unexpected value."); Assert.IsEmpty(dragObj.Entries, "Entries is unexpected value."); dragObj.Entries.Add(new EcellDragEntry("/:V0", "Variable", "Variable:/:V0:MolerConc", true, true)); dragObj.Entries.Add(new EcellDragEntry("/:P0", "Process", "Process:/:V0:MolerActivity", true, true)); Assert.IsNotEmpty(dragObj.Entries, "Entries is unexpected value."); List<string> logs = new List<string>(); logs.Add("test"); logs.Add("sample"); dragObj.LogList = logs; Assert.IsNotEmpty(dragObj.LogList, "LogList is unexpected value."); }
public void SetUp() { _dragObject = new EcellDragObject(); }
/// <summary> /// Enter the drag mode. /// </summary> private void EnterDragMode() { EcellDragObject dobj = null; if (objectListDataGrid.SelectedRows.Count <= 0) return; foreach (DataGridViewRow r in objectListDataGrid.SelectedRows) { EcellObject obj = r.Tag as EcellObject; if (obj == null) continue; // Create new EcellDragObject. if (dobj == null) dobj = new EcellDragObject(obj.ModelID); foreach (EcellData v in obj.Value) { if (!v.Name.Equals(Constants.xpathActivity) && !v.Name.Equals(Constants.xpathMolarConc) && !v.Name.Equals(Constants.xpathSize)) continue; // Add new EcellDragEntry. dobj.Entries.Add(new EcellDragEntry( obj.Key, obj.Type, v.EntityPath, v.Settable, v.Logable)); break; } if (objectListDataGrid.SelectedRows.Count > 1) { m_isSelected = true; m_owner.PluginManager.SelectChanged(obj); m_isSelected = false; } } // Drag & Drop Event. if (dobj != null) this.DoDragDrop(dobj, DragDropEffects.Move | DragDropEffects.Copy); }