private void DD_LinkTextEditing(object sender, LinkValidationEventArgs e) { string newT; //новое имя вершины выбранное из комбобоксика SendMessage("изменение типа дуги: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); ComboBoxForm formLink = new ComboBoxForm(); var listarc = myWeb.GetAllowedArcNames(((Node)e.Link.Origin.Tag).ID); formLink.RefreshValue(listarc); formLink.ShowDialog(); try { if (formLink.DialogResult == true) { newT = formLink.ReturnValue().ToString(); //myWeb.ChangeArcName(e.Link.Text, newT, e.Link.Origin.Text); myWeb.ChangeArcName(((Node)e.Link.Origin.Tag).ID, e.Link.Text, newT, ((Node)e.Destination.Tag).ID); e.Link.Text = newT; SendMessage("изменение дуги завершилось: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); } else { SendMessage("отмена изменения типа дуги: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); e.Cancel = true; } } catch (ArgumentException e1) { SendMessage("отмена изменения типа дуги с ошибкой: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); MessageBox.Show(e1.Message); e.Cancel = true; } formLink.Close(); e.Cancel = true; }
private void DD_LinkCreated(object sender, LinkEventArgs e) { try { ComboBoxForm formLink = new ComboBoxForm(); formLink.RefreshValue(SemanticWeb.SystemArcs); formLink.ShowDialog(); SendMessage("создание дуги " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); if (formLink.DialogResult == true) { //throw new ArgumentException(); e.Link.Text = formLink.ReturnValue().ToString(); myWeb.AddArc(e.Link.Origin.Text, e.Link.Text, e.Link.Destination.Text); SendMessage("создание дуги завершилось: " + e.Link.Text + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); } else { //throw new ArgumentException("отмена выбора имени дуги"); DD.Links.Remove(e.Link); SendMessage("создание дуги отменено: " + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); } } catch (ArgumentException e1) { MessageBox.Show(e1.Message); /*произошла ошибка вставки, удаляем дугу из графа*/ DD.Links.Remove(e.Link); SendMessage("создание дуги отменено: " + " от " + e.Link.Origin.Text + " к " + e.Link.Destination.Text); } }
public ComboBox(Control parent, Vector2 location, Vector2 size) { Parent = parent; Size = size; LocalLocation = location; Clicked += (s, e) => { var form = new ComboBoxForm(); form.Text = "Achivements"; form.comboBox.Items.AddRange(Items); form.comboBox.DisplayMember = DisplayMember; form.comboBox.SelectedIndex = SelectedIndex; var res = form.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { Text = ((Achivement)form.comboBox.SelectedItem).Name; SelectedIndex = form.comboBox.SelectedIndex; SelectedIndexChanged(this, form.comboBox.SelectedIndex); } }; }