Ejemplo n.º 1
0
 void _currentMarker_OnChange(object sender, TouchlessLib.MarkerEventArgs e)
 {
     //throw new NotImplementedException();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Eventhandler for updates on Marker position
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _currentMarker_OnChange(object sender, TouchlessLib.MarkerEventArgs e)
        {
            Point markerLocation = this.getMarkerLocation();
            double activeArea = this.pictureBoxImage.Width * this.pictureBoxActiveArea;

            int position = 1; // 0 = left, 1 = center, 2 = right

            if (markerLocation.X >= 0 && markerLocation.X < activeArea)
            {
                position = 0; // Ellipse is in Left Area
                this.toolStripStatusAreaPosition.Text = "Left";
            }
            else if (markerLocation.X >= (this.pictureBoxImage.Width - activeArea) && markerLocation.X <= this.pictureBoxImage.Width)
            {
                position = 2; // Ellipse is in Center Area
                this.toolStripStatusAreaPosition.Text = "Right";
            }
            else
            {
                position = 1; // Ellipse is in Right Area
                this.toolStripStatusAreaPosition.Text = "Center";
            }

            // Left Enter
            if(position == 0)
            {
                if (!this.leftActive)
                {
                    this.leftActive = true;
                    pictureBoxImage.Invoke(new RotatorSwitch(this.Rotator.ShowPrevious));
                }
            }

            // Right Enter
            if(position == 2)
            {
                if (!this.rightActive)
                {
                    this.rightActive = true;
                    pictureBoxImage.Invoke(new RotatorSwitch(this.Rotator.ShowNext));
                }
            }

            // Left leave
            if(this.leftActive)
            {
                if (position != 0)
                {
                    this.leftActive = false;
                }
            }

            // Right leave
            if(this.rightActive)
            {
                if (position != 2)
                {
                    this.rightActive = false;
                }
            }

            //this.toolStripStatusMarkerPosition.Text = "Marker X: " + tMgr._currentMarker.CurrentData.X + " Y: " + tMgr._currentMarker.CurrentData.Y;

            // cause PictureBox.Paint
            this.pictureBoxImage.Invalidate();
        }