protected override void OnExit(ExitEventArgs e) { // let counter save current state YandexMetrica.ReportExit(); base.OnExit(e); }
public MainForm() { InitializeComponent(); YandexMetricaFolder.SetCurrent(""); YandexMetrica.Activate("eafbf946-7082-4f83-aef3-6e99c1911a62"); AppDomain.CurrentDomain.UnhandledException += Application_ThreadException; }
public static void InsertStatistic(string appName, string plugin, string command, string version, string doc) { Task.Run(() => { try { var db = new PluginStatisticDbContext(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.AutoDetectChangesEnabled = false; db.Configuration.ValidateOnSaveEnabled = false; db.C_PluginStatistics.Add(new C_PluginStatistic { Application = appName, Plugin = plugin ?? string.Empty, Command = command ?? string.Empty, Build = version.Truncate(40) ?? string.Empty, Doc = doc.Truncate(500) ?? string.Empty, UserName = Environment.UserName, DateStart = DateTime.Now, DocName = Path.GetFileName(doc) }); db.SaveChanges(); } catch (Exception ex) { Logger.Log.Error(ex, $"PluginStatisticsHelper Insert. appName={appName}, plugin={plugin}, command={command}, version={version}, doc={doc}, docName={Path.GetFileName(doc)}"); } if (!appName.EndsWith(" Run") && !appName.EndsWith(" Update")) { YandexMetrica.ReportEvent($"{plugin} {command}"); } }); }
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { var logService = Container.Resolve <ILogService>(); logService.LogException(e.Exception); #if !DEBUG YandexMetrica.ReportUnhandledException(e.Exception); #endif var locService = Container.Resolve <ILocService>(); var notificationsService = Container.Resolve <IAppNotificationsService>(); notificationsService.SendNotification(new AppNotification { Title = locService["AppNotifications_FatalError_Title"], Content = locService["AppNotifications_TouchToInfo_Content"], Type = AppNotificationType.Error, DestinationView = "ErrorView", NavigationParameter = e.Message, IsImportant = true }); } catch { } e.Handled = true; }
public MainPage() { Location = new YandexMetrica.Location(); InitializeComponent(); Loaded += (sender, args) => YandexMetrica.ReportEvent("Hello!"); Unloaded += (sender, args) => YandexMetrica.ReportEvent("Bye!"); LocationButton.Click += (sender, args) => YandexMetricaConfig.SetCustomLocation(Location); EventButton.Click += (sender, args) => YandexMetrica.ReportEvent(EventNameTextBox.Text); CrashButton.Click += (sender, args) => { throw new Exception(); }; ErrorButton.Click += (sender, args) => { try { throw new ArgumentException("Throw exception and catch it"); } catch (Exception exception) { YandexMetrica.ReportError(ErrorNameTextBox.Text, exception); } }; ResetButton.Click += (sender, args) => { YandexMetricaConfig.OfflineMode = false; YandexMetricaConfig.CrashTracking = true; YandexMetricaConfig.LocationTracking = true; YandexMetricaConfig.CustomAppVersion = null; YandexMetricaConfig.SetCustomLocation(null); }; JsonButton.Click += (sender, args) => YandexMetrica.ReportEvent("abc", JsonData.GetObject()); JsonButton.Click += (sender, args) => YandexMetrica.ReportEvent("abc", JsonData.GetDictionary()); }
private void LogItem(LoggedItem item) { try { lock (Sync) { if (!Initialized) { LoggedItems.Add(item); return; } } if (item is LoggedEvent) { var loggedEvent = (LoggedEvent)item; YandexMetrica.ReportEvent(loggedEvent.Title, loggedEvent.Values); } else if (item is LoggedException) { var loggedException = (LoggedException)item; YandexMetrica.ReportError(loggedException.Message, loggedException.Exception); } } catch (Exception) { } }
private void Application_ThreadException(object sender, UnhandledExceptionEventArgs e) { Exception ex = (Exception)e.ExceptionObject; YandexMetrica.ReportError(ex.Message, ex); MessageBox.Show(ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private static void Report(User.User user, string eventName) { YandexMetrica.ReportEvent(eventName, new Dictionary <string, string> { { "user", user.Info.UserId.ToString() }, { "userIntent", Utils.CurrentIntent(user) } }); }
public static void TrackEvent(string eventName, Dictionary <string, object> parameters = null) { string jsonData = parameters != null?JsonConvert.SerializeObject(parameters) : null; YandexMetrica.ReportEvent(eventName, jsonData); Logger.Info("Analytics: " + eventName + " data: " + jsonData); }
static Events() { var metrika = Configuration.Config.GetSection("metrika"); YandexMetricaFolder.SetCurrent(metrika.GetValue <string>("folder")); YandexMetrica.Config.CrashTracking = true; YandexMetrica.Activate(metrika.GetValue <string>("token")); }
public static void Log(Exception ex) { Debug.WriteLine(ex); _logger.Error(ex); YandexMetrica.ReportError("Exception", ex); }
public static void Activate(YandexMetricaConfig config) { YMMYandexMetrica.ActivateWithConfiguration(config.ToIOSAppMetricaConfig()); YandexMetrica.RegisterImplementation(new YandexMetricaImplementation()); YandexMetricaAttributeImplementation.Init(); UpdateConfiguration(config); }
public static void AppStart() { //may cause problems with restoring YandexMetrica.Activate("2a556755-72e7-450d-9bab-c3eb179ec300"); #if DEBUG _logger.Info("App started"); #endif }
public static void Activate(Context context, YandexMetricaConfig config, Application app = null) { Com.Yandex.Metrica.YandexMetrica.Activate(context, config.ToAndroidMetricaConfig()); EnableActivityAutoTracking(app); YandexMetrica.RegisterImplementation(new YandexMetricaImplementation()); YandexMetricaAttributeImplementation.Init(); UpdateConfiguration(config); }
public MainPage() { InitializeComponent(); YandexMetrica.ReportEvent("MainPage Ctor"); Loaded += OnLoaded; Unloaded += OnUnloaded; }
public void LogException(Exception ex) { #if !DEBUG try { YandexMetrica.ReportError(ex.Message, ex); } catch (Exception) { } #endif }
public void LogEvent(string eventName, string json) { #if !DEBUG try { YandexMetrica.ReportEvent(eventName, json); } catch (Exception) { } #endif }
public static void Fatal(Exception ex, string message) { Debug.WriteLine("Fatal error: " + message + "\r\n" + ex); YandexMetrica.ReportUnhandledException(ex); Telemetry.TrackException(ex); #if DEBUG _logger.Fatal(message, ex); #endif }
public static void Fatal(Exception ex, string message) { Debug.WriteLine("Fatal error: " + message + "\r\n" + ex); YandexMetrica.ReportUnhandledException(ex); HockeyClient.Current.TrackException(ex); _logger.Fatal(message, ex); }
public static void Log(string msg) { try { YandexMetrica.ReportEvent(msg); } catch { } }
public static void Error(Exception ex, string message = null) { Debug.WriteLine(message + "\r\n" + ex); YandexMetrica.ReportError(message, ex); Telemetry.TrackException(ex); #if DEBUG _logger.Error(message + ex, ex); #endif }
static void Main() { YandexMetrica.Activate(ApiKey); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); // let counter save current state YandexMetrica.ReportExit(); }
private static void YandexReport(string msg, Exception ex) { try { YandexMetrica.ReportError(msg, ex); } catch (Exception e) { AutoCAD_PIK_Manager.Log.Error(e, "YandexReport"); } }
private void OnError(object sender, RoutedEventArgs e) { try { throw new ArgumentException("Throw exception and catch it'"); } catch (Exception ex) { YandexMetrica.ReportError("Main button error", ex); } }
/// <summary> /// Agent that runs a scheduled task /// </summary> /// <param name="task"> /// The invoked task /// </param> /// <remarks> /// This method is called when a periodic or resource intensive task is invoked /// </remarks> protected override void OnInvoke(ScheduledTask task) { //TODO: Add code to perform your task in background //TODO: https://tech.yandex.com/metrica-mobile-sdk/doc/mobile-sdk-dg/tasks/winphone-quickstart-docpage/--> YandexMetrica.Config.LocationTracking = false; YandexMetrica.Activate("Yours Api Key"); YandexMetrica.ReportEvent("Hello from background!"); YandexMetrica.Snapshot(); NotifyComplete(); }
public void Run(IBackgroundTaskInstance taskInstance) { var deferral = taskInstance.GetDeferral(); YandexMetrica.Config.LocationTracking = false; //TODO: https://tech.yandex.com/metrica-mobile-sdk/doc/mobile-sdk-dg/tasks/winphone-quickstart-docpage/ YandexMetrica.Activate("Yours Api Key"); YandexMetrica.ReportEvent("Hello from background!"); YandexMetrica.Snapshot(); deferral.Complete(); }
private void App_OnExit(object sender, ExitEventArgs e) { RemoveTrayIcon(); AudioService.Save(); AudioService.Dispose(); if (Settings.Instance.SendStats) { YandexMetrica.ReportExit(); } }
private static void Report(User.User user, string eventName, IEnumerable <KeyValuePair <string, string> > dict) { Logger.Debug($"Sending Yandex event: {eventName}"); YandexMetrica.ReportEvent(eventName, dict .Concat(new[] { new KeyValuePair <string, string>("user", user.Info.UserId.ToString()), new KeyValuePair <string, string>("intent", Utils.CurrentIntent(user)) }) .ToDictionary(kv => kv.Key, kv => kv.Value) ); }
static Logger() { Log = new LoggAddinExt(); try { YandexMetricaFolder.SetCurrent(Path.GetTempPath()); YandexMetrica.Activate("4a039a94-ea44-43b7-9025-59a856dd7120"); YandexMetrica.Config.CustomAppVersion = Commands.AcadLibVersion; } catch (Exception ex) { AutoCAD_PIK_Manager.Log.Error(ex, "YandexMetrica Activate error"); } }
private async Task ReportDmp() { string pathToDmps = $@"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\My Games\Skyrim Special Edition\SKSE\Crashdumps\"; if (!Directory.Exists(pathToDmps)) { return; } try { DateTime dt = ModVersion.LastDmpReported; string fileName = ""; foreach (FileSystemInfo fileSI in new DirectoryInfo(pathToDmps).GetFileSystemInfos()) { if (fileSI.Extension == ".dmp") { if (dt < Convert.ToDateTime(fileSI.CreationTime)) { dt = Convert.ToDateTime(fileSI.CreationTime); fileName = fileSI.Name; } } } if (!string.IsNullOrEmpty(fileName)) { if (await Net.ReportDmp(pathToDmps + fileName)) { YandexMetrica.ReportEvent("CrashReported"); } else { YandexMetrica.ReportEvent("CantReport"); } ModVersion.LastDmpReported = dt; ModVersion.Save(); await Task.Delay(3000); File.Delete(pathToDmps + fileName); } } catch (Exception e) { if (!(e is WebException) && (e is SocketException)) { Logger.Error("ReportDmp", e); } } }