|
@@ -0,0 +1,286 @@
|
|
|
+using Microsoft.AppCenter.Analytics;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Security.Policy;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace PDFReader_WPF.Helper
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 埋点辅助类
|
|
|
+ /// TODO:路径追踪埋点
|
|
|
+ /// </summary>
|
|
|
+ public static class DataTrackingHelper
|
|
|
+ {
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 功能入口路径类型
|
|
|
+ /// </summary>
|
|
|
+ public static EventType EntryPathEventType;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 功能入口路径关键字
|
|
|
+ /// </summary>
|
|
|
+ public static EntryPathKeyType EntryPathKey;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 功能入口路径
|
|
|
+ /// </summary>
|
|
|
+ public static string EntryPath = "";
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 是否需要点击后BUYNOW之后清除路径
|
|
|
+ /// </summary>
|
|
|
+ public static bool IsClearEntryPath = false;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 触发埋点事件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="name"></param>
|
|
|
+ /// <param name="properties"></param>
|
|
|
+ public static void SendEvent(string name, IDictionary<string, string> properties = null)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+#if !DEBUG
|
|
|
+ Analytics.TrackEvent(name, properties);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ catch { }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void SendEvent(EventType type, IDictionary<string, string> properties = null)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+#if !DEBUG
|
|
|
+ Analytics.TrackEvent(type.ToString(), properties);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ catch { }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 适用于只上传单个键值的情况
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="type"></param>
|
|
|
+ /// <param name="key"></param>
|
|
|
+ /// <param name="value"></param>
|
|
|
+ public static void SendEvent(EventType type, string key, string value)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+#if !DEBUG
|
|
|
+ Analytics.TrackEvent(type.ToString(), new Dictionary<string, string>() { [key] = value });
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ catch { }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void SetSendInformation(EventType type, EntryPathKeyType key)
|
|
|
+ {
|
|
|
+ IsClearEntryPath = false;
|
|
|
+ EntryPathEventType = type;
|
|
|
+ EntryPathKey = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void SendPurchaseEvent()
|
|
|
+ {
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(EntryPath) && !EntryPath.Contains("None"))
|
|
|
+ {
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+#if !DEBUG
|
|
|
+ Analytics.TrackEvent(EntryPathEventType.ToString(), new Dictionary<string, string>() { [EntryPathKey.ToString()] = EntryPath });
|
|
|
+#endif
|
|
|
+ if (IsClearEntryPath) { EntryPath = ""; }
|
|
|
+ }
|
|
|
+ catch { }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 添加最后路径
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="thirdPath"></param>
|
|
|
+ public static void AddThirdPath(ThirdPath thirdPath = ThirdPath.BuyNow)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(EntryPath) && !EntryPath.Contains("None"))
|
|
|
+ {
|
|
|
+ if (!EntryPath.Contains("_" + thirdPath.ToString()))
|
|
|
+ {
|
|
|
+ EntryPath = EntryPath + "_" + thirdPath.ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新第二个路径
|
|
|
+ /// </summary>
|
|
|
+ public static void UpdateSecondaryPath(SecondaryPath secondaryPath)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(EntryPath)) { EntryPath = EntryPath.Replace(EntryPath.Substring(EntryPath.IndexOf("_") + 1), secondaryPath.ToString()); }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 添加第一个路径和第二个路径
|
|
|
+ /// </summary>
|
|
|
+ public static void AddFirstAndSecondaryPath(FirstPath firstPath, SecondaryPath secondaryPath)
|
|
|
+ {
|
|
|
+ EntryPath = firstPath.ToString() + "_" + secondaryPath.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ public enum EventType
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// ToolBar
|
|
|
+ /// </summary>
|
|
|
+ Tbr,
|
|
|
+ /// <summary>
|
|
|
+ /// SubToolBar
|
|
|
+ /// </summary>
|
|
|
+ SubTbr,
|
|
|
+ /// <summary>
|
|
|
+ /// TopToolBar
|
|
|
+ /// </summary>
|
|
|
+ TopTbr,
|
|
|
+ LeftSideBar,
|
|
|
+ App,
|
|
|
+ ActiveDialog,
|
|
|
+ OnBrd,
|
|
|
+ PDFView,
|
|
|
+ /// <summary>
|
|
|
+ /// Pop Up Window
|
|
|
+ /// </summary>
|
|
|
+ PUW,
|
|
|
+ /// <summary>
|
|
|
+ /// 编辑模块二级菜单埋点
|
|
|
+ /// </summary>
|
|
|
+ SubTbr_Editor,
|
|
|
+ /// <summary>
|
|
|
+ /// 页面编辑子功能埋点
|
|
|
+ /// </summary>
|
|
|
+ SubTbr_PageEdit,
|
|
|
+ /// <summary>
|
|
|
+ /// 工具子功能埋点
|
|
|
+ /// </summary>
|
|
|
+ SubTbr_Tools,
|
|
|
+ /// <summary>
|
|
|
+ /// 编辑子工具点击采购埋点
|
|
|
+ /// </summary>
|
|
|
+ Purchase_Editor,
|
|
|
+ /// <summary>
|
|
|
+ /// 编辑工具子工具点击采购埋点
|
|
|
+ /// </summary>
|
|
|
+ Purchase_Converter,
|
|
|
+ /// <summary>
|
|
|
+ /// 页面编辑子工具点击采购埋点
|
|
|
+ /// </summary>
|
|
|
+ Purchase_PageEdit,
|
|
|
+ /// <summary>
|
|
|
+ /// 编辑PDF子工具点击采购埋点
|
|
|
+ /// </summary>
|
|
|
+ Purchase_EditPDF,
|
|
|
+ /// <summary>
|
|
|
+ /// 标记密文点击采购埋点
|
|
|
+ /// </summary>
|
|
|
+ Purchase_Redact,
|
|
|
+ /// <summary>
|
|
|
+ /// 注释子工具点击采购埋点
|
|
|
+ /// </summary>
|
|
|
+ Purchase_Tools,
|
|
|
+ /// <summary>
|
|
|
+ /// 转档子工具
|
|
|
+ /// </summary>
|
|
|
+ SubTbr_Converter
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public enum EntryPathKeyType
|
|
|
+ {
|
|
|
+ SubTbr_Editor,
|
|
|
+ Onbrd_Converter,
|
|
|
+ SubTbr_Converter,
|
|
|
+ SubTbr_PageEdit,
|
|
|
+ Tbr_EditPDF,
|
|
|
+ Tbr_Redact,
|
|
|
+ Tbr_OCR,
|
|
|
+ SubTbr_Tools,
|
|
|
+ }
|
|
|
+
|
|
|
+ public enum FirstPath
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 阅读页
|
|
|
+ /// </summary>
|
|
|
+ Reading,
|
|
|
+ /// <summary>
|
|
|
+ /// 主页
|
|
|
+ /// </summary>
|
|
|
+ Home
|
|
|
+ }
|
|
|
+
|
|
|
+ public enum SecondaryPath
|
|
|
+ {
|
|
|
+ None,
|
|
|
+ Compress,
|
|
|
+ Merge,
|
|
|
+ BatchEncypy,
|
|
|
+ RemovePassword,
|
|
|
+ AddWatermark,
|
|
|
+ BachAddWatermark,
|
|
|
+ RemoveWatermark,
|
|
|
+ AddBackground,
|
|
|
+ RemoveBackground,
|
|
|
+ AddHeaderFooter,
|
|
|
+ AddBates,
|
|
|
+ ToWord,
|
|
|
+ ToExcel,
|
|
|
+ ToPPT,
|
|
|
+ ToText,
|
|
|
+ ToRTF,
|
|
|
+ ToCSV,
|
|
|
+ ToHtml,
|
|
|
+ ToImage,
|
|
|
+ ConvertPDF,
|
|
|
+ ImagetoPDF,
|
|
|
+ BatchToWord,
|
|
|
+ BatchToExcel,
|
|
|
+ BatchToPPT,
|
|
|
+ BatchToText,
|
|
|
+ BatchToRTF,
|
|
|
+ BatchToCSV,
|
|
|
+ BatchToHtml,
|
|
|
+ BatchToImage,
|
|
|
+ Insert,
|
|
|
+ Rotate,
|
|
|
+ Delete,
|
|
|
+ Extract,
|
|
|
+ EditPDF,
|
|
|
+ Redact,
|
|
|
+ OCR,
|
|
|
+ WebsiteLink,
|
|
|
+ EmailLink,
|
|
|
+ DynamicStamp,
|
|
|
+ CustomStamp,
|
|
|
+ Signature,
|
|
|
+ AddImage
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public enum ThirdPath
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 点击BuyNow按钮
|
|
|
+ /// </summary>
|
|
|
+ BuyNow
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|