public void Close() { if ((this.currentStatus == BluePeiduiStatus.Open) && (this.p_bt != null)) { LogHelper.LogInfo("关闭蓝牙配对程式"); if (this.WhatsUp != null) { this.WhatsUp("蓝牙配对(已结束)"); } this.p_bt.Kill(); this.t_end_bt.Stop(); this.currentStatus = BluePeiduiStatus.Close; } }
public void Start() { this.p_bt = new Process(); bool flag = false; if (BTPowerManager.GetOs() == "WIN7") { if (File.Exists(Application.StartupPath + @"\BlueAuthTool7.exe")) { this.p_bt.StartInfo.FileName = Application.StartupPath + @"\BlueAuthTool7.exe"; flag = true; } } else if (File.Exists(Application.StartupPath + @"\BlueAuthTool.exe")) { this.p_bt.StartInfo.FileName = Application.StartupPath + @"\BlueAuthTool.exe"; flag = true; } if (flag) { if (this.p_bt.Start()) { this.currentStatus = BluePeiduiStatus.Open; this.n_minute = 60; this.t_end_bt.Start(); LogHelper.LogInfo("开启配对!\r\n"); LogHelper.LogInfo("蓝牙配对....."); } else { this.currentStatus = BluePeiduiStatus.Error; } } else { this.currentStatus = BluePeiduiStatus.Error; LogHelper.LogInfo("未找到蓝牙配对程式!\r\n"); LogHelper.LogInfo("未找到蓝牙配对程式....."); } }