Obtain system information not conveniently exposed by WinRT APIs.
Microsoft doesn't really want you getting this information and makes it difficult. The techniques used here are not bullet proof but are good enough for analytics. Do not use these methods or techniques for anything more important than that.
Пример #1
0
        /// <summary>
        /// Initialize CSharpAnalytics by restoring the session state and starting the background sender and tracking
        /// the application lifecycle start event.
        /// </summary>
        /// <param name="configuration">Configuration to use, must at a minimum specify your Google Analytics ID and app name.</param>
        /// <param name="launchArgs">Launch arguments from your Application OnLaunched to determine how the app was launched.</param>
        /// <param name="uploadInterval">How often to upload to the server. Lower times = more traffic but realtime. Defaults to 5 seconds.</param>
        /// <example>var analyticsTask = AutoMeasurement.StartAsync(new MeasurementConfiguration("UA-123123123-1", "MyApp", "1.0.0.0"));</example>
        public static async Task StartAsync(MeasurementConfiguration configuration, IActivatedEventArgs launchArgs, TimeSpan?uploadInterval = null)
        {
            if (!isStarted)
            {
                isStarted          = true;
                lastUploadInterval = uploadInterval ?? TimeSpan.FromSeconds(5);
                systemUserAgent    = await WindowsStoreSystemInformation.GetSystemUserAgent();
                await StartRequesterAsync();

                var sessionState = await LoadSessionState();

                sessionManager = new SessionManager(sessionState, configuration.SampleRate);
                if (delayedOptOut != null)
                {
                    SetOptOut(delayedOptOut.Value);
                }

                Client.Configure(configuration, sessionManager, new WindowsStoreEnvironment(), Add);
                HookEvents();
            }

            Client.TrackEvent("Start", ApplicationLifecycleEvent, launchArgs.Kind.ToString());
        }