void fragmentAdornerView1_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { Point MousePoint = e.GetPosition(m_View1FragmentAdorner.AdornedElement); MousePoint.X = (int)MousePoint.X; MousePoint.Y = (int)MousePoint.Y; if (m_CurrentMarkMode == FragmentAdorner.FragmentMarkMode.RegisterViews) { m_XPosRefOffset = MousePoint.X - m_View0MarkPoint.X; m_View1FragmentAdorner.UpdateMarksOffsetPosX(m_XPosRefOffset); } //mark fragment point on view1 where mouse is clicked as a center point m_View1FragmentAdorner.DrawMark(MousePoint); if (m_CurrentMarkMode == FragmentAdorner.FragmentMarkMode.Mark) { //erase vertical line on view0 and view1 m_View0FragmentAdorner.EraseVerticalLine(); m_View1FragmentAdorner.EraseVerticalLine(); } //unsubscribe left mouse click event on view1 m_View1FragmentAdorner.AdornedElement.MouseLeftButtonDown -= new System.Windows.Input.MouseButtonEventHandler(fragmentAdornerView1_MouseLeftButtonDown); //subscribe to left mouse click event on view0 m_View0FragmentAdorner.AdornedElement.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(fragmentAdornerView0_MouseLeftButtonDown); if (m_CurrentMarkMode == FragmentAdorner.FragmentMarkMode.Mark) { //update Fragment Display table FrameworkElement adornedElement = (FrameworkElement)m_View1FragmentAdorner.AdornedElement; m_FragmentDataDisplay.AddData2Table2M(MousePoint, adornedElement.ActualHeight, m_MarkPtXPosRadians); } m_FragmentObjectMarkComplete = true; //invalidate visual for adorner layer to display marks m_View1FragmentAdorner.InvalidateVisual(); m_View0FragmentAdorner.InvalidateVisual(); }
void fragmentAdornerView0_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { Point MousePoint = e.GetPosition(m_View0FragmentAdorner.AdornedElement); MousePoint.X = (int)MousePoint.X; MousePoint.Y = (int)MousePoint.Y; m_View0MarkPoint = MousePoint; m_View0FragmentAdorner.RemoveRightClickMenu(); if (m_CurrentMarkMode == FragmentAdorner.FragmentMarkMode.RegisterViews) { m_View1FragmentAdorner.EraseRegisterViewMarks(); m_View0FragmentAdorner.EraseRegisterViewMarks(); } //mark fragment point on view0 where mouse is clicked as a center point m_View0FragmentAdorner.DrawMark(MousePoint); if (m_CurrentMarkMode == FragmentAdorner.FragmentMarkMode.Mark) { //draw verticle line going across the image on both view0 and view1 X position of where mouse was clicked m_View0FragmentAdorner.DrawVerticalLine(MousePoint, 0); m_View1FragmentAdorner.DrawVerticalLine(MousePoint, m_XPosRefOffset); } if (m_CurrentMarkMode != FragmentAdorner.FragmentMarkMode.Uniformity) { //unsubscribe left mouse click event on view0 m_View0FragmentAdorner.AdornedElement.MouseLeftButtonDown -= new System.Windows.Input.MouseButtonEventHandler(fragmentAdornerView0_MouseLeftButtonDown); //subscribe to left mouse click event on view1 m_View1FragmentAdorner.AdornedElement.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(fragmentAdornerView1_MouseLeftButtonDown); m_FragmentObjectMarkComplete = false; } else { m_FragmentObjectMarkComplete = true; } if (m_CurrentMarkMode == FragmentAdorner.FragmentMarkMode.Mark) { //update Fragment Display table FrameworkElement adornedElement = (FrameworkElement)m_View0FragmentAdorner.AdornedElement; m_MarkPtXPosRadians = m_FragmentDataDisplay.AddData2Table1M(MousePoint, adornedElement.ActualHeight); } if (m_CurrentMarkMode == FragmentAdorner.FragmentMarkMode.Uniformity && m_View0FragmentAdorner.UniformityMarkPointList.Count > 1) { m_FragmentDataDisplay.UpdateUniformityInfo(m_View0FragmentAdorner.UniformityMarkPointList[0].CenterPoint, m_View0FragmentAdorner.UniformityMarkPointList[1].CenterPoint, m_View0HighEnergySource); } //invalidate visual for adorner layer to display marks m_View1FragmentAdorner.InvalidateVisual(); m_View0FragmentAdorner.InvalidateVisual(); }