public static void StartApp(RAPI rapi, string filename, string parameters)
 {
     rapi.CreateProcess(filename, parameters);
 }
Exemple #2
0
        private void textBox_SN_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Enter:
                Cursor          = Cursors.WaitCursor;
                label_Info.Text = "";
                try
                {
                    if ((6 < textBox_MSN.Text.Length) && (textBox_MSN.Text.Equals(textBox_SN.Text)) /*&& IsNumberic(textBox_SN.Text)*/)
                    {
                        string sType = "";
                        switch (comboBox_Type.SelectedItem.ToString())
                        {
                        case "K36掌机":
                            sType = Convert.ToString(1300 << 16, 16);
                            break;

                        case "K25全能终端":
                            sType = Convert.ToString(1100 << 16, 16);
                            break;

                        case "P31全能终端":
                            sType = Convert.ToString(1200 << 16, 16);
                            break;

                        case "P31抄表终端":
                            sType = Convert.ToString(1201 << 16, 16);
                            break;

                        case "P31用电检查终端":
                            sType = Convert.ToString(1202 << 16, 16);
                            break;

                        case "P31计量维护终端":
                            sType = Convert.ToString(1203 << 16, 16);
                            break;

                        case "P31应急处理终端":
                            sType = Convert.ToString(1204 << 16, 16);
                            break;

                        default:
                            break;
                        }
                        SaveData(SNfile, string.Format("{0},{1},{2},{3},{4},{5}\r\n",
                                                       System.DateTime.Now.ToString("yyyy-MM-dd"), //"2011-06-15",//strDate,
                                                       textBox_MSN.Text,                           //strSN,
                                                       "WinCE",                                    //strDescription,
                                                       sType,                                      //strVer,
                                                       "30.40",                                    //"24.32",//strZB,
                                                       "80.21"                                     //"80.20"//strFB
                                                       ), false);
                        if (!myrapi.Connected)
                        {
                            ActiveSync_Active();
                        }
                        System.Threading.Thread.Sleep(100);
                        if (myrapi.Connected)
                        {
                            if (myrapi.DeviceFileExists(@"\Windows\rt.sys"))
                            {
                                myrapi.DeleteDeviceFile(@"\Windows\rt.sys");
                            }
                            if (myrapi.DeviceFileExists(@"\Windows\kmt.sys"))
                            {
                                myrapi.DeleteDeviceFile(@"\Windows\kmt.sys");
                            }
                            if (myrapi.DeviceFileExists(@"\Windows\Update.exe"))
                            {
                                myrapi.DeleteDeviceFile(@"\Windows\Update.exe");
                            }

                            myrapi.CopyFileToDevice(SNfile, @"\Windows\kmt.sys", true);
                            myrapi.CopyFileToDevice(Runfile, @"\Windows\Update.exe", true);
                            myrapi.CreateProcess(@"\Windows\Update.exe", "");


                            timer.Enabled = true;
                        }
                        else
                        {
                            label_Info.Text = "!!!:设备未连接";
                        }
                    }
                    else
                    {
                        label_Info.Text = "!!!:输入不正确";
                        textBox_MSN.Focus();
                        textBox_MSN.SelectAll();
                    }
                }
                catch
                {
                    label_Info.Text = "!!!:运行异常";
                }

                Cursor = Cursors.Default;
                break;
            }
        }