Exemple #1
0
        private void OnMouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            var pt = e.GetPosition(this);

            //Debug.WriteLine("OnMouseRightButtonUp: width:{0}, height:{1}, x:{2}, y{3}", ActualWidth, ActualHeight, pt.X, pt.Y);
            if (Program.IsRun)
            {
                DR2API.DR2_OnMouseRightButtonUp(ViewModelBase.ApiHandle, (int)ActualWidth, (int)ActualHeight, (int)pt.X, (int)pt.Y);
            }
        }
Exemple #2
0
        private void VideoPlayerForm_MouseUp(object sender, MouseEventArgs e)
        {
            Trace.WriteLine("MouseUp: X = " + e.X + "; Y = " + e.Y);

            RECT in_rect  = new RECT(1, 1, 1, 1);
            RECT out_rect = new RECT(1, 1, 1, 1);

            DR2API.DR2_GetDrawRect(ViewModelBase.ApiHandle, ref in_rect, ref out_rect);


            Trace.WriteLine("in_rect:  " + in_rect.left + " " + in_rect.top + " " + in_rect.right + " " + in_rect.bottom + " ");
            Trace.WriteLine("out_rect: " + out_rect.left + " " + out_rect.top + " " + out_rect.right + " " + out_rect.bottom + " ");



            int in_X = (int)e.X;
            int in_Y = (int)e.Y;

            int isVertical = _host.getIsVertical();

            if (isVertical == 1)
            {
                VideoPlayerForm.PHONE_HEIGHT = VideoPlayerForm.PHONE_HEIGHT_FIRST_SCREEN;
                VideoPlayerForm.PHONE_WIDTH  = VideoPlayerForm.PHONE_WIDTH_FIRST_SCREEN;
            }
            else
            {
                VideoPlayerForm.PHONE_HEIGHT = VideoPlayerForm.PHONE_HEIGHT_SECOND_SCREEN;
                VideoPlayerForm.PHONE_WIDTH  = VideoPlayerForm.PHONE_WIDTH_SECOND_SCREEN;
            }

            var pt = e.Location;

            if (e.Button == MouseButtons.Left)
            {
                {
                    byte[] data = new byte[12];

                    data[0] = 0; // // mouseMove
                    data[1] = 0;
                    data[2] = 0;
                    data[3] = 1;

                    int sendX = 0;
                    sendX = (int)((float)((in_X) - out_rect.left) * (VideoPlayerForm.PHONE_WIDTH / (float)(out_rect.Width)));

                    byte[] X = BitConverter.GetBytes(sendX);

                    X.CopyTo(data, 4);

                    int sendY = 0;
                    sendY = (int)((float)((in_Y) - out_rect.top) * (VideoPlayerForm.PHONE_HEIGHT / (float)(out_rect.Height)));;

                    byte[] Y = BitConverter.GetBytes(sendY);
                    Y.CopyTo(data, 8);

                    if ((sendX >= 0 && (sendX < VideoPlayerForm.PHONE_WIDTH)) && (sendY >= 0 && (sendY < VideoPlayerForm.PHONE_HEIGHT)))
                    {
                        Trace.WriteLine("send mouse up : X = " + sendX + "; Y = " + sendY);
                        DataManager.sendMouseData(data);
                    }
                    else
                    {
                        Trace.WriteLine(" invalid mouse down : X = " + sendX + "; Y = " + sendY);
                    }
                }


                //Debug.WriteLine("OnMouseLeftButtonUp: width:{0}, height:{1}, x:{2}, y{3}", Width, Height, pt.X, pt.Y);
                if (Program.IsRun)
                {
                    DR2API.DR2_OnMouseLeftButtonUp(ViewModelBase.ApiHandle, Width, Height, pt.X, pt.Y);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                //Debug.WriteLine("OnMouseRightButtonUp: width:{0}, height:{1}, x:{2}, y{3}", Width, Height, pt.X, pt.Y);
                if (Program.IsRun)
                {
                    DR2API.DR2_OnMouseRightButtonUp(ViewModelBase.ApiHandle, Width, Height, pt.X, pt.Y);
                }
            }
        }