private void PreviewMouseDownCommandExecute(object obj)
        {
            switch (obj.ToString())
            {
            case "20":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis2", "Axis2SpeedScale", Axis2SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4010", (int)((double)axis2MaxVal * 0.1 * Axis2SpeedScale / 100));
                plc.SetM("M403", true);
                break;

            case "21":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis2", "Axis2SpeedScale", Axis2SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4010", (int)((double)axis2MaxVal * 0.1 * Axis2SpeedScale / 100));
                plc.SetM("M404", true);
                break;

            case "30":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis3", "Axis3SpeedScale", Axis3SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4012", (int)((double)axis3MaxVal * 0.1 * Axis3SpeedScale / 100));
                plc.SetM("M405", true);
                break;

            case "31":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis3", "Axis3SpeedScale", Axis3SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4012", (int)((double)axis3MaxVal * 0.1 * Axis3SpeedScale / 100));
                plc.SetM("M406", true);
                break;

            case "40":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis4", "Axis4SpeedScale", Axis4SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4014", (int)((double)axis4MaxVal * 0.1 * Axis4SpeedScale / 100));
                plc.SetM("M407", true);
                break;

            case "41":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis4", "Axis4SpeedScale", Axis4SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4014", (int)((double)axis4MaxVal * 0.1 * Axis4SpeedScale / 100));
                plc.SetM("M408", true);
                break;

            case "90":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis9", "Axis9SpeedScale", Axis9SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4016", (int)((double)axis9MaxVal * 0.1 * Axis9SpeedScale / 100));
                plc.SetM("M409", true);
                break;

            case "91":
                DXH.Ini.DXHIni.WritePrivateProfileString("Axis9", "Axis9SpeedScale", Axis9SpeedScale.ToString("F1"), iniParameterPath);
                plc.WriteW("D4016", (int)((double)axis9MaxVal * 0.1 * Axis9SpeedScale / 100));
                plc.SetM("M410", true);
                break;

            case "100":
                plc.SetM("M400", true);
                break;

            default:
                break;
            }
        }
        private void AxisPosGoButtonCommandExecute(object obj)
        {
            switch (obj.ToString())
            {
            case "20":
                if (HandyControl.Controls.MessageBox.Show("你确定运动到点-轴2位置1-么?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    plc.WriteW("D4040", (int)(Axis2Pos1 * 1000));
                    DXH.Ini.DXHIni.WritePrivateProfileString("Axis2", "Axis2SpeedScale", Axis2SpeedScale.ToString("F1"), iniParameterPath);
                    plc.WriteW("D4010", (int)((double)axis2MaxVal * 0.1 * Axis2SpeedScale / 100));
                    plc.SetM("M411", true);
                }
                break;

            case "21":
                if (HandyControl.Controls.MessageBox.Show("你确定运动到点-轴2位置2-么?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    plc.WriteW("D4040", (int)(Axis2Pos2 * 1000));
                    DXH.Ini.DXHIni.WritePrivateProfileString("Axis2", "Axis2SpeedScale", Axis2SpeedScale.ToString("F1"), iniParameterPath);
                    plc.WriteW("D4010", (int)((double)axis2MaxVal * 0.1 * Axis2SpeedScale / 100));
                    plc.SetM("M411", true);
                }
                break;

            case "30":
                if (HandyControl.Controls.MessageBox.Show("你确定运动到点-轴3位置1-么?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    plc.WriteW("D4042", (int)(Axis3Pos1 * 200));
                    DXH.Ini.DXHIni.WritePrivateProfileString("Axis3", "Axis3SpeedScale", Axis3SpeedScale.ToString("F1"), iniParameterPath);
                    plc.WriteW("D4012", (int)((double)axis3MaxVal * 0.1 * Axis3SpeedScale / 100));
                    plc.SetM("M412", true);
                }
                break;

            case "40":
                if (HandyControl.Controls.MessageBox.Show("你确定运动到点-轴4位置1-么?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    plc.WriteW("D4044", (int)(Axis4Pos1 * 200));
                    DXH.Ini.DXHIni.WritePrivateProfileString("Axis4", "Axis4SpeedScale", Axis4SpeedScale.ToString("F1"), iniParameterPath);
                    plc.WriteW("D4014", (int)((double)axis4MaxVal * 0.1 * Axis4SpeedScale / 100));
                    plc.SetM("M413", true);
                }
                break;

            case "90":
                if (HandyControl.Controls.MessageBox.Show("你确定运动到点-轴9位置1-么?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    plc.WriteW("D4046", (int)(Axis9Pos1 / 360 * 10000));
                    DXH.Ini.DXHIni.WritePrivateProfileString("Axis9", "Axis9SpeedScale", Axis9SpeedScale.ToString("F1"), iniParameterPath);
                    plc.WriteW("D4016", (int)((double)axis9MaxVal * 0.1 * Axis9SpeedScale / 100));
                    plc.SetM("M414", true);
                }
                break;

            default:
                break;
            }
        }