VS 2012使用项目类型编译时,WP 8.0如果未附加调试器,则以下代码将失败.
不知何故,如果未附加调试器,编译器优化会破坏内部代码Crash()- 请参阅代码中的注释.
在Lumia 1520(8.1)和Lumia 630(8.0)上测试.
有没有想过为什么会这样?
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
Button.Tap += (sender, args) => new A<B, string>(new B(), "string").Crash();
}
}
public class B
{
public void Foo<T>(T val) { }
}
public class A<T1, T2> where T1 : B
{
private T1 _t1;
private T2 _t2;
public A(T1 t1, T2 t2)
{
_t2 = t2;
_t1 = t1;
} …Run Code Online (Sandbox Code Playgroud) 当我let! read = from.AsyncRead buf在F#中执行时,它会阻塞并且在TCP套接字死亡之前不会返回.为什么?我该如何解决?
它的代码:
module StreamUtil
open System.IO
/// copy from 'from' stream to 'toStream'
let (|>>) (from : Stream) (toStream : Stream) =
let buf = Array.zeroCreate<byte> 1024
let rec doBlock () =
async {
let! read = from.AsyncRead buf
if read <= 0 then
toStream.Flush()
return ()
else
do! toStream.AsyncWrite(buf, 0, read)
return! doBlock () }
doBlock ()
Run Code Online (Sandbox Code Playgroud)
它是从这段代码调用的:
use fs = new FileStream(targPath, FileMode.CreateNew, FileAccess.ReadWrite)
do! req.InputStream |>> fs
Run Code Online (Sandbox Code Playgroud)
并使用来自Windows Phone 7.1模拟器的此代码通过HTTP请求:
public …Run Code Online (Sandbox Code Playgroud) 连接和断开蓝牙设备已在Windows Phone/Desktop 8.1上提供了各种结果.我一直在使用Windows.Devices.Bluetooth.Rfcomm命名空间,我试图连接几个具有不同蓝牙版本/类的设备.
每当我尝试连接到2.0或2.1设备时,都会出现问题.我第一次尝试连接到每个设备时,一切都会正常,连接将打开.当我随后关闭连接并重新连接设备时,问题就开始了. 在重新连接期间,连接将永远不会打开,调试器将抛出System.Exception:
> Message: No further data is available.
Run Code Online (Sandbox Code Playgroud)
此外,当连接失败时,Windows 8.1设备将继续尝试(不成功)连接到蓝牙设备,即使我自己的应用程序终止.有时,Windows 8.1设备也会将蓝牙设备显示为已连接,而设备会直观地显示它已不再连接.重新连接蓝牙设备的唯一方法是取消配对并关闭/重启Windows设备上的蓝牙.
每当我尝试DeviceInformation在连接失败后进行新的呼叫时,它将拒绝返回我之前尝试连接的设备.
> Message: The service cannot be found in the specified name space.
Run Code Online (Sandbox Code Playgroud)
奇怪的结果,1.2设备完美运行.
清单文件:
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="serviceId:00001101-0000-1000-8000-00805F9B34FB"/>
</m2:Device>
</m2:DeviceCapability>
Run Code Online (Sandbox Code Playgroud)
选择设备:
Guid RfcommChatServiceUuid = Guid.Parse("00001101-0000-1000-8000-00805F9B34FB");
await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.FromUuid(RfcommChatServiceUuid)));
Run Code Online (Sandbox Code Playgroud)
连接:(id = chatserviceid)
StreamSocket _socket;
RfcommDeviceService service = await RfcommDeviceService.FromIdAsync(deviceInformation1._id);
await _socket.ConnectAsync(service.ConnectionHostName, service.ConnectionServiceName);
Run Code Online (Sandbox Code Playgroud)
断开:
this._socket.Dispose();
this._socket = null;
Run Code Online (Sandbox Code Playgroud)
我已经研究了MSDN,代码示例,演示版,channel-9视频和StackOverflow,没有资源可以告诉我是否存在问题Windows.Devices.Bluetooth.Rfcomm.
是否有人认识到这些奇怪的结果?难道我做错了什么? …
我有来自Nuget的这个 HttpClient.
当我想获取数据时,我这样做:
var response = await httpClient.GetAsync(url);
var data = await response.Content.ReadAsStringAsync();
Run Code Online (Sandbox Code Playgroud)
但问题是我不知道如何发布数据?我必须发送一个帖子请求并在其中发送这些值:comment="hello world"和questionId = 1.这些可以是一个类的属性,我不知道.
更新我不知道如何将这些值添加到HttpContentpost方法需要它.httClient.Post(string, HttpContent);
c# windows-phone-7 windows-phone dotnet-httpclient windows-phone-8
我知道这不是提出这个问题的最佳地点,但很难找到一个好的答案,我更愿意问经验丰富的专业人士.
发布申请必须支付多少费用:
这些公司保留的百分比是多少?
我有一个textblock的width发言权500,但我的字符串只是说"H",但我想underline整个textblock宽度不仅轰下我能做些什么?
我有一个非常具体的问题.我正在为手机写一个网页,上面有一个按钮.我正在检测touchevent包括IE在内的每个浏览器,但在IE上它是非常具体的.几秒钟后它会自动结束.你能以某种方式帮助我吗?这是我的代码(修改过的代码,但仍然无法正常工作):
if (window.navigator.pointerEnabled) {
tapButton.addEventListener("pointerup", function(e) {
e.preventDefault();
addClass(this, 'clicked');
buttonTouched = true;
}, false);
tapButton.addEventListener("pointerdown", function(e) {
e.preventDefault();
removeClass(this, 'clicked');
buttonTouched = false;
}, false);
alert("pointerEnabled");
}
else if (window.navigator.msPointerEnabled) {
tapButton.addEventListener("MSPointerDown", function(e) {
e.preventDefault();
addClass(this, 'clicked');
buttonTouched = true;
}, false);
tapButton.addEventListener("MSPointerUp", function(e) {
e.preventDefault();
removeClass(this, 'clicked');
buttonTouched = false;
}, false);
alert("mspointerEnabled");
}
else {
alert("ordinary touch");
tapButton.addEventListener('touchstart', function(e) {
e.preventDefault();
addClass(this, 'clicked');
buttonTouched = true;
}, false);
tapButton.addEventListener('touchend', function(e) {
e.preventDefault();
removeClass(this, 'clicked');
buttonTouched …Run Code Online (Sandbox Code Playgroud) 之前已经提出了类似的问题,但这个问题努力探索更多选项和传递复杂对象的能力.
问题是如何传递参数,但它确实需要分解为三个部分.
Uri导航示例
page.NavigationService.Navigate(new Uri("/Views/Page.xaml", UriKind.Relative));
Run Code Online (Sandbox Code Playgroud)
手动导航示例
page.NavigationService.Navigate(new Page());
Run Code Online (Sandbox Code Playgroud)
这个问题的答案适用于WP7,Silverlight,WPF和Windows 8.
注意:Silverlight和Windows8之间存在差异
当开始在模拟器或设备上测试Windows Phone(甚至是空白应用程序)上的应用程序时,会弹出"在项目启动之前需要部署项目"的错误."验证项目是否已选择部署在解决方案配置管理器中,或通过单击"生成"菜单中的某个部署命令显式解除该项目"模拟器将启动并成功运行,在模拟器上部署应用程序仍然没有运气.
windows-mobile windows-phone windows-phone-8-emulator visual-studio-2015
发生了很多事情,我不知道从哪里开始.说真的,这不应该更简单吗?
编辑:有人在这里知道我怎么能联系微软告诉这个?甚至,有人可以告诉他们这个问题吗?
我有最新的Windows 10桌面,还有Windows Phone 10.0.10512.1000.我在Visual Studio 2015中安装了用于Universal Apps开发的工具(以及8.1).我有一个Lumia 730.
所以我用USB线连接了手机.一切都很好,电话得到识别,我可以浏览文件夹.
然后我启动了Visual Studio 2015并创建了一个空白的通用应用程序.编译并尝试部署.现在这发生在我身上:Visual Studio暂停一段时间.最终我收到错误,告知找不到设备(DEP6200).
我已经尝试过几十种解决方案:
我还尝试使用Windows Phone Developer Power Tools.当我尝试使用它时,它要求我安装一些"Phone Tools Update Pack",但是当我尝试时,它说操作没有成功,并且还显示NRE消息字符串(对象引用未设置为实例)一个对象).
我可以毫无问题地浏览手机的文件夹.我试图重新安装驱动程序......我尝试了一切.
这太可悲了.
你们有没有想过要检查的东西?
编辑:我在完成所有这些之前测试了这个应用程序:https://blogs.windows.com/buildingapps/2015/07/09/just-released-windows-10-application-deployment-tool/
它奏效了.如果是这种情况,Windows Phone 10部署在Visual Studio上的工作是否已经开始,或者我们还需要等待一段时间?
编辑2:对我的应用程序清单进行一些更改并选择"ARM"配置后,现在我得到了这个:
1>Deploying to SD Card...
1>Updating the layout...
1>Copying files: Total <1 mb to layout...
1>Checking whether required frameworks are installed...
1>Framework: Microsoft.NET.CoreRuntime.1.0/ARM, app package version 1.0.23117.0 is not currently installed.
1>Framework: Microsoft.VCLibs.140.00.Debug/ARM, app package version …Run Code Online (Sandbox Code Playgroud) deployment visual-studio windows-phone windows-phone-8 windows-10
windows-phone ×10
c# ×5
.net ×1
android ×1
asynchronous ×1
bluetooth ×1
deployment ×1
f# ×1
ios ×1
javascript ×1
rest ×1
textblock ×1
touchstart ×1
underline ×1
windows ×1
windows-10 ×1
windows-8 ×1
wpf ×1
xaml ×1
xml ×1