ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • UserControl_MouseMove function example
    IT Story/C# & WPF 2022. 6. 23. 20:56
    반응형
    private void UserControl_MouseMove(object sender, MouseEventArgs e)
            {
                try
                {
                    Point mp = e.GetPosition(this);
    
                    Rect bearingRect = new Rect(174 + 83, 8 + 17, 1350, 183 - 17);
                    Rect prsBDTRect = new Rect(174 + 82, 8 + 183 + 212 + 273 + 33, 862, 256);
                    Rect prsRAWRect = new Rect(174 + 81 + 864 + 32, 8 + 183 + 212 + 273 + 33, 455, 256);
                    Rect aosSystemTarget = new Rect(174 + 83, 8 + 183 + 17, 1350, 22);
    
                    Rect aosURect = new Rect(174 + 83, 8 + 183 + 56 + 17, 1350, 320);
                    Rect aosDRect = new Rect(174 + 83, 8 + 183 + 56 + 367 + 17, 1350, 320);
    
                    Rect attChIndicateRect = new Rect(174 + 83, 8 + 183 + 16, 1350, 178);
    
                    if (_bearing != null)
                        _bearing.SetMousePoint(mp, bearingRect.Left, bearingRect.Top,
                            UtilsManager.IsMasterPos(_bearing, mp, bearingRect),
                            UtilsManager.IsMasterPos(_bearing, mp, bearingRect) || UtilsManager.IsMasterPos(MainWaterfall, mp, MainWaterfall.Tag) ||
                            UtilsManager.IsMasterPos(CompareWaterfall, mp, CompareWaterfall.Tag) || UtilsManager.IsMasterPos(CompareWaterfall2, mp, CompareWaterfall2.Tag) || 
                            UtilsManager.IsMasterPos(_attChannelIndicationLine, mp, attChIndicateRect) || UtilsManager.IsMasterPos(_aOSSystemTarget, mp, aosSystemTarget));
    
                    if (_attChannelIndicationLine != null)
                        _attChannelIndicationLine.SetMousePoint(mp, attChIndicateRect.Left, attChIndicateRect.Top,
                            UtilsManager.IsMasterPos(_attChannelIndicationLine, mp, attChIndicateRect),
                            UtilsManager.IsMasterPos(_attChannelIndicationLine, mp, attChIndicateRect) || UtilsManager.IsMasterPos(_bearing, mp, bearingRect) ||
                            UtilsManager.IsMasterPos(MainWaterfall, mp, MainWaterfall.Tag) || UtilsManager.IsMasterPos(CompareWaterfall, mp, CompareWaterfall.Tag) || UtilsManager.IsMasterPos(CompareWaterfall2, mp, CompareWaterfall2.Tag));
    
                    if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(13))                 {                     MainWaterfall.SetMousePoint(mp, waterfallRect.Value.Left + 2, waterfallRect.Value.Top + 1,
                            UtilsManager.IsMasterPos(MainWaterfall, mp, MainWaterfall.Tag),
                            UtilsManager.IsMasterPos(MainWaterfall, mp, MainWaterfall.Tag) || UtilsManager.IsMasterPos(_attChannelIndicationLine, mp, attChIndicateRect) || UtilsManager.IsMasterPos(_bearing, mp, bearingRect));
                    }
                    else
                    {                     CompareWaterfall.SetMousePoint(mp, waterfallURect.Value.Left + 2, waterfallURect.Value.Top + 1,
                            UtilsManager.IsMasterPos(CompareWaterfall, mp, CompareWaterfall.Tag),
                            UtilsManager.IsMasterPos(CompareWaterfall, mp, CompareWaterfall.Tag) || UtilsManager.IsMasterPos(CompareWaterfall2, mp, CompareWaterfall2.Tag) ||
                            UtilsManager.IsMasterPos(_attChannelIndicationLine, mp, attChIndicateRect) || UtilsManager.IsMasterPos(_bearing, mp, bearingRect));
    
                        CompareWaterfall2.SetMousePoint(mp, waterfallDRect.Value.Left + 2, waterfallDRect.Value.Top + 1,
                            UtilsManager.IsMasterPos(CompareWaterfall2, mp, CompareWaterfall2.Tag),
                            UtilsManager.IsMasterPos(CompareWaterfall, mp, CompareWaterfall.Tag) || UtilsManager.IsMasterPos(CompareWaterfall2, mp, CompareWaterfall2.Tag) ||
                            UtilsManager.IsMasterPos(_attChannelIndicationLine, mp, attChIndicateRect) || UtilsManager.IsMasterPos(_bearing, mp, bearingRect));
                    }
    
                                                                    
                                                                    
                                                                    
                                    if (DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(10) && DataManagerUnit1.BDTSystemInfo.unSensorIndex[1].Equals(11))
                    {
                        if (_pRSBDT != null)
                            _pRSBDT.SetMousePoint(mp, prsBDTRect.Left, prsBDTRect.Top,
                                UtilsManager.IsMasterPos(_pRSBDT, mp, prsBDTRect),
                                UtilsManager.IsMasterPos(_pRSBDT, mp, prsBDTRect) || UtilsManager.IsMasterPos(prsRAWSVD, mp, prsRAWRect) ||
                                UtilsManager.IsMasterPos(prsRAWRLD, mp, prsRAWRect) || UtilsManager.IsMasterPos(prsRAWCSD, mp, prsRAWRect) ||
                                UtilsManager.IsMasterPos(prsRAWSND, mp, prsRAWRect));
    
                        if (prsRAWRLD != null && prsRAWRLD.Visibility.Equals(Visibility.Visible))                         prsRAWRLD.SetMousePoint(mp, prsRAWRect.Left, prsRAWRect.Top,
                                UtilsManager.IsMasterPos(prsRAWRLD, mp, prsRAWRect),
                                UtilsManager.IsMasterPos(prsRAWRLD, mp, prsRAWRect) || UtilsManager.IsMasterPos(_pRSBDT, mp, prsBDTRect));
    
                        if (prsRAWCSD != null && prsRAWCSD.Visibility.Equals(Visibility.Visible))                         prsRAWCSD.SetMousePoint(mp, prsRAWRect.Left, prsRAWRect.Top,
                                UtilsManager.IsMasterPos(prsRAWCSD, mp, prsRAWRect),
                                UtilsManager.IsMasterPos(prsRAWCSD, mp, prsRAWRect) || UtilsManager.IsMasterPos(_pRSBDT, mp, prsBDTRect));
    
                        if (prsRAWSND != null && prsRAWSND.Visibility.Equals(Visibility.Visible))                         prsRAWSND.SetMousePoint(mp, prsRAWRect.Left, prsRAWRect.Top,
                                UtilsManager.IsMasterPos(prsRAWSND, mp, prsRAWRect),
                                UtilsManager.IsMasterPos(prsRAWSND, mp, prsRAWRect) || UtilsManager.IsMasterPos(_pRSBDT, mp, prsBDTRect));
    
                        if (prsRAWSVD != null && prsRAWSVD.Visibility.Equals(Visibility.Visible))                        prsRAWSVD.SetMousePoint(mp, prsRAWRect.Left, prsRAWRect.Top,
                                UtilsManager.IsMasterPos(prsRAWSVD, mp, prsRAWRect),
                                UtilsManager.IsMasterPos(prsRAWSVD, mp, prsRAWRect) || UtilsManager.IsMasterPos(_pRSBDT, mp, prsBDTRect));
                    }
                                    else if(DataManagerUnit1.BDTSystemInfo.unSensorIndex[0].Equals(12))
                    {
                        if (_aOSSystemTarget != null)
                            _aOSSystemTarget.SetMousePoint(mp, aosSystemTarget.Left, aosSystemTarget.Top,
                                UtilsManager.IsMasterPos(_aOSSystemTarget, mp, aosSystemTarget),
                                UtilsManager.IsMasterPos(_aOSSystemTarget, mp, aosSystemTarget) || UtilsManager.IsMasterPos(_bearing, mp, bearingRect));
    
                        if (_aOSGraphU != null)
                            _aOSGraphU.SetMousePoint(mp, aosURect.Left, aosURect.Top,
                                UtilsManager.IsMasterPos(_aOSGraphU, mp, aosURect),
                                UtilsManager.IsMasterPos(_aOSGraphU, mp, aosURect) || UtilsManager.IsMasterPos(_aOSGraphD, mp, aosDRect) || UtilsManager.IsMasterPos(_bearing, mp, bearingRect));
    
                        if (_aOSGraphD != null)
                            _aOSGraphD.SetMousePoint(mp, aosDRect.Left, aosDRect.Top,
                                UtilsManager.IsMasterPos(_aOSGraphD, mp, aosDRect),
                                UtilsManager.IsMasterPos(_aOSGraphD, mp, aosDRect) || UtilsManager.IsMasterPos(_aOSGraphU, mp, aosURect) || UtilsManager.IsMasterPos(_bearing, mp, bearingRect));
                    }
    
                    if (DataManagerUnit1.SystemInfo.audioFilterInfo.unAudioBearingControl.Equals(1))
                    {
                        if (Bearing.Visibility.Equals(Visibility.Visible) && UtilsManager.IsMasterPos(_bearing, mp, bearingRect))
                        {
                            double dBearing = Bearing.GetChkAngleByPos(mp.X - bearingRect.Left);
                            if (_completed)
                            {
                                _completed = false;
                                audioCursorDelegate.BeginInvoke(dBearing, EndAudioCursorDel, audioCursorDelegate);
                            }
                        }
                        else if (ATTChannelIndicationLine.Visibility.Equals(Visibility.Visible) && UtilsManager.IsMasterPos(ATTChannelIndicationLine, mp, attChIndicateRect))
                        {
                            double dBearing = ATTChannelIndicationLine.GetChkAngleByPos(mp.X - attChIndicateRect.Left);
                            if (_completed)
                            {
                                _completed = false;
                                audioCursorDelegate.BeginInvoke(dBearing, EndAudioCursorDel, audioCursorDelegate);
                            }
                        }
                        else if (gridLayout1.Visibility.Equals(Visibility.Visible) && UtilsManager.IsMasterPos(MainWaterfall, mp, MainWaterfall.Tag as Rect?))
                        {                         double dBearing = MainWaterfall.GetBearingByMousePointPos(mp.X - (MainWaterfall.Tag as Rect?).Value.Left + 2);
                            if (_completed)
                            {
                                _completed = false;
                                audioCursorDelegate.BeginInvoke(dBearing, EndAudioCursorDel, audioCursorDelegate);
                            }
                        }
                        else if (gridLayout2.Visibility.Equals(Visibility.Visible))
                        {                         if (UtilsManager.IsMasterPos(CompareWaterfall, mp, CompareWaterfall.Tag as Rect?))
                            {
                                double dBearing = CompareWaterfall.GetBearingByMousePointPos(mp.X - (CompareWaterfall.Tag as Rect?).Value.Left + 2);
                                if (_completed)
                                {
                                    _completed = false;
                                    audioCursorDelegate.BeginInvoke(dBearing, EndAudioCursorDel, audioCursorDelegate);
                                }
                            }
                            else if (UtilsManager.IsMasterPos(CompareWaterfall2, mp, CompareWaterfall2.Tag as Rect?))
                            {
                                double dBearing = CompareWaterfall2.GetBearingByMousePointPos(mp.X - (CompareWaterfall2.Tag as Rect?).Value.Left + 2);
                                if (_completed)
                                {
                                    _completed = false;
                                    audioCursorDelegate.BeginInvoke(dBearing, EndAudioCursorDel, audioCursorDelegate);
                                }
                            }
                        }
                    }
                }
                catch (Exception ee)
                {
                    TraceManager.AddLog(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                }
            }
    반응형

    댓글

Designed by Tistory.