wpf - WPF 应用程序的应用程序洞察

标签 wpf visual-studio azure-devops azure-application-insights

有一个用 Visual Studio 编写的 WPF 应用程序。
我可以将 Application Insights 添加到此 WPF 应用程序吗?
我想知道一个按钮/磁贴被点击了多少次。由于有多个安装
对于同一个应用程序,我想知道哪个按钮被哪个用户/安装点击了多少次。这可以通过 Application Insights 完成吗?

谢谢
阿凡提

最佳答案

虽然未列为受支持的应用程序类型,但这意味着没有收集/发送到应用程序洞察力的默认遥测数据,也不支持添加 AI/创建应用程序洞察力资源。话虽如此,可以通过一些手动步骤添加到您的 WPF,以便您可以跟踪您提到的特定场景(如按钮/磁贴点击)。

- 从 Visual Studio 向项目添加“Application Insights API”NuGet(.11 是今天的最新版本)。

这将添加 Application Insights API 引用并为您的项目创建应用程序洞察配置文件。

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

<?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>

要创建应用程序洞察检测 key ,请登录到您的 azure 订阅。
https://portal.azure.com
单击 + 以创建 Application Insights 资源。
然后选择应用程序洞察边栏选项卡上的属性磁贴并复制 Instrumentation key 并将其添加到您的 applicationinsights.config 文件中。
现在,在您的 WPF 应用程序中,您可以使用 Application Insights sdk,如下所述:http://blogs.msdn.com/b/visualstudioalm/archive/2014/10/21/application-insights-sdk-0-11-0-prerelease.aspx

您的事件将显示在诊断搜索 Blade 中,您可以在应用洞察 Blade 上选择该 Blade 。

注意:遥测数据在发送到服务之前会在本地批处理 1 分钟,除非 > 500 个遥测事件在发送时排队。

关于wpf - WPF 应用程序的应用程序洞察,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26505483/

相关文章:

c# - 如何在需要时创建 Prism 的 View 模型?

c# - 无法重命名 Visual Studio 2010 项目

json - 使用 Azure 发布管道在开发、阶段和生产槽上部署期间替换/更新 json 文件的值

Azure DevOps 服务 - CI/CD

azure-devops - VSTS 中的 Copy Files 与 Publish Artifact 任务有什么区别?

wpf - 绑定(bind)到相同数据源的互斥组合框 - MVVM 实现

c# - 提高属性(property)的更好方法改变了 MVVMLight

C# WPF 将系统颜色设置为按钮

c# - 使用 AND 关键字从我的数据库中删除一行

c - 释放分配的内存会导致程序卡在 Visual Studio 中,但不会卡在 CodeBlocks 中