private void LoadTrajectory(Trajectory trac) { ListViewEx1.SuspendLayout(); ListViewEx1.Items.Clear(); foreach (Vector3 v in trac.Points) { var lvi = new ListViewItem(new string[] { "", v.X.ToString(), v.Y.ToString(), v.Z.ToString() }); lvi.Tag = v; ListViewEx1.Items.Add(lvi); } if (ListViewEx1.Items.Count > 0) { ListViewEx1.Items[0].Selected = true; } ListViewEx1.ResumeLayout(); }
private void MoveNode(int additor) { if (additor != 0 && SelectedTrajectory is object) { ListViewEx1.SuspendLayout(); var indicies = new int[ListViewEx1.SelectedIndices.Count]; ListViewEx1.SelectedIndices.CopyTo(indicies, 0); foreach (int index in additor < 0 ? indicies.OrderByDescending(n => n) : indicies.OrderBy(n => n)) { int newIndex = index + additor; if (newIndex >= 0 && newIndex < ListViewEx1.Items.Count) { var item = ListViewEx1.Items[index]; ListViewEx1.Items.RemoveAt(index); SelectedTrajectory.Points.RemoveAt(index); ListViewEx1.Items.Insert(newIndex, item); SelectedTrajectory.Points.Insert(newIndex, (Vector3)item.Tag); } } ListViewEx1.ResumeLayout(); } }