/// <summary> /// Перетаскивание значений /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listBox2_AfterDrop(object sender, AfterDropEventArgs e) { string s = e.Data as string; domains[listBox1.SelectedItem.ToString()].ListVal.RemoveAt(e.SIndex); domains[listBox1.SelectedItem.ToString()].ListVal.Insert(e.FIndex, s); }
/// <summary> /// После перетаскивания в окне доменов /// </summary> void listBox1_AfterDrop(object sender, AfterDropEventArgs e) { ValueDomain d = domains.Vals[e.SIndex]; domains.RemoveAt(e.SIndex); domains.Insert(e.FIndex, d.Name, d); }
/// <summary> /// Перетаскивание переменных /// </summary> private void listBox1_AfterDrop(object sender, AfterDropEventArgs e) { Variable pr = vars[e.Data as string]; vars.RemoveAt(e.SIndex); vars.Insert(e.FIndex, e.Data as string, pr); }
protected virtual void AfterDragDrop(AfterDropEventArgs e) { if (AfterDrop != null) { AfterDrop(this, e); } }
/// <summary> /// Перетаскивание правил /// </summary> private void lstRules_AfterDrop(object sender, AfterDropEventArgs e) { string s = (e.Data as string); Rule pr = rules[s.Substring(0, s.IndexOf(':'))]; rules.RemoveAt(e.SIndex); rules.Insert(e.FIndex, pr.Name, pr); }
/// <summary> /// Отпустили кнопку - кладем элемент на место /// </summary> void DragListBox_MouseUp(object sender, MouseEventArgs e) { if (de == DragDropEffects.Move) { de = DragDropEffects.None; fIndex = this.IndexFromPoint(e.X, e.Y); if (fIndex > this.Items.Count) { fIndex = this.Items.Count; } this.Items.Insert(++fIndex, s); dt.Dispose(); // событие AfterDropEventArgs MyE = new AfterDropEventArgs(sIndex, fIndex, s); AfterDragDrop(MyE); } }
/// <summary> /// Перетаскивание посылок /// </summary> private void lstReasons_AfterDrop(object sender, AfterDropEventArgs e) { // e.Data - Fact ! rules[getSelectedRuleName()].Reasons.RemoveAt(e.SIndex); rules[getSelectedRuleName()].Reasons.Insert(e.FIndex, e.Data as Fact); }
/// <summary> /// Перетаскивание значений в домене /// </summary> private void listBox2_AfterDrop(object sender, AfterDropEventArgs e) { es.Domains[comboBox1.SelectedItem.ToString()].ListVal.RemoveAt(e.SIndex); es.Domains[comboBox1.SelectedItem.ToString()].ListVal.Insert(e.FIndex, e.Data as string); }