标签: windows-10-universal

某些设备的UWP中的XAML梯度问题

Page在我的应用中使用登陆屏幕.XAML看起来像这样:

<Grid x:Name="LayoutRoot">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="3*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="7*"/>
        </Grid.RowDefinitions>

        <Rectangle StrokeThickness="0" Fill="#FF79D2F4" Margin="0,0,0,-10" Grid.RowSpan="2"/>

        <Rectangle StrokeThickness="0" Fill="#FF1F8CC5" Margin="0,-10,0,0" Grid.Row="2" Grid.RowSpan="2"/>

        <Image Source="ms-appx:///Assets/ViewMedia/Banners/Banner_Light_Big.jpg" Grid.Row="1" Grid.RowSpan="2"/>

        <Rectangle StrokeThickness="0" Grid.Row="2" Grid.RowSpan="2">
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Offset="0"/>
                    <GradientStop Color="#7F000000" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>

    </Grid>

    <StackPanel MaxWidth="300" Margin="20,35"
                HorizontalAlignment="Stretch" VerticalAlignment="Bottom">

        <Button x:Name="LoginButton" x:Uid="LoginButton" Style="{StaticResource BrandButtonStyle}" Margin="0,5"
                Click="LoginButton_Click"/>

        <Button x:Name="RegisterButton" x:Uid="RegisterButton" Style="{StaticResource BrandButtonStyle}" Margin="0,5"
                Click="RegisterButton_Click"/>

    </StackPanel>

</Grid>
Run Code Online (Sandbox Code Playgroud)

我有3个设备在运行应用程序:

  • 微软Lumia 950 XL [ M ]
  • 定制构建PC [ PC ] …

c# xaml win-universal-app windows-10-universal

59
推荐指数
1
解决办法
1274
查看次数

从Xamarin Forms PCL中删除ios,windows8和wp8 - nuget 3.0选择进入错误?

我正在开发一个Xamarin Forms项目.我想针对Android和Windows 10 UWP.

当我尝试通过从PCL目标中删除"Windows 8","Windows Phone Silverlight 8","Windows Phone 8.1","Xamarin.ios"和"Xamarin.ios(经典)"来清理PCL时,我得到了以下令人讨厌......

我真的只是想删除WP8,因为我不关心它的目标.

项目的目标无法更改.所选目标要求项目选择加入NuGet 3.0支持,但是,Visual Studio无法自动为您执行此操作.请卸载所有NuGet包,然后重试.

你如何获得一个选择进入NuGet 3.0的项目?还有什么我应该试试的?

环境:Xamarin Forms,VS2015

在此输入图像描述

谢谢....

nuget xamarin.forms visual-studio-2015 windows-10-universal

50
推荐指数
3
解决办法
1万
查看次数

将设置类添加到UWP应用程序

我正在开发通用Windows平台应用程序,但Visual Studio中没有设置模板.

如何实现一个简单,强类型和可观察的类,将我的设置存储在LocalSettings或RoamingSettings中?

c# settings appsettings win-universal-app windows-10-universal

42
推荐指数
1
解决办法
3275
查看次数

无法加载文件或程序集'Newtonsoft.Json,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'或其依赖项之一

我有一个以前在Windows 8.1上使用VS 2013构建的WinJS项目.

最近我通过创建一个空白的Javascript Universal windows 10项目将该项目升级到Universal Windows 10,然后从旧项目添加了我的所有文件.

我有Windows运行时组件以及SQLite的类库.

我添加了通用Windows运行时组件和通用类库,并将我的所有文件从旧项目复制到各自的位置.

不知何故,我设法删除所有构建错误.

我安装了所有必需的SQLite-net,SQLite for Universal Windows Platform,Newtonsoft等.

但是当我运行应用程序并在Windows运行时组件中调用Native方法时,它会产生一些奇怪的错误:

An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code.

Additional information: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

在此输入图像描述

Newtonsoft版本是:9.0.1

