C# 当标记对象位于三星SUR40桌上时,无法识别手指和水滴触摸输入

C# 当标记对象位于三星SUR40桌上时,无法识别手指和水滴触摸输入,c#,wpf,pixelsense,C#,Wpf,Pixelsense,所以,基本上我过滤触摸输入,只识别每个屏幕上的手指和标签触摸,除了训练屏幕上我识别手指、标签和斑点触摸。我通过重写作为SurfaceWidow的MainWindow中的OnPreviewTouchDown(TouchEventArgs e)方法来实现这一点。有关覆盖方法,请参见下面的代码 protected override void OnPreviewTouchDown(TouchEventArgs e) { bool isFinger = e.TouchDe

所以,基本上我过滤触摸输入,只识别每个屏幕上的手指和标签触摸,除了训练屏幕上我识别手指、标签和斑点触摸。我通过重写作为SurfaceWidow的MainWindow中的OnPreviewTouchDown(TouchEventArgs e)方法来实现这一点。有关覆盖方法,请参见下面的代码

    protected override void OnPreviewTouchDown(TouchEventArgs e)
    {

        bool isFinger = e.TouchDevice.GetIsFingerRecognized();
        bool isTag = e.TouchDevice.GetIsTagRecognized();
        //Allows all touches on Train Screen. Only fingers and tags everywhere else
        if (e.Source.ToString() != "dtt_app.TrainScreen")
        {
            if (isFinger == false && isTag == false)
            {
                e.Handled = true;
                return;
            }
        }
       base.OnPreviewTouchDown(e);
    }
这就是我的令牌可视化代码的样子

        for (int i = 1; i < 10; i++)
        {
            TagVisualizationDefinition TokenTagDef =
                    new TagVisualizationDefinition();
            // The tag value that this definition will respond to.
            TokenTagDef.Value = i;
            // The .xaml file for the UI
            TokenTagDef.Source =
                new Uri("TokenVisualization.xaml", UriKind.Relative);
            // The maximum number for this tag value.
            TokenTagDef.MaxCount = 100;
            // Orientation offset (default).
            TokenTagDef.OrientationOffsetFromTag = 0.0;
            // Physical offset (horizontal inches, vertical inches).
            TokenTagDef.PhysicalCenterOffsetFromTag = new Vector(0.0, 0.0);
            // Tag removal behavior (default).
            TokenTagDef.TagRemovedBehavior = TagRemovedBehavior.Fade;
            // Orient UI to tag? (default).
            TokenTagDef.UsesTagOrientation = true;

            // Add the definition to the collection.
            MyTagVisualizer.Definitions.Add(TokenTagDef);

        }
for(int i=1;i<10;i++)
{
TagVisualizationDefinition标记TagDef=
新标记VisualizationDefinition();
//此定义将响应的标记值。
TokenTagDef.Value=i;
//UI的.xaml文件
TokenTagDef.Source=
新的Uri(“TokenVisualization.xaml”,UriKind.Relative);
//此标记值的最大数目。
TokenTagDef.MaxCount=100;
//方向偏移(默认)。
TokenTagDef.OrientationOffsetFromTag=0.0;
//物理偏移(水平英寸、垂直英寸)。
TokenTagDef.PhysicalCenterOffsetFromTag=新向量(0.0,0.0);
//标记移除行为(默认)。
标记TagDef.TagRemovedBehavior=TagRemovedBehavior.Fade;
//将UI定向到标记?(默认)。
TokenTagDef.UsesTagOrientation=true;
//将定义添加到集合中。
MyTagVisualizer.Definitions.Add(TokenTagDef);
}
这是TrainScreen的XAML代码,TrainScreen是一个用户控件,设置为MainWindow的内容

<UserControl x:Class="dtt_app.TrainScreen"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:s="http://schemas.microsoft.com/surface/2008"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <s:TagVisualizer
            Name="MyTagVisualizer" 
            VerticalAlignment="Stretch"
            HorizontalAlignment="Stretch"
            Background="Transparent" 
            Height="Auto" Width="Auto"
            VisualizationAdded="OnVisualizationAdded">

        <Canvas Name="canvas" Width="{Binding ElementName=topWindow, Path=ActualWidth}" Height="{Binding ElementName=topWindow, Path=ActualHeight}">
        <Label Width ="500" Canvas.Top="100" Content="Label" Name="Instruction" FontSize="30" HorizontalContentAlignment="Center"/>
        <Popup Name="Positive" Width="240" Height="200" Placement="MousePoint" AllowsTransparency="True" IsEnabled="True" IsOpen="False">
            <Image Source="images/SmileyFace.png">
            </Image>
        </Popup>
        <Popup Name="Negative" Width="240" Height="200" Placement="MousePoint" IsEnabled="True" AllowsTransparency="True" IsOpen="False">
            <Image Source="images/SadFace.png">
            </Image>
        </Popup>
    </Canvas>
    </s:TagVisualizer>
    </Grid>
</UserControl>


我不知道为什么在桌子上有标记的物体时,任何触摸输入都无法识别。在此方面的任何帮助都将不胜感激。请我已经用尽了一切可能,我真的需要弄清楚这一点,因为时间不多了。提前感谢。

最有可能的问题是,输入是对标记可视化的命中测试(您没有向我们展示相关代码)。请记住,“透明”是经过命中测试的(使用Background=null或ishitestvisible=false使某些内容不通过命中测试)

通过运行输入可视化工具,可以确认这不是硬件/平台问题