WPF应用程序的应用程序见解 [英] Application Insights for WPF Application

查看:97
本文介绍了WPF应用程序的应用程序见解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个用Visual Studio编写的WPF应用程序. 我可以将Application Insights添加到此WPF应用程序吗? 我想知道按钮/平铺块被单击了多少次.由于有多个安装 对于同一应用程序,我想知道从哪个用户/安装中单击了哪个按钮几次.可以使用Application Insights完成此操作吗?

There is a WPF application written in Visual Studio. Can I add Application Insights to this WPF app? I would like to know how many times a button/tile is clicked. Since there are multiple installations of the same application, I would like to know which button was clicked how many times from which user/installation. Can this be done with Application Insights?

谢谢 阿凡提

推荐答案

虽然未列为受支持的应用程序类型,但这意味着不收集/发送给应用程序见解的默认遥测数据,也不支持添加AI/创建应用程序见解资源.话虽这么说,但可以通过一些手动步骤将其添加到WPF中,以便您可以跟踪提到的特定方案(例如按钮/平铺式点击).

While not listed as a supported app type this means there isn't default telemetry data collected/sent to application insights nor is there support for adding AI/creating an application insights resource. That being said it is possible to add to your WPF with a few manual steps so that you can track the specific scenarios you mention (like a button/tile click).

-在Visual Studio中,将"Application Insights API" NuGet添加到项目中(.11是今天的最新版本).

-From Visual studio add the "Application Insights API" NuGet to the project (.11 is the latest today).

这将添加Application Insights API参考,并为您的项目创建一个Application Insights配置文件.

This will add the Application Insights API reference and create an application insights configuration file to your project.

需要使用您的检测密钥更新applicationinsights.config文件,如下所示:

The applicationinsights.config file needs to be updated with your instrumentation key as follows:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
    <TelemetryChannel>
        <DeveloperMode>false</DeveloperMode>
    </TelemetryChannel>
    <TelemetryModules>
        <Add Type="Microsoft.ApplicationInsights.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights"/>
    </TelemetryModules>
    <InstrumentationKey>**your-instrumentation-key-guid**</InstrumentationKey>
</ApplicationInsights>

要创建应用程序见解检测键,请登录到Azure订阅. https://portal.azure.com 单击+创建一个Application Insights资源. 然后,在应用程序见解刀片上选择属性磁贴,并复制"Instrumentation"键并将其添加到applicationinsights.config文件中. 现在,在WPF应用中,您可以按以下说明使用Application Insights sdk:

To create an application insights instrumentation key login to your azure subscription. https://portal.azure.com Click + to create an Application Insights resource. Then choose the properties tile on the application insights blade and copy the Instrumentation key and add it to your applicationinsights.config file. Now in your WPF app you can use the Application Insights sdk as described here: http://blogs.msdn.com/b/visualstudioalm/archive/2014/10/21/application-insights-sdk-0-11-0-prerelease.aspx

您的事件将显示在诊断搜索刀片中,可以在应用程序见解刀片中选择它.

your events will be visible in the diagnostic search blade which can be selected on the application insights blade.

注意:遥测在发送到服务之前会在本地进行1分钟的批处理,除非在发送它们的那一刻排队有500多个遥测事件.

Note: telemetry is batched locally for 1 min before being sent to the service unless > 500 telemetry events are queued at which point they are sent.

这篇关于WPF应用程序的应用程序见解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