小编Yea*_*iam的帖子

XAML vs WPF vs Store App vs Phone App vs UWA

我知道XAML用于与Blend一起设计UI.我对如此多的术语感到困惑,比如,XAML如何为WPF,Store App,Phone App或UWA发挥作用.更重要的是,WPF,Store App,Phone App和UWA之间有什么区别.这是否意味着旧的桌面项目将不再被WPF或Store App或UWA使用和替换?

wpf xaml windows-store-apps

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

System.InvalidOperationException:无法解析 gRPC 通道 URI“http://0”

Visual Studio 2019中使用.NET5 Azure 函数,我从 Program.cs 中收到以下异常:

System.InvalidOperationException:无法解析 gRPC 通道 URI“http://0”

Program.cs的如下:

public static void Main()
{
    var host = new HostBuilder()
            .ConfigureFunctionsWorkerDefaults()
            .ConfigureServices(services =>
            {
                services.AddSingleton<IConfiguration>(data =>
                {
                    var result = new ConfigurationBuilder()
                        .SetBasePath(Directory.GetCurrentDirectory())
                        .AddJsonFile("AppSettings.json", false, true)
                        .AddJsonFile($"AppSettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true)
                        .AddEnvironmentVariables()
                        .Build();
                    return result;
                });

                services.AddSingleton<IServiceProvider, ServiceProvider>();
            })
            .UseDefaultServiceProvider(options => options.ValidateScopes = false)
            .Build();

    host.Run();
}
Run Code Online (Sandbox Code Playgroud)

异常是host.Run()在调试模式下抛出的。有什么线索吗?

azure-functions .net-5

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

Docker Desktop无法切换到Windows Container

我已经安装了最新的 Docker Desktop。目前无法切换到 Windows 容器。该选项在任务栏中被阻止: 该选项已从 Docker Desktop 禁用

我运行的是 Windows 10 家庭版 64 位 Build 19042。

docker windows-10 docker-desktop

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

HttpMessageHandler 清理周期

在我的 .NET5 WebApi 应用程序中,我不断在日志中看到以下内容:

[2022-03-07 13:34:34 DBG] Ending HttpMessageHandler cleanup cycle after 0.0348ms - processed: 0 items - remaining: 2 items
[2022-03-07 13:34:44 DBG] Starting HttpMessageHandler cleanup cycle with 2 items
[2022-03-07 13:34:44 DBG] Ending HttpMessageHandler cleanup cycle after 0.0064ms - processed: 0 items - remaining: 2 items
[2022-03-07 13:34:54 DBG] Starting HttpMessageHandler cleanup cycle with 2 items
[2022-03-07 13:34:54 DBG] Ending HttpMessageHandler cleanup cycle after 0.0031ms - processed: 0 items - remaining: 2 items
[2022-03-07 13:35:04 DBG] Starting HttpMessageHandler …
Run Code Online (Sandbox Code Playgroud)

.net-core asp.net-core-webapi

6
推荐指数
1
解决办法
1676
查看次数

OutputCache 和 MemoryCache 的区别

我的 asp.net mvc 3 应用程序中有一个控制器操作。

我的操作包括数据库获取操作并将结果输出到视图中。我可以使用 OutputCache 操作过滤器属性将操作结果存储到缓存中。我还可以使用 MemoryCache 类来存储数据库获取操作的数据。它们都会显示缓存中的数据。OutputCache会将整个结果存储到缓存中。MemoryCache 类会将数据库获取结果存储到缓存中,并且该操作将从缓存中获取数据,而不是对相同结果发出新的数据库请求。

我的问题是申请哪一个更好?我有一种感觉,OutputCache 操作过滤器属性会很好地工作,因为它将数据库获取结果和操作结果都存储到缓存中。

caching outputcache asp.net-mvc-3 memorycache

5
推荐指数
0
解决办法
1874
查看次数

在sql server中将row_number()转换为int

我有一个查询,我使用row_number()函数.我的查询如下

SELECT ID, 
ROW_NUMBER() over(order by Position desc) Rank
FROM Tbl
Run Code Online (Sandbox Code Playgroud)

问题是Rank正在产生一个bigint值.但我想将其转换为int.我该怎么做?

sql sql-server-2008

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

纯文本文件的幻数

谷歌搜索后,我发现魔术数字可用于识别文件的内容类型.

在我的程序中,我想验证服务器端的文件内容类型.

我的客户端代码:

<form action="/Home/Index" method="post" enctype="multipart/form-data">
    <input type="file" id="inputFile" value="" onchange="readFileContent(this)" />
    <input type="submit" value="Submit" />
</form>

function readFileContent(input) {
        if (input.files && input.files[0]) {

            reader = new FileReader();
            reader.onload = function (e) {

                var xhr = new XMLHttpRequest();
                xhr.open('POST', '/Home/CheckFileType', true);
                xhr.setRequestHeader("Content-Type", "multipart/form-data");
                xhr.setRequestHeader('X-File-Name', input.files[0].name);
                xhr.setRequestHeader('X-File-Type', input.files[0].type);
                xhr.setRequestHeader('X-File-Size', input.files[0].size);
                xhr.send(input.files[0]);
                xhr.onreadystatechange = function () {
                    if (xhr.readyState == 4 && xhr.status == 200) {
                        alert(xhr.responseText);
                    }
                }

            };
            reader.readAsText(input.files[0]);
        }
    }
Run Code Online (Sandbox Code Playgroud)

这是我的服务器端代码:

[HttpPost]
        public JsonResult CheckFileType()
        {
            string …
Run Code Online (Sandbox Code Playgroud)

magic-numbers

4
推荐指数
1
解决办法
4987
查看次数

在XAML UWP中更改底部AppBar的高度

有没有办法降低AppBarXAML UWP 中Bottom的高度?我有以下XAML代码:

<Page.BottomAppBar>
    <CommandBar Height="35">
        <CommandBar.SecondaryCommands>
            <AppBarButton Label="Share"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
        </CommandBar.SecondaryCommands>
    </CommandBar>
</Page.BottomAppBar>
Run Code Online (Sandbox Code Playgroud)

问题是,当我将高度设置为35或低于50时,我会在底部AppBar上方看到一个额外的空白区域.如果我使用黑色或蓝色作为背景颜色,则该空白区域呈现白色

看屏幕截图

xaml uwp uwp-xaml

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

自执行函数和IIFE的区别

We can have immediately invoking function in two ways. I am confused about what is the difference between the following

var foo = function(){
   return { };
}();
Run Code Online (Sandbox Code Playgroud)

and this :

var foo = (function(){
   return { };
}());
Run Code Online (Sandbox Code Playgroud)

javascript iife

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

\n未添加到文本文件中

我想在C#中写入一个文本文件.我的意见如下

string input = "46 47\n 48 49";
Run Code Online (Sandbox Code Playgroud)

我希望这写成如下

46 47

48 49

但它写得像

46 47 48 49

我使用以下代码

string input = "46 47\n 48 49";
string path = @"d:\temp\MyTest.txt";

File.WriteAllText(path, input);
Run Code Online (Sandbox Code Playgroud)

c# io file text-files

0
推荐指数
1
解决办法
47
查看次数

Prism与UWP的兼容性

我最近开始用UWP学习Prism.是否有任何特定的新版Prism可与UWP合作?任何人都可以在Visual Studio 2015中与UWP共享任何Prism教程吗?

prism mvvm win-universal-app

0
推荐指数
1
解决办法
740
查看次数

使用 XElement 按名称获取子元素

我有以下 xml 字符串

<Folder>
        <name></name>
        <Placemark>
            <name></name>
            <description></description>
            <styleUrl></styleUrl>
            <MultiGeometry>
                <Point>
                    <coordinates></coordinates>
                </Point>
                <LineString>
                    <coordinates></coordinates>
                    <tesselate>1</tesselate>
                </LineString>
            </MultiGeometry>
        </Placemark>
</Folder>
Run Code Online (Sandbox Code Playgroud)

使用 XElement,有没有办法从 xml 字符串中提取Point元素而不必遍历它的父节点?(多几何

c# xml linq-to-xml

0
推荐指数
1
解决办法
5364
查看次数