public void SetSelectedObject(object selectedObject) { if (selectedObject == m_SelectedObject) { return; } if (m_SelectedObject is LogGraphCurveItem oldCurve) { oldCurve.Color = m_SelectedObjectOriginalColor; } m_SelectedObject = selectedObject; if (m_SelectedObject is LogGraphCurveItem curve) { m_SelectedObjectOriginalColor = curve.Color; curve.Color = Color.Red; var index = CurveList.IndexOf(curve); var newIndex = CurveList.Move(index, -index); } OnCurveItemSelected?.Invoke(this, EventArgs.Empty); m_Parent.UpdateGraph(); }