private void TrajetTV_DragDrop(object sender, DragEventArgs e) { TreeNode nodeToDropIn = TrajetTV.GetNodeAt(TrajetTV.PointToClient(new Point(e.X, e.Y))); if (nodeToDropIn == null) { return; } if (nodeToDropIn.Level > 0) { nodeToDropIn = nodeToDropIn.Parent; } object data = (Sites)e.Data.GetData(typeof(Sites)); nodeToDropIn.Nodes.Add(data.ToString()); for (int i = 0; i < _unVoyage.TrajetsList.Count; i++) { if (nodeToDropIn.Text.Equals(_unVoyage.TrajetsList[i].Description)) { _unVoyage.TrajetsList[i].Childs.Add((Sites)data); break; } } TrajetTV.ExpandAll(); }
private void EndTrajetButton_Click(object sender, EventArgs e) { nouvTrajet.UnePolyline = PolyEnCours; _unVoyage.TrajetsList.Add(nouvTrajet); TrajetTV.Nodes.Add(nouvTrajet.Description); TrajetTV.ExpandAll(); CreateRoute(PolyEnCours); nouvTrajet = new Trajets(); PolyEnCours = new Polyline(); EndTrajetButton.Click -= EndTrajetButton_Click; CreateTrajet = 0; EndTrajetButton.Enabled = false; }