WPF 应用程序的应用程序洞察 [英] Application Insights for WPF Application

查看:31
本文介绍了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 参考并为您的项目创建一个应用程序洞察配置文件.

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,如下所述:http://blogs.msdn.com/b/visualstudioalm/archive/2014/10/21/application-insights-sdk-0-11-0-prerelease.aspx

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天全站免登陆