private void Save_Click(object sender, RoutedEventArgs e)
 {
     if (status == Status.WaitInput)
     {
         AxAssgn axisInfo = new AxAssgn();
         axisAssign = new InGameAxAssgn(-1, -1, axisInfo);
         if (whoCalledWindow == "Throttle" | whoCalledWindow == "Throttle_Right")
         {
             MainWindow.deviceControl.throttlePos = new ThrottlePosition();
         }
     }
     if (status == Status.ShowAxisStatus)
     {
         AxAssgn axisInfo = new AxAssgn();
         axisAssign = new InGameAxAssgn(
             devNumTmp,
             phyAxNumTmp,
             (bool)Invert.IsChecked,
             (AxCurve)DeadZone.SelectedIndex,
             (AxCurve)Saturation.SelectedIndex
             );
         if (whoCalledWindow == "Throttle" | whoCalledWindow == "Throttle_Right")
         {
             MainWindow.deviceControl.throttlePos = new ThrottlePosition(AB, IDLE);
         }
     }
     AxisDetectionTimer.Stop();
     sw.Stop();
     Close();
 }
Beispiel #2
0
        public static InGameAxAssgn ShowAxisAssignWindow(MainWindow mainWindow, InGameAxAssgn axisAssign, object sender)
        {
            AxisAssignWindow ownWindow = new AxisAssignWindow(mainWindow, axisAssign, sender);

            ownWindow.ShowDialog();
            axisAssign = ownWindow.axisAssign;
            return(axisAssign);
        }
Beispiel #3
0
        public AxisAssignWindow(MainWindow mainWindow, InGameAxAssgn axisAssign, object sender)
        {
            InitializeComponent();

            this.mainWindow = mainWindow;
            this.axisAssign = axisAssign;

            whoCalledWindow = ((System.Windows.Controls.Button)sender).Name;

            MouseWheel += Detect_MouseWheel;
        }
        public AxisAssignWindow(InGameAxAssgn axisAssign, object sender)
        {
            InitializeComponent();

            this.axisAssign = axisAssign;
            whoCalledWindow = ((System.Windows.Controls.Button)sender).Name;

            devNumTmp   = axisAssign.GetDeviceNumber();
            phyAxNumTmp = axisAssign.GetPhysicalNumber();

            MouseWheel += Detect_MouseWheel;
        }
Beispiel #5
0
        public void Reset()
        {
            AxisValueProgress.Value = CommonConstants.AXISMIN;

            axisAssign = (InGameAxAssgn)MainWindow.inGameAxis[whoCalledWindow];

            if (axisAssign.GetDeviceNumber() > -1 | axisAssign.GetDeviceNumber() == -2)
            {
                status           = Status.ShowAxisStatus;
                Retry.Content    = "CLEAR";
                Retry.Visibility = Visibility.Visible;
                if (whoCalledWindow == "Throttle")
                {
                    SetAB.Visibility = Visibility.Visible;
                    Idle.Visibility  = Visibility.Visible;

                    if (((InGameAxAssgn)MainWindow.inGameAxis[whoCalledWindow]).GetDeviceNumber() >= 0)
                    {
                        AB   = MainWindow.deviceControl.joyAssign[((InGameAxAssgn)MainWindow.inGameAxis[whoCalledWindow]).GetDeviceNumber()].detentPosition.GetAB();
                        IDLE = MainWindow.deviceControl.joyAssign[((InGameAxAssgn)MainWindow.inGameAxis[whoCalledWindow]).GetDeviceNumber()].detentPosition.GetIDLE();
                    }
                }
            }

            Saturation.SelectedIndex = (int)axisAssign.GetSaturation();
            DeadZone.SelectedIndex   = (int)axisAssign.GetDeadzone();
            Invert.IsChecked         = axisAssign.GetInvert();

            devNumTmp   = axisAssign.GetDeviceNumber();
            phyAxNumTmp = axisAssign.GetPhysicalNumber();

            Joynum = new JoyAxisNeutralValue[MainWindow.deviceControl.joyAssign.Length];
            for (int i = 0; i < MainWindow.deviceControl.joyAssign.Length; i++)
            {
                Joynum[i] = new JoyAxisNeutralValue();
            }

            for (int i = 0; i < MainWindow.deviceControl.joyAssign.Length; i++)
            {
                for (int ii = 0; ii < 8; ii++)
                {
                    Joynum[i].NeutralValue[ii] = MainWindow.deviceControl.joyAssign[i].JoyAxisState(ii);
                }
            }
        }
Beispiel #6
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     if (status == Status.WaitInput)
     {
         AxAssgn axisInfo = new AxAssgn();
         axisAssign = new InGameAxAssgn(new JoyAssgn(), -1, axisInfo);
     }
     if (status == Status.ShowAxisStatus)
     {
         if (devNumTmp >= 0)
         {
             axisAssign = new InGameAxAssgn(
                 MainWindow.deviceControl.joyAssign[devNumTmp],
                 phyAxNumTmp,
                 (bool)Invert.IsChecked,
                 (AxCurve)DeadZone.SelectedIndex,
                 (AxCurve)Saturation.SelectedIndex
                 );
             if (whoCalledWindow == "Throttle")
             {
                 MainWindow.deviceControl.joyAssign[devNumTmp].detentPosition = new DetentPosition(AB, IDLE);
             }
         }
         else if (devNumTmp == -2)
         {
             axisAssign = new InGameAxAssgn(
                 MainWindow.deviceControl.mouse,
                 0,
                 (bool)Invert.IsChecked,
                 (AxCurve)DeadZone.SelectedIndex,
                 (AxCurve)Saturation.SelectedIndex
                 );
             if (whoCalledWindow == "Throttle")
             {
                 MainWindow.deviceControl.mouse.detentPosition = new DetentPosition(AB, IDLE);
             }
         }
     }
     AxisDetectionTimer.Stop();
     sw.Stop();
     Close();
 }
Beispiel #7
0
        /// <summary>
        /// Callback When clicked "Assign" Button. Opens AxisAssignWindow.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Assign_Click(object sender, RoutedEventArgs e)
        {
            AxisMovingTimer.Stop();
            NewDeviceDetectTimer.Stop();

            string whocalledwindow = ((System.Windows.Controls.Button)sender).Name;

            InGameAxAssgn axisAssign = AxisAssignWindow.ShowAxisAssignWindow(this, (InGameAxAssgn)inGameAxis[whocalledwindow], sender);

            // Reset PhysicalAxis previously assigned to same axis
            // In case of axis has been unassigned and saved.
            for (int i = 0; i < deviceControl.joyAssign.Length; i++)
            {
                deviceControl.joyAssign[i].ResetPreviousAxis(whocalledwindow);
            }
            if (deviceControl.mouse.GetMouseAxis().GetAxisName() == whocalledwindow)
            {
                deviceControl.mouse.LoadAx(new AxAssgn());
            }

            // When axis has been assigned.
            if (axisAssign.GetDeviceNumber() > -1)
            {
                deviceControl.joyAssign[axisAssign.GetDeviceNumber()].axis[axisAssign.GetPhysicalNumber()]
                    = new AxAssgn(whocalledwindow, axisAssign);
            }
            if (axisAssign.GetDeviceNumber() == -2)
            {
                wheelValue = 0;
                deviceControl.mouse.LoadAx(new AxAssgn(whocalledwindow, axisAssign));
            }

            joyAssign_2_inGameAxis();
            ResetAssgnWindow();

            NewDeviceDetectTimer.Start();
            AxisMovingTimer.Start();
        }