Esempio n. 1
0
        /// <summary>
        /// Returns true/false depending on wether the user has enabled telemetry.
        /// </summary>
        /// <returns></returns>
        public static bool GetTelemetrySettings( )
        {
            LocalContext.Init();
            var settings = Database.Query <TelemetrySettings>("SELECT * FROM TelemetrySettings").FirstOrDefault();

            if (settings != null)
            {
                return(settings.Enabled);
            }
            else
            {
                var ts = new TelemetrySettings();
                Database.Insert(ts);
                return(true); // defaults to true
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Enables or disables telemetry.
        /// </summary>
        /// <param name="status"></param>
        public static void SetTelemetrySettings(bool status)
        {
            LocalContext.Init();
            var settings = Database.Query <TelemetrySettings>("SELECT * FROM TelemetrySettings").FirstOrDefault();

            if (settings != null)
            {
                settings.Enabled = status;
                Database.Update(settings);
            }
            else
            {
                var ts = new TelemetrySettings();
                ts.Enabled = status;
                Database.Insert(ts);
            }
        }