/// <summary>
        /// Tracks a feature use.
        /// </summary>
        /// <param name="featureName">Name of the feature</param>
        /// <param name="activationMethod">Method used to 'activate' the feature (e.g. Menu, Toolbar, Shortcut, etc.)</param>
        /// <returns>Object that can be used to 'end' the feature use, if measuring time spans is desired.</returns>
        public static IAnalyticsMonitorTrackedFeature TrackFeature(string featureName, string activationMethod)
        {
            if (featureName == null)
            {
                throw new ArgumentNullException("featureName");
            }

            if (activationMethod != null)
            {
                LoggingService.Debug("Activated feature '" + featureName + "', activation=" + activationMethod);
            }
            else
            {
                LoggingService.Debug("Activated feature '" + featureName + "'");
            }

            IAnalyticsMonitor monitor = ServiceManager.Instance.GetService <IAnalyticsMonitor>();

            if (monitor != null)
            {
                return(monitor.TrackFeature(featureName, activationMethod) ?? DummyFeature.Instance);
            }
            else
            {
                return(DummyFeature.Instance);
            }
        }
 public void FactoryCreateMonitor(string options)
 {
     const string caller = "Factory.CreateMonitor";
       var callbackId = CurrentCommandCallbackId;
       Task.Run(() =>
       {
     try
     {
       var args = ParseOptions(options);
       var productId = args[0];
       var version = args[1];
       if (!ValidateMonitorCreateParameters(callbackId, caller, productId, version))
     return;
       if (_monitor != null && _monitor.Status.IsStarted)
     _monitor.Stop();
       if (string.IsNullOrWhiteSpace(version))
     _monitor = AnalyticsMonitorFactory.CreateMonitor(productId);
       else
       {
     var settings = AnalyticsMonitorFactory.CreateSettings(productId);
     settings.Version = new Version(version);
     _monitor = AnalyticsMonitorFactory.CreateMonitor(settings);
       }
       SendResult(callbackId, PluginResult.Status.OK);
     }
     catch (Exception ex)
     {
       SendResultError(callbackId, caller, ex);
     }
       });
 }
Exemple #3
0
 private void StopAnalyticsIfNotNull(IAnalyticsMonitor monitor)
 {
     if (monitor != null)
     {
         monitor.Stop();
     }
 }
		/// <summary>
		/// Tracks an exception that has occurred.
		/// </summary>
		public static void TrackException(Exception exception)
		{
			if (exception == null)
				throw new ArgumentNullException("exception");
			IAnalyticsMonitor monitor = ServiceManager.Instance.GetService<IAnalyticsMonitor>();
			if (monitor != null) {
				monitor.TrackException(exception);
			}
		}
