我发现当我点击ScrollViewer时,PointerPressed和PointerExited事件会按预期触发.但是,如果我在触摸屏幕后向任何方向滚动并抬起我的手指,除了PointerCaptureLost之外没有任何事件会发生火灾,只要我滚动它就会过早地触发.
当我捕获指针ID并使用计时器轮询PointerPoint的状态时,即使在我滚动后抬起手指,IsInContact标志仍然为真.当我点击屏幕时,它按预期工作.
ManipulationCompleted具有与上面相同的效果,我无法使用ViewChanged事件,因为在我抬起手指之前会触发它.
这是一个错误还是我错过了什么?当用户将手指从屏幕上抬起时,我还能检测到另一种方法吗?这让我开始香蕉.
示例代码如下.您需要在触摸模式下使用模拟器或具有可触摸屏幕进行测试:
代码:
using System;
using Windows.UI.Input;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
namespace App1
{
public sealed partial class MainPage : Page
{
private readonly DispatcherTimer pointerTimer = new DispatcherTimer();
private uint? CurrentPointerID; //container for the current pointer id when user makes contact with the screeen
public MainPage()
{
this.InitializeComponent();
scrollviewer.PointerPressed += scrollviewer_PointerPressed;
scrollviewer.PointerMoved += scrollviewer_PointerMoved;
scrollviewer.PointerExited += scrollviewer_PointerExited;
scrollviewer.PointerReleased += scrollviewer_PointerReleased;
scrollviewer.PointerCaptureLost += scrollviewer_PointerCaptureLost;
scrollviewer.PointerCanceled += scrollviewer_PointerCanceled;
pointerTimer.Tick += pointerTimer_Tick;
pointerTimer.Interval = TimeSpan.FromMilliseconds(300);
pointerTimer.Start(); …Run Code Online (Sandbox Code Playgroud) 好的,所以我曾经能够在项目属性对话框中更改SSL端口号,但在asp.net 5 RC1更新之后,SSL字段是只读的:
当我尝试直接编辑.xproj时,它会忽略SSLPort值:
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>17204</DevelopmentServerPort>
<SSLPort>44303</SSLPort>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
当我更改绑定并启动我的项目时,它还会将我的应用程序主机配置文件($ [solutionDir] .vs\config\applicationhost.config)中的端口重置为原始值.
<site name="WebApplication1" id="8">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\WebApplication1\wwwroot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:17833:localhost" />
<binding protocol="https" bindingInformation="*:44303:localhost" />
</bindings>
</site>
Run Code Online (Sandbox Code Playgroud)
是什么赋予了?Visual Studio从哪里获取此值,以及如何更改它?
所以我有一个简单的Signalr/Knockout项目,它使用映射插件将一个简单的对象(带有更多项的数组的项)绑定到我在JS中定义的viewModel:
var someObjectMapping = {
'MyItemArray': {
create: function (options) {
return new MyItemViewModel(options.data);
}
}
}
var myItemMapping = {
'ItemChildren': {
create: function (options) {
return new ItemChildViewModel(options.data);
}
}
}
var SomeObjectViewModel = function (data) {
ko.mapping.fromJS(data, someObjectMapping, this);
}
var MyItemViewModel = function (data) {
ko.mapping.fromJS(data, myItemMapping, this);
}
var ItemChildViewModel = function (data) {
ko.mapping.fromJS(data, null, this);
}
Run Code Online (Sandbox Code Playgroud)
我使用SignalR的默认设置连接到我的集线器,如下所示:
var myHubProxy = $.connection.myHub;
myHubProxy.client.processSomeObject = function(someObject) {
console.log('SomeObject received');
var viewModel = new SomeObjectViewModel(someObject);
ko.applyBindings(viewModel); …Run Code Online (Sandbox Code Playgroud) 我想在连续的Azure Web作业中使用SignalR自托管项目.但是当我尝试运行它时,我收到以下错误:
[07/11/2014 10:58:44 > cbec50: SYS INFO] Status changed to Running
[07/11/2014 10:58:45 > cbec50: ERR ] Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. ---> System.Net.HttpListenerException: Access is denied
Run Code Online (Sandbox Code Playgroud)
我想控制台应用程序需要以提升的权限运行.有没有办法让这个工作?
先决条件:
Install-Package Microsoft.Azure.Jobs -pre
Install-Package Microsoft.AspNet.SignalR.SelfHost
Run Code Online (Sandbox Code Playgroud)
完整来源:
using System;
using Microsoft.Azure.Jobs;
using Microsoft.Owin.Hosting;
using Owin;
namespace ConsoleApplication2
{
class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
class Program
{
static void Main(string[] args)
{
using (WebApp.Start<Startup>("http://localhost:8080/"))
{
Console.WriteLine("Server running …Run Code Online (Sandbox Code Playgroud) asp.net ×2
signalr ×2
asp.net-core ×1
azure ×1
c# ×1
iis ×1
knockout.js ×1
signalr-hub ×1
ssl ×1
winrt-xaml ×1
xaml ×1