コード例 #1
0
ファイル: Tracker.cs プロジェクト: spdwhat/HearthstoneTracker
        static Tracker()
        {
            Version         = Assembly.GetEntryAssembly().GetName().Version;
            ExtraParameters = new Dictionary <string, string>();
            ExtraParameters[BeaconParameter.Browser.ScreenResolution] = String.Format(
                "{0}x{1}",
                System.Windows.SystemParameters.PrimaryScreenWidth,
                System.Windows.SystemParameters.PrimaryScreenHeight);
            ExtraParameters[BeaconParameter.Browser.ScreenColorDepth] = String.Format(
                "{0}-bit",
                Screen.PrimaryScreen.BitsPerPixel);

            var osPlatform      = Environment.OSVersion.Platform.ToString();
            var osVersion       = Environment.OSVersion.Version.ToString();
            var osVersionString = Environment.OSVersion.VersionString;

            UserAgent = String.Format("{0}/{1} ({2}; {3}; {4})", "HearthstoneTracker", Version, osPlatform, osVersion, osVersionString);
            instance  = new HsTracker("UA-46945463-6", "app.hearthstonetracker.com")
            {
                UseSsl        = false,
                UserAgent     = UserAgent,
                ThrowOnErrors = false,
                Language      = CultureInfo.InstalledUICulture.Name
            };

            using (var reg = new AnalyticsRegistrySettings())
            {
                // note: use field here
                isEnabled = reg.ShareUsageStatistics;
            }
        }
コード例 #2
0
        static Tracker()
        {
            Version = Assembly.GetEntryAssembly().GetName().Version;
            ExtraParameters = new Dictionary<string, string>();
            ExtraParameters[BeaconParameter.Browser.ScreenResolution] = String.Format(
                    "{0}x{1}",
                    System.Windows.SystemParameters.PrimaryScreenWidth,
                    System.Windows.SystemParameters.PrimaryScreenHeight);
            ExtraParameters[BeaconParameter.Browser.ScreenColorDepth] = String.Format(
                    "{0}-bit",
                    Screen.PrimaryScreen.BitsPerPixel);

            var osPlatform = Environment.OSVersion.Platform.ToString();
            var osVersion = Environment.OSVersion.Version.ToString();
            var osVersionString = Environment.OSVersion.VersionString;
            UserAgent = String.Format("{0}/{1} ({2}; {3}; {4})", "HearthstoneTracker", Version, osPlatform, osVersion, osVersionString);
            instance = new HsTracker("UA-46945463-6", "app.hearthstonetracker.com")
            {
                UseSsl = false,
                UserAgent = UserAgent,
                ThrowOnErrors = false,
                Language = CultureInfo.InstalledUICulture.Name
            };

            using (var reg = new AnalyticsRegistrySettings())
            {
                // note: use field here
                isEnabled = reg.ShareUsageStatistics;
            }
        }