예제 #1
0
        //Knob actions after user releases it.
        private void centerKnob_Completed(object sender, EventArgs e)
        {
            Storyboard sb = (Storyboard)Knob.FindResource("CenterKnob");

            sb.Stop();
            ResetKnobPosition();
        }
예제 #2
0
 public Joystick()
 {
     InitializeComponent();
     joyAnimation = Knob.FindResource("JoystickAnimation") as Storyboard;
     joyAnimation.Begin();
     joyAnimation.Stop();
 }
        /// <summary>Handles the MouseUp event of the Knob control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseButtonEventArgs" /> instance containing the event data.</param>
        private void Knob_MouseUp(object sender, MouseButtonEventArgs e)
        {
            Knob.ReleaseMouseCapture();
            Storyboard sb = (Storyboard)Knob.FindResource("CenterKnob");

            sb.Begin();
        }
예제 #4
0
 public JoyStick()
 {
     InitializeComponent();
     knobPositionX    = 0;
     knobPositionY    = 0;
     this.story       = (Storyboard)Knob.FindResource("CenterKnob");
     story.Completed += new EventHandler(CompleteStory);
 }
예제 #5
0
        private void centerKnob_Completed(object sender, EventArgs e)
        {
            Storyboard story = (Storyboard)Knob.FindResource("CenterKnob");

            story.Stop();
            knobPosition.X = 0;
            knobPosition.Y = 0;
        }
 public Joystick()
 {
     InitializeComponent();
     mousePressed = false;
     // Set the radius of the black inner circle.
     blackRadius  = 130;
     myStoryboard = (Storyboard)Knob.FindResource("CenterKnob");
 }
예제 #7
0
 public Joystick()
 {
     InitializeComponent();
     // Initialize knob animation
     stb = Knob.FindResource("CenterKnob") as Storyboard;
     stb.Begin();
     stb.Stop();
 }
예제 #8
0
 // Constructor.
 public Joystick()
 {
     InitializeComponent();
     // Max distance the center of knob can get without go out from joystick's base.
     maxDist = Base.Width / 2 - KnobBase.Width / 2;
     myStory = Knob.FindResource("CenterKnob") as Storyboard;
     myStory.Begin();
     myStory.Stop();
 }
예제 #9
0
 public Joystick()
 {
     InitializeComponent();
     sb = Knob.FindResource("CenterKnob") as Storyboard;
     sb.Begin();
     sb.Stop();
     //_vm = ((MainWindow)Application.Current.MainWindow).getVM();
     _vm = (ViewModelClass)this.DataContext;
     //DataContext = _vm;
 }
 private void Knob_MouseDown(object sender, MouseButtonEventArgs e)
 {
     storyboard = (Knob.FindResource("CenterKnob") as Storyboard);
     storyboard.Stop();
     Knob.CaptureMouse();
     if (e.ChangedButton == MouseButton.Left)
     {
         fpoint = e.GetPosition(this);
     }
 }
예제 #11
0
        //Releasing mouse click on joystick knob.
        private void Knob_MouseUp(object sender, MouseButtonEventArgs e)
        {
            mousePressed = false;
            //releases mouse capturing by knob.
            Mouse.Capture(null);
            //Activates knob centering storyboard.
            Storyboard sb = (Storyboard)Knob.FindResource("CenterKnob");

            sb.Begin();
        }
        /* * * * * * * * * * * * * * * * * * * * * *
        * This function stops the center knob animation.
        * * * * * * * * * * * * * * * * * * * * * */
        public void centerKnob_Completed(object sender, EventArgs e)
        {
            Storyboard exitAni = Knob.FindResource("CenterKnob") as Storyboard;

            exitAni.Stop(this);
            // resets the knob's position
            knobPosition.X = 0;
            knobPosition.Y = 0;
            // resets cordinates
            this.RUDDER   = 0;
            this.ELEVATOR = 0;
        }
예제 #13
0
        private void Knob_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            MousePressed = false;
            Storyboard story = (Storyboard)Knob.FindResource("CenterKnob");

            story.Begin();
            Knob.ReleaseMouseCapture();
            if (vm.VM_Connection)
            {
                vm.changeRudder(0);
                vm.changeElevator(0);
            }
        }
예제 #14
0
        // when the mouse button is released
        private void Base_MouseUp(object sender, MouseButtonEventArgs e)
        {
            // do the animation
            Storyboard animation = (Storyboard)Knob.FindResource("CenterKnob");

            animation.FillBehavior = FillBehavior.Stop;
            animation.Begin();

            // release knob capture
            Knob.ReleaseMouseCapture();

            // reset angle
            _angle  = NO_ANGLE;
            _radius = NO_RADIUS;
        }
        private void Knob_MouseUp(object sender, MouseButtonEventArgs e)
        {
            // xpoint = 0;
            // ypoint = 0;
            storyboard = (Knob.FindResource("CenterKnob") as Storyboard);
            storyboard.Begin();
            var knobElement = (UIElement)Knob;

            knobElement.ReleaseMouseCapture();
            knobPosition.X = 0;
            knobPosition.Y = 0;
            oldx           = 0;
            oldy           = 0;
            xpoint         = 0;
            ypoint         = 0;
        }
 /* * * * * * * * * * * * * * * * * * * * * *
 * This function in activated when the mouse
 * is over the joystick and on of the following
 * happens:
 *  1. The left button is clicked/released
 *  2. The left mouse is moving.
 *
 * The function is moving the knob if needed,
 * or activating the center animation of the knob.
 * * * * * * * * * * * * * * * * * * * * * */
 public void onMouseMove(object sender, MouseEventArgs e)
 {
     // if the left button is clicked
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         dragging = true;
         // the position of the mouse:
         updatePosition(e.GetPosition(Base).X - BorderMouse.Width / 2, e.GetPosition(Base).Y - BorderMouse.Height / 2);
     }
     else if (dragging)
     {
         // activates the animation
         Storyboard exitAni = Knob.FindResource("CenterKnob") as Storyboard;
         exitAni.Begin(this, true);
         dragging = false;
     }
 }
 public Joystick()
 {
     InitializeComponent();
     this.mousePressed = false;
     story             = (Storyboard)Knob.FindResource("CenterKnob");
 }
예제 #18
0
 public Joystick()
 {
     InitializeComponent();
     mySTB = Knob.FindResource("CenterKnob") as Storyboard;
     //  Storyboard.SetTarget(mySTB, knobPosition);
 }
예제 #19
0
 public Joystick()
 {
     InitializeComponent();
     _knobAnimation = Knob.FindResource("CenterKnob") as Storyboard;
 }
예제 #20
0
 //CTOR
 public Joystick()
 {
     InitializeComponent();
     RectangleSize = 100;
     this.Story    = Knob.FindResource("CenterKnob") as Storyboard;
 }
예제 #21
0
 public Joystick()
 {
     InitializeComponent();
     sb   = Knob.FindResource("CenterKnob") as Storyboard;
     mode = 0;
 }
예제 #22
0
 public Joystick()
 {
     InitializeComponent();
     myStoryboard = (Storyboard)Knob.FindResource("CenterKnob");
 }