我的Windows运行时组件的project.json文件如下:

  {
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
    "Newtonsoft.Json": "9.0.1"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {}, …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio win-universal-app windows-10 windows-10-universal

27
推荐指数
7
解决办法
10万
查看次数

如何在通用Windows平台中检查Internet连接类型

我想在Windows Universal Application中检查互联网连接类型.

  1. 未连接
  2. 通过WLAN(WiFi)连接
  3. 通过WWAN连接(蜂窝数据)
  4. 连接到计量网络

为了提供下载大尺寸内容的选项.并且还感知重要的网络可用性变化.

目前,我只能检查互联网是否连接使用类的GetIsNetworkAvailable方法NetworkInterface.

NetworkInterface.GetIsNetworkAvailable();
Run Code Online (Sandbox Code Playgroud)

c# win-universal-app windows-10-universal

23
推荐指数
2
解决办法
1万
查看次数

UnhandledErrorDetected:未指定的错误COMException

挣扎着冻结应用程序的错误,只发生在平板电脑上(从不在我的笔记本电脑上).似乎与快速切换汉堡菜单有关.我有一个堆栈跟踪,导致第三方控制,但我得到的10次中的9次是以下.只有一些"异步空白",我无法避免它们(覆盖事件)和其他日志记录,我相信问题出在XAML中(方法是记录进入/退出):

未指定的错误:System.Runtime.InteropServices.COMException(0x80004005):未指定的错误

在Oceaneering.Commons.Utilities.Logger.CoreApplication_UnhandledErrorDetected(Object sender,UnhandledErrorDetectedEventArgs e)上的Windows.ApplicationModel.Core.UnhandledError.Propagate()中出现未指定的错误

设置如下:

CoreApplication.UnhandledErrorDetected += CoreApplication_UnhandledErrorDetected;
Run Code Online (Sandbox Code Playgroud)

接收方法是:

try {               
   e.UnhandledError.Propagate();
}
catch (Exception ex){
   logChannel.LogMessage(string.Format("Unhandled Exception: {0}:{1}", ex.Message, ex.ToString()));
   SaveToFileAsync().Wait();
} 
Run Code Online (Sandbox Code Playgroud)

我可以做些什么来收集更多信息?谢谢!

win-universal-app windows-10-mobile uwp windows-10-universal

23
推荐指数
1
解决办法
684
查看次数

是否需要多个版本的Windows SDK?

我只是浏览我安装的程序以释放一些空间,我注意到有两个版本的Windows SDK和ASP.NET SDK.这些是32位还是64位?包名称并不表示是这种情况,所以我想知道我是否需要安装这些软件包的两个版本?

添加/删除程序截图

正如您在图像中看到的那样,Windows SDK 10.1.10586.15Windows SDK 10.0.26624,ASP.NET RC1 Update 1 1.0.20204.0ASP.NET RC1 Update 1 10.0.11123.0.由于两个软件包都安装在同一天,我假设它们是32位和64位,但我还是假设它们会被命名,如果是这样的话.

这些包用于Visual Studio 2015中的Windows 10 Universal应用程序开发.

visual-studio-2015 windows-10-universal

21
推荐指数
1
解决办法
1万
查看次数

Windows UWP在发现后连接到BLE设备

我正在BluetoothLEAdvertisementWatcher寻找附近的BLE设备并且它运行良好.找到它们后,我想通过GATT连接和读/写数据.但是在获得BluetoothLEAdvertisement(https://msdn.microsoft.com/de-de/library/windows/apps/windows.devices.bluetooth.genericattributeprofile)后我无法弄清楚如何使用API .

public class Adapter
{
    private readonly BluetoothLEAdvertisementWatcher _bleWatcher = new BluetoothLEAdvertisementWatcher();

    public Adapter()
    {
        _bleWatcher.Received += BleWatcherOnReceived;
    }

    private void BleWatcherOnReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
    {       
        // how to connect?
        // I know, it's the wrong place to to this, but this is just an example
    }

    public void StartScanningForDevices(Guid[] serviceUuids)
    {
        _blewatcher.advertisementfilter.advertisement.serviceuuids.clear();
        foreach (var uuid in serviceuuids)
        {
            _blewatcher.advertisementfilter.advertisement.serviceuuids.add(uuid);
        }
        _blewatcher.start();
    }
}
Run Code Online (Sandbox Code Playgroud)

我发现使用的样品DeviceInformation.FindAllAsync代替BluetoothLEAdvertisementWatcher但是这些样品不起作用/找不到任何设备.

UPDATE

经过一段时间的挖掘,我找到了以下方法.但不幸的是,配对失败了.该设备只是一个带有BLE屏蔽的Arduino.我绝对可以与Android和iOS连接.因此必须以某种方式与UWP合作.:/

private void …
Run Code Online (Sandbox Code Playgroud)

c# bluetooth-lowenergy gatt win-universal-app windows-10-universal

19
推荐指数
2
解决办法
2万
查看次数

UWP检查文件是否存在

我目前正在开发Windows 10 UWP应用程序.应用程序需要检查是否存在名为"01-introduction"的某个PDF文件,如果存在则打开它.如果文件不存在,我已经有了代码.以下代码是我目前拥有的:

        try
        {
            var test = await DownloadsFolder.CreateFileAsync("01-Introduction.pdf", CreationCollisionOption.FailIfExists); 
        }
        catch
        {

        }
Run Code Online (Sandbox Code Playgroud)

此代码无法正常工作,因为检查文件是否存在此处,我尝试创建该文件.但是,如果该文件尚不存在,则将创建一个空文件.如果文件不存在,我不想创建任何内容,只要打开PDF就可以.

如果可能的话,我想查看名为"我的手册"的下载文件夹中的文件夹.

任何帮助将不胜感激.

c# pdf win-universal-app windows-10-mobile windows-10-universal

16
推荐指数
3
解决办法
2万
查看次数

如何在UWP/RT XAML中声明系统数据类型?

我正在尝试在UWP上的XAML中访问StaticResource变量的系统命名空间.这是(大部分)我正在使用的:

<Page
    x:Class="App.UWP.Views.Step6"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:System="using:System"
    mc:Ignorable="d">

    <Page.Resources>
        <System:Double x:Key="ItemNameWidth">260</System:Double>
    </Page.Resources>

    <TextBlock FontSize="16" Width="{StaticResource ItemNameWidth}">foo</TextBlock>
</page>
Run Code Online (Sandbox Code Playgroud)

即使<System:Double ...>IntelliSense中的节目有效,我也会遇到以下运行时错误:

类型的异常"Windows.UI.Xaml.Markup.XamlParseException"发生在mscorlib.ni.dll但在用户代码中没有处理

WinRT信息:无法反序列化XBF元数据类型列表,因为在命名空间"System"中找不到"Double".[线:0位置:0]

如果这种方法不起作用,我会对其他声明双重的方式持开放态度.

c# xaml winrt-xaml uwp windows-10-universal

15
推荐指数
1
解决办法
1776
查看次数