Пример #1
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();
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
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);
            }
        }
Пример #4
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);
                }
            });
        }
Пример #5
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);
                }
            });
        }