string command = "Welcome To Solutions.... ";
Byte[] buffer = new byte[command.Length];
StreamSocket socket = null;
buffer = StringToAscii(command);
PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "";
var pairedDevices = await PeerFinder.FindAllPeersAsync();
if (pairedDevices.Count == 0)
{
Debug.WriteLine("No paired devices were found.");
}
else
{
try
{
PeerInformation selectedDevice = pairedDevices[0];
socket = new StreamSocket();
await socket.ConnectAsync(selectedDevice.HostName, "1");
await socket.OutputStream.WriteAsync(WindowsRuntimeBufferExtensions.AsBuffer(buffer));
socket.Dispose();
Array.Clear(buffer, 0, buffer.Length);
}
catch
{
}
}
此代碼工作很好當我調試代碼。但是,當我運行代碼沒有調試行動無法執行。當我debuig這個代碼它工作正常。我怎麼了。藍牙打印機不工作在Windows Phone 8.1中
![Printind演示] [10![] 1
爲什麼使用大寫字母? – moffeltje
不明白你在說什麼 – Pradip