Exemple #5
0
        protected override void OnInit()
        {
            IAnalyticsMonitorSettings settings = AnalyticsMonitorFactory.CreateSettings("72aa4ef2c6214b289e0ae1b011481220");

            settings.Version = this.EditorInfo.Version;
            this.monitor     = AnalyticsMonitorFactory.CreateMonitor(settings);
            this.monitor.Start();
            EventCache.Instance.FeatureInfoUsed += new System.Action <FeatureInfo>(this.EventCache_FeatureInfoUsed);
            this.SendStartWay();
            this.InitUnhandledException();
        }
 public static void Stop()
 {
     if (monitor != null)
     {
         try
         {
             monitor.Stop();
             monitor.Dispose();
         }
         catch
         {
         }
         monitor = null;
     }
 }
        public static void TryInitializeMonitor()
        {
            if (monitor != null || AnalyticsConfiguration.IsAnalyticsDisabledInRegistry || !ConfigurationManager.AppSettings.Keys.OfType<string>().Contains(EqatecProductKey))
            {
                return;
            }

            string productKey = ConfigurationManager.AppSettings[EqatecProductKey];
            if (!string.IsNullOrEmpty(productKey))
            {
                IAnalyticsMonitorSettings settings = AnalyticsMonitorFactory.CreateSettings(productKey);
                monitor = AnalyticsMonitorFactory.CreateMonitor(settings);
                monitor.Start();
            }
        }
        public static void Start()
        {
            Stop();

            if (TranslateOptions.Instance.AskedEQATECMonitor && TranslateOptions.Instance.UseEQATECMonitor)
            {
                try
                {
                    monitor = AnalyticsMonitorFactory.Create(productID);
                    monitor.Start();
                }
                catch (Exception e)
                {
                    Application.OnThreadException(e);
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            CloudProvider.Init(new EverliveProviderSettings()
            {
                UseHttps = ConnectionSettings.EverliveUseHttps, ApiKey = ConnectionSettings.TelerikAppId, UserType = typeof(CustomUser)
            });

            // Analytics initialization
            if (ConnectionSettings.AnalyticsProjectKey != "your-analytics-project-key-here" || String.IsNullOrEmpty(ConnectionSettings.AnalyticsProjectKey))
            {
                Analytics = AnalyticsMonitorFactory.CreateMonitor(ConnectionSettings.AnalyticsProjectKey);
            }
        }
		public JustMockEqatecAnalyticsTracker(AnalyticsAccountType accountType)
		{
			var productKey = "";

			if (AnalyticsConfiguration.AccountType == AnalyticsAccountType.JustMockTesting)
			{
				productKey = JustMockTestingKey;
			}
			else
			{
				productKey = accountType == AnalyticsAccountType.JustMockApi ? JustMockApiKey : JustMockPackageKey;
			}

			var settings = AnalyticsMonitorFactory.CreateSettings(productKey);
			settings.SynchronizeAutomatically = true;

			monitor = AnalyticsMonitorFactory.CreateMonitor(settings);
			monitor.SetInstallationInfo(InstallationId);
		}
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
           
            CloudProvider.Init(new EverliveProviderSettings() { UseHttps = ConnectionSettings.EverliveUseHttps, AppId = ConnectionSettings.TelerikAppId, UserType = typeof(CustomUser) });
           
            // Analytics initialization
            if (ConnectionSettings.AnalyticsProjectKey != "your-analytics-project-key-here" || String.IsNullOrEmpty(ConnectionSettings.AnalyticsProjectKey))
            {
                Analytics = AnalyticsMonitorFactory.CreateMonitor(ConnectionSettings.AnalyticsProjectKey);
            }
        }
Exemple #12
0
        public void FactoryCreateMonitor(string options)
        {
            const string caller     = "Factory.CreateMonitor";
            var          callbackId = CurrentCommandCallbackId;

            Task.Run(() =>
            {
                try
                {
                    var args      = ParseOptions(options);
                    var productId = args[0];
                    var version   = args[1];
                    if (!ValidateMonitorCreateParameters(callbackId, caller, productId, version))
                    {
                        return;
                    }
                    if (_monitor != null && _monitor.Status.IsStarted)
                    {
                        _monitor.Stop();
                    }
                    if (string.IsNullOrWhiteSpace(version))
                    {
                        _monitor = AnalyticsMonitorFactory.CreateMonitor(productId);
                    }
                    else
                    {
                        var settings     = AnalyticsMonitorFactory.CreateSettings(productId);
                        settings.Version = new Version(version);
                        _monitor         = AnalyticsMonitorFactory.CreateMonitor(settings);
                    }
                    SendResult(callbackId, PluginResult.Status.OK);
                }
                catch (Exception ex)
                {
                    SendResultError(callbackId, caller, ex);
                }
            });
        }
Exemple #13
0
        public void FactoryCreateMonitorWithSettings(string options)
        {
            const string caller     = "Factory.CreateMonitorWithSettings";
            var          callbackId = CurrentCommandCallbackId;

            Task.Run(() =>
            {
                try
                {
                    var args         = ParseOptions(options);
                    var settings     = JsonHelper.Deserialize <JsonObjSettings>(args[0]);
                    string productId = settings.ProductId;
                    string version   = settings.Version;
                    if (!ValidateMonitorCreateParameters(callbackId, caller, productId, version))
                    {
                        return;
                    }
                    var s = AnalyticsMonitorFactory.CreateSettings(productId);
                    if (!string.IsNullOrWhiteSpace(version))
                    {
                        s.Version = Version.Parse(version);
                    }
                    if (settings.LocationCoordinates != null)
                    {
                        var coord            = settings.LocationCoordinates;
                        s.Location.Latitude  = coord.Latitude;
                        s.Location.Longitude = coord.Longitude;
                    }
                    s.DailyNetworkUtilizationInKB = settings.DailyNetworkUtilizationInKB;
                    if (settings.LoggingInterface != null)
                    {
                        // Observe logging ourselves and relay to user-provider logger upon receiving logs
                        s.LoggingInterface = this;
                    }
                    s.MaxStorageSizeInKB = settings.MaxStorageSizeInKB;
                    if (settings.ServerUri != null)
                    {
                        s.ServerUri = new Uri(settings.ServerUri);
                    }
                    s.StorageSaveInterval      = TimeSpan.FromSeconds(settings.StorageSaveInterval);
                    s.SynchronizeAutomatically = settings.SynchronizeAutomatically;
                    s.TestMode = settings.TestMode;
                    s.UseSSL   = settings.UseSsl;
                    if (settings.ProxyConfig != null)
                    {
                        // HttpWebRequest's proxy not yet supported on Windows Phone. See eg
                        // http://stackoverflow.com/questions/6976087/httpwebrequest-proxy-in-windows-phone-7
                        LogMessage("ProxyConfig is not supported on Windows Phone");
                    }
                    if (_monitor != null && _monitor.Status.IsStarted)
                    {
                        _monitor.Stop();
                    }
                    _monitor = AnalyticsMonitorFactory.CreateMonitor(s);
                    SendResult(callbackId, PluginResult.Status.OK);
                }
                catch (Exception ex)
                {
                    SendResultError(callbackId, caller, ex);
                }
            });
        }
 public void FactoryCreateMonitorWithSettings(string options)
 {
     const string caller = "Factory.CreateMonitorWithSettings";
       var callbackId = CurrentCommandCallbackId;
       Task.Run(() =>
       {
     try
     {
       var args = ParseOptions(options);
       var settings = JsonHelper.Deserialize<JsonObjSettings>(args[0]);
       string productId = settings.ProductId;
       string version = settings.Version;
       if (!ValidateMonitorCreateParameters(callbackId, caller, productId, version))
     return;
       var s = AnalyticsMonitorFactory.CreateSettings(productId);
       if (!string.IsNullOrWhiteSpace(version))
     s.Version = Version.Parse(version);
       if (settings.LocationCoordinates != null)
       {
     var coord = settings.LocationCoordinates;
     s.Location.Latitude = coord.Latitude;
     s.Location.Longitude = coord.Longitude;
       }
       s.DailyNetworkUtilizationInKB = settings.DailyNetworkUtilizationInKB;
       if (settings.LoggingInterface != null)
       {
     // Observe logging ourselves and relay to user-provider logger upon receiving logs
     s.LoggingInterface = this;
       }
       s.MaxStorageSizeInKB = settings.MaxStorageSizeInKB;
       if (settings.ServerUri != null)
       {
     s.ServerUri = new Uri(settings.ServerUri);
       }
       s.StorageSaveInterval = TimeSpan.FromSeconds(settings.StorageSaveInterval);
       s.SynchronizeAutomatically = settings.SynchronizeAutomatically;
       s.TestMode = settings.TestMode;
       s.UseSSL = settings.UseSsl;
       if (settings.ProxyConfig != null)
       {
     // HttpWebRequest's proxy not yet supported on Windows Phone. See eg
     // http://stackoverflow.com/questions/6976087/httpwebrequest-proxy-in-windows-phone-7
     LogMessage("ProxyConfig is not supported on Windows Phone");
       }
       if (_monitor != null && _monitor.Status.IsStarted)
     _monitor.Stop();
       _monitor = AnalyticsMonitorFactory.CreateMonitor(s);
       SendResult(callbackId, PluginResult.Status.OK);
     }
     catch (Exception ex)
     {
       SendResultError(callbackId, caller, ex);
     }
       });
 }
 private void StopAnalyticsIfNotNull(IAnalyticsMonitor monitor)
 {
     if (monitor != null)
     {
         monitor.Stop();
     }
 }
		private static void TryInitializeMonitor()
		{
			if (!ConfigurationManager.AppSettings.Keys.OfType<string>().Contains(EqatecProductKey))
			{
				return;
			}

			if (!isTrackingEnabled)
			{
				throw new InvalidOperationException("TryInitializeMonitor cannot be called when isTrackingEnabled is false. Set Instance.IsTrackingEnabled to true first.");
			}

			if (monitor != null)
			{
				return;
			}

			string productKey = ConfigurationManager.AppSettings[EqatecProductKey];
			if (!string.IsNullOrEmpty(productKey))
			{
				AnalyticsMonitorSettings settings = new AnalyticsMonitorSettings(productKey);
				monitor = AnalyticsMonitorFactory.Create(settings);
				monitor.Start();
			}
		}