void dgvWhatever_MouseDoubleClick(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: if (this.SelectedModel == null) { return; } var mv = new ModellView(this.SelectedModel); mv.ShowDialog(this); break; case MouseButtons.Middle: if (this.SelectedModel == null || this.SelectedModel.CanDelete) { return; } var list = RepoManager.KundenmaschinenRepository.GetKundenmaschinenList(this.SelectedModel); var titel = $"Kundenmaschinen des Maschinenmodells '{this.SelectedModel.Modellbezeichnung}'"; var klv = new KundenmaschinenListView(list, titel); klv.Show(this); break; case MouseButtons.XButton1: break; case MouseButtons.XButton2: break; default: break; } }
void CreateModel() { if (this.myCurrentMaschinenserie == null) { MetroMessageBox.Show(this, "Das funktioniert nur, wenn Du links in der Baumstruktur eine Maschinenserie ausgewählt hast."); return; } var newModel = ModelManager.SharedItemsService.AddMaschinenModell(); newModel.ModellSerieId = this.myCurrentMaschinenserie.UID; newModel.HerstellerId = this.myCurrentHersteller.UID; newModel.MaschinentypId = this.myCurrentMaschinenserie.MaschinentypId; var mv = new ModellView(newModel); if (mv.ShowDialog(this) == DialogResult.Cancel) { ModelManager.SharedItemsService.DeleteMaschinenModell(newModel); } else { var modelList = ModelManager.SharedItemsService.MaschinenModellList.Sort("Modellbezeichnung"); var gridList = new SortableBindingList <Maschinenmodell>(); foreach (var model in modelList) { if (model.Maschinenserie == (Maschinenserie)this.myCurrentMaschinenserie) { gridList.Add(model); } } this.dgvModelle.DataSource = gridList; } }
void ShowModelView(Maschinenmodell model) { if (model != null) { var mv = new ModellView(model); mv.Show(); } }
void OpenModel() { if (this.dgvModelle.RowCount == 0 || this.SelectedModel == null) { MetroMessageBox.Show(this, "Das funktioniert nur, wenn Du in der Liste ein Modell auswählst. Woher soll ich sonst wissen, was Du anzeigen willst?!"); return; } var mv = new ModellView(this.SelectedModel); mv.ShowDialog(this); }