private void TrackTelemetryData(TelemetryType type)
        {
            switch (type)
            {
            case TelemetryType.Event:
                Dictionary <string, string> properties = new Dictionary <string, string> ();
                properties.Add("Xamarin Key", "Custom Property Value");
                TelemetryManager.TrackEvent("My custom event", properties);
                break;

            case TelemetryType.Metric:
                TelemetryManager.TrackMetric("My custom metric", 2.2);
                break;

            case TelemetryType.Message:
                TelemetryManager.TrackTrace("My custom message");
                break;

            case TelemetryType.PageView:
                TelemetryManager.TrackPageView("My custom page view", 100);
                break;

            case TelemetryType.Session:
                ApplicationInsights.RenewSessionWithId(new DateTime().Date.ToString());
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private void TrackTelemetryData(TelemetryType type)
        {
            switch (type)
            {
            case TelemetryType.Event:
                Dictionary <string, string> properties = new Dictionary <string, string> ();
                properties.Add("Xamarin Key", "Custom Property Value");
                TelemetryManager.TrackEvent("My custom event", properties);
                break;

            case TelemetryType.Metric:
                TelemetryManager.TrackMetric("My custom metric", 2.2);
                break;

            case TelemetryType.Message:
                TelemetryManager.TrackTrace("My custom message");
                break;

            case TelemetryType.PageView:
                TelemetryManager.TrackPageView("My custom page view");
                break;

            case TelemetryType.Session:
                ApplicationInsights.RenewSessionWithId(new DateTime().Date.ToString());
                break;

            case TelemetryType.HandledException:
                try {
                    throw(new NullReferenceException());
                }catch (Exception e) {
                    // App shouldn't crash because of that
                }
                break;

            case TelemetryType.UnhandledException:
                int value = 1 / int.Parse("0");
                break;

            case TelemetryType.UnmanagedSignal:
                                #if __IOS__
                DummyLibrary.TriggerSignalCrash();
                                #endif
                break;

            case TelemetryType.UnmanagedException:
                DummyLibrary.TriggerExceptionCrash();
                break;

            default:
                break;
            }
        }