Exemplo n.º 1
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);
        }
Exemplo n.º 2
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();
        }