小编Lot*_*i11的帖子

Surface 2.0 SDK仍在使用吗?

我正在尝试制作一个将在MS Surface平板电脑上使用并尝试在VS 2015上创建Surface项目的应用程序.当我发现Surface项目不是VS 2015中已安装模板的一部分时,我试图下载SDK只是为了发现它需要VS 2010才能使用它.在注意到这一点之后,我开始认为不再使用Surface 2.0 SDK,但我想在开始寻找替代方案之前确保.如果是这种情况,可以使用哪些其他类型的模板为MS Surface平板电脑创建应用程序?

c# visual-studio pixelsense

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

UWP MediaCapture拒绝访问相机

我正在尝试制作一个允许我拉出相机的项目,但我被告知每次程序运行时我都被拒绝访问相机.我从以下链接https://msdn.microsoft.com/en-us/library/windows/apps/mt243896.aspx阅读教程并对代码进行了一些小的更改,但更改不应影响结果

    private MediaCapture _mediaCapture;
    private bool _isInitialized;

  private async Task InitializeCameraAsync()
    {
        if (_mediaCapture == null)
        {
            // Get available devices for capturing pictures
            var allVideoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

            // Get the desired camera by panel
            DeviceInformation cameraDevice =
                allVideoDevices.FirstOrDefault(x => x.EnclosureLocation != null &&
                x.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Back);

            // If there is no camera on the specified panel, get any camera
            cameraDevice = cameraDevice ?? allVideoDevices.FirstOrDefault();

            if (cameraDevice == null)
            {
                Debug.WriteLine("No camera device found.");
                return;
            }

            // …
Run Code Online (Sandbox Code Playgroud)

c# windows-8.1-universal

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

Application Insights 的日志未写入跟踪日志

我按照此页面Application Insights 说明将 Application Insights (AI) 添加到我的 Web API 服务。我设法让我的服务连接到人工智能,并且我能够看到我的服务何时执行发布、获取等。我还通过我的服务发出了日志调用,但它们都没有写入我的人工智能的跟踪日志。

痕迹日志

我确保设置 Startup.cs 和 appsettings.json 文件以包含在整个服务中运行 AI 所需的新代码,并且日志数据需要让 AI 抓取日志进行调试和启动。

启动.cs

public void ConfigureServices(IServiceCollection services)
{         
    services.AddApplicationInsightsTelemetry();
}
Run Code Online (Sandbox Code Playgroud)

应用程序设置.json

应用程序设置.json

记录示例

public async Task ProcessQueueAsync(dBData dbContext)
{
    // _logger is of type ILogger<[INSERT CLASS NAME]>
    _logger.LogDebug("This is a test log by Lotzi11.");
    await ProcessQueueAsyncSingle(dbContext, CancellationToken.None);
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮我弄清楚为什么我的日志没有发送到人工智能吗?

c# serilog azure-application-insights asp.net-core-webapi

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

Get-ChildItem.Length是错误的

我正在编写一个遍历目录的递归函数,并复制其中的每个文件和文件夹.我在函数中的第一个检查是查看传入的路径是否有子节点.为了找到这个,我使用以下方法:

[array]$arrExclude = @("Extras")
Function USBCopy
{
Param ([string]$strPath, [string]$strDestinationPath)
    try
    {
        $pathChildren = Get-ChildItem -Path $strPath
        if($pathChildren.Length -gt 0)
        {
            foreach($child in $pathChildren)
            {
                if($arrExclude -notcontains $child)
                {
                    $strPathChild = "$strPath\$child"
                    $strDestinationPathChild = "$strDestinationPath\$child" 
                    Copy-Item $strPathChild -Destination $strDestinationPathChild
                    USBCopy $strPathChild $strDestinationPathChild  
                }   
            }
        }              
    }
    catch
    {
        Write-Error ("Error running USBCopy: " + $Error[0].Exception.Message)
    }    
}
Run Code Online (Sandbox Code Playgroud)

在大多数情况下,我的函数可以工作,但我的代码会说当一个目录实际上有一个文件时它是空的.当我调试我的函数时,变量会说该文件夹有子项但变量的长度为0.任何人都知道如何解决这个问题?

arrays powershell member-enumeration

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