Пример #1
0
 public void update(Object sender, VirtualJoystickEventArgs e)
 {
     VM_aileron  = e.Aileron;
     VM_elevator = e.Elevator;
     NotifyPropertyChanged("VM_aileron");
     NotifyPropertyChanged("VM_elevator");
 }
        public void ChangeAileronAndElevator(Joystick sendler, VirtualJoystickEventArgs e)
        {
            string msg1 = AileronPath + " " + e.Aileron + " " + "\r\n";
            string msg2 = ElevatorPath + " " + e.Elevator + " " + "\r\n";

            CommandsChannel.Instance.SetValAndSendMes(msg1);
            CommandsChannel.Instance.SetValAndSendMes(msg2);
        }
Пример #3
0
 public void JoyStick_Handler(Joystick sender, VirtualJoystickEventArgs args)
 {
     if (sender == joystick)
     {
         Aileron  = args.Aileron;
         Elevator = args.Elevator;
     }
 }
        public Joystick()
        {
            InitializeComponent();

            Knob.MouseLeftButtonDown += Knob_MouseLeftButtonDown;
            Knob.MouseLeftButtonUp   += Knob_MouseLeftButtonUp;
            Knob.MouseMove           += Knob_MouseMove;
            virtualJoystickEventArgs  = new VirtualJoystickEventArgs();
            centerKnob = Knob.Resources["CenterKnob"] as Storyboard;
        }
        public Joystick()
        {
            InitializeComponent();

            this.viewModel = new VirtualJoystickEventArgs();
            DataContext    = viewModel;

            Knob.MouseLeftButtonDown += Knob_MouseLeftButtonDown;
            Knob.MouseLeftButtonUp   += Knob_MouseLeftButtonUp;
            Knob.MouseMove           += Knob_MouseMove;

            centerKnob = Knob.Resources["CenterKnob"] as Storyboard;
        }
Пример #6
0
        public static void CalculateAngleAndPositions(VirtualJoystickEventArgs args, out double PosX, out double PosY, out double ang)
        {
            double distance = Convert.ToDouble($"{args.Distance}");

            ang = Convert.ToDouble($"{args.Angle}");

            if (ang >= 0 && ang < 90)
            {
                ang = 270 + ang;
            }
            else if (ang >= 90 && ang <= 360)
            {
                ang -= 90;
            }

            double ang_rad = (ang * Math.PI) / 180.0;
            double cos_ang = Math.Cos(ang_rad);
            double sin_ang = Math.Sin(ang_rad);

            if (ang == 90)
            {
                cos_ang = 0;
                sin_ang = 1;
            }
            else if (ang == 180)
            {
                cos_ang = -1;
                sin_ang = 0;
            }
            else if (ang == 270)
            {
                cos_ang = 0;
                sin_ang = -1;
            }

            PosX = (cos_ang * distance) / 100;
            PosY = sin_ang;
        }
Пример #7
0
 public void JoystickMoved(object joy, VirtualJoystickEventArgs info)
 {
     model.Elevator = info.Elevator;
     model.Aileron  = info.Aileron;
 }
Пример #8
0
 public void Update(object sender, VirtualJoystickEventArgs args)
 {
     Aileron  = args.Aileron;
     Elevator = args.Elevator;
 }
Пример #9
0
 public void updateVMArgsAfterMoved(Joystick sender, VirtualJoystickEventArgs args)
 {
     vm.Aileron  = (float)args.Aileron;
     vm.Elevator = (float)args.Aileron;
 }
Пример #10
0
 /*
  * This function is added to the Jostick "Moved" event which is called
  * when the Joystick is moving and updates the View Model properties with
  * it's new values after the Joystick move.
  */
 public void UpdateData(object Sender, VirtualJoystickEventArgs VJEA)
 {
     this.Ailron   = VJEA.Aileron;
     this.Elevator = VJEA.Elevator;
 }
 public ManualViewModel(VirtualJoystickEventArgs mod)
 {
     this.model = mod;
 }