Ejemplo n.º 1
0
        private async void AppBarButton_Click_3(object sender, RoutedEventArgs e)
        {
            try
            {
                StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
                logger.Log("ChartEvent");
                blankPagePlot = new BlankPagePlot();

                appWindow = await AppWindow.TryCreateAsync();

                ElementCompositionPreview.SetAppWindowContent(appWindow, blankPagePlot);

                v = await appWindow.TryShowAsync();

                if (v)
                {
                    blankPagePlot.iniPlot(device.namea);
                    blankPagePlot.PlotModel.addSeries();
                    Size size = new Size()
                    {
                        Height = 100, Width = 100
                    };
                    appWindow.RequestSize(size);
                    appWindow.Closed += delegate
                    {
                        v             = false;
                        blankPagePlot = null;
                        appWindow     = null;
                    };
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 2
0
 private static void VerifyLogger()
 {
     if (_logger == null)
     {
         _logger = StoreServicesCustomEventLogger.GetDefault();
     }
 }
Ejemplo n.º 3
0
        public static void LogEvent(string log,
                                    EventType eventType = EventType.Log)
        {
            string logmessage = eventType.ToString() + "_" + log;

            StoreServicesCustomEventLogger.GetDefault().Log(logmessage);
        }
 public void LogMessage(object callerObj, [CallerMemberName] string callerName = null, string message = null)
 {
     if (callerObj != null && TelemetryEnabled)
     {
         StoreServicesCustomEventLogger.GetDefault().Log($"{callerObj.GetType().Name} {callerName ?? string.Empty} {message ?? string.Empty}".TrimEnd());
     }
 }
Ejemplo n.º 5
0
        public static void LogEvent(string evt)
        {
            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log(evt);
            customEventsLog.Add(evt);
        }
Ejemplo n.º 6
0
        public void Initialize(bool isTelemetryEnabled, TelemetryKeys telemetryKey)
        {
            // save telemetry status
            this.IsTelemetryEnabled = isTelemetryEnabled;

            // save the telemetry key
            this.ActiveKey = telemetryKey;

            // if telemetry is enabled, create the logger
            if (this.IsTelemetryEnabled)
            {
                // configure for logging/telemetry
                switch (telemetryKey)
                {
                // for Test, we'll just log to a file
                case TelemetryKeys.Test:
                default:
                    LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Info, LogLevel.Fatal, new StreamingFileTarget());
                    TestLog = LogManagerFactory.DefaultLogManager.GetLogger <TelemetryService>();
                    break;

                // for Prod, we'll log to the Store
                case TelemetryKeys.Prod:
                    ProdLog = StoreServicesCustomEventLogger.GetDefault();
                    break;
                }
            }
        }
Ejemplo n.º 7
0
        private async void WatchAnAd()
        {
            if (!InternetConnectivityHelper.IsInternetConnected)
            {
                await NotifyAndDeselect("Seems you don't have an internet connection. Thanks for the support, though!");

                return;
            }
            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            InterstitialAd ad         = new InterstitialAd();
            string         myAppId    = "9nblggh42srx";
            string         myAdUnitId = "11701839";

            ad.Keywords = "music,software,apps";
            ad.AdReady += async(r, a) =>
            {
                if (InterstitialAdState.Ready == ad.State)
                {
                    logger.Log("WatchAnAdStarted");
                    ad.Show();
                    await SharedLogic.Instance.NotificationManager.ShowMessageBoxAsync("Please click at least one link to help me more! Thanks!", "Thank you so much!");
                }
            };
            ad.Completed += async(r, a) =>
            {
                logger.Log("WatchAnAdCompleted");
                await NotifyAndDeselect("Thanks!");
            };
            ad.Cancelled += async(r, a) =>
            {
                await NotifyAndDeselect("No worries!");
            };
            int retryCount = 0;

            ad.ErrorOccurred += async(r, a) =>
            {
                if (retryCount < 2)
                {
                    retryCount++;
                    await NotifyAndDeselect("Aw! An error occured. Trying something else. Please wait.");

                    myAdUnitId = "1100000276";
                    ad.RequestAd(AdType.Display, myAppId, myAdUnitId);
                }
                else
                {
                    await NotifyAndDeselect("Aw! An error occured. Thanks anyway.");
                }
            };
            ad.RequestAd(AdType.Video, myAppId, myAdUnitId);
            await NotifyAndDeselect("Please continue. The ad will be shown shortly.");

            async Task NotifyAndDeselect(string message)
            {
                await SharedLogic.Instance.NotificationManager.ShowMessageAsync(message);

                SplitViewMenu.SelectPrevious();
            }
        }
        public SchemeActivationSamplePage()
        {
            InitializeComponent();

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("deepLinkPageLoaded");
        }
Ejemplo n.º 9
0
        private void refresh_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            Refresh_Page();

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("userRefreshedStatusPage");
        }
Ejemplo n.º 10
0
        private void Example1()
        {
            //<Log>
            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("myCustomEvent");
            //</Log>
        }
Ejemplo n.º 11
0
        public EventPage()
        {
            InitializeComponent();

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("eventPageLoaded");
        }
Ejemplo n.º 12
0
        public MainPage()
        {
            InitializeComponent();
            backButton.Visibility        = Visibility.Collapsed;
            fileScrollViewer.ItemsSource = fileItems;

            try
            {
                // add localized options
                l18nLoader = ResourceLoader.GetForCurrentView();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                System.Diagnostics.Debug.WriteLine(e, "error");
            }
            if (l18nLoader != null)
            {
                // ...  to sort by
                sortComboBox.Items.Add(l18nLoader.GetString("Sort/Name"));
                sortComboBox.Items.Add(l18nLoader.GetString("Sort/Size"));
                sortComboBox.Items.Add(l18nLoader.GetString("Sort/LastModified"));
                sortComboBox.SelectedIndex = 0;
                // ... to sort direction
                sortDirComboBox.Items.Add(l18nLoader.GetString("Sort/Ascending"));
                sortDirComboBox.Items.Add(l18nLoader.GetString("Sort/Descending"));
                sortDirComboBox.SelectedIndex = 0;
            }

            // loading data: not necessary as is done in OnNavigatedTo

            // Handling Page Back navigation behaviors
            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequestedAsync;

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("mainPage");
            try
            {
                Analytics.TrackEvent("MainPage Loaded");
            }
            catch (Exception e)
            {
                // let's not do anything more about this.
                System.Diagnostics.Debug.WriteLine("Exception when submitting analytics: " + e.Message);
            }

            //
            try
            {
                Analytics.TrackEvent("MainPage");
            }
            catch (Exception e)
            {
                // let's not do anything more about this.
                System.Diagnostics.Debug.WriteLine("Exception when submitting analytics: " + e.Message);
            }
        }
Ejemplo n.º 13
0
        public NewsPage()
        {
            InitializeComponent();
            Loaded += NewsPage_Loaded;

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("newsPageLoaded");
        }
Ejemplo n.º 14
0
        //</ExperimentCodeSample>

        // <Snippet8>
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (logger == null)
            {
                logger = StoreServicesCustomEventLogger.GetDefault();
            }

            logger.LogForVariation(variation, "userClickedButton");
        }
Ejemplo n.º 15
0
        public StatusPage()
        {
            InitializeComponent();
            Refresh_Page();

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("statusPageLoaded");
        }
Ejemplo n.º 16
0
        public WhatsNewDialog()
        {
            // TODO WTS: Update the contents of this dialog every time you release a new version of the app
            RequestedTheme = (Window.Current.Content as FrameworkElement).RequestedTheme;
            InitializeComponent();

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            logger.Log("whatsNewDialogDisplayed");
        }
Ejemplo n.º 17
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            // Log the conversion event named "userClickedButton" to Dev Center.
            if (logger == null)
            {
                logger = StoreServicesCustomEventLogger.GetDefault();
            }

            logger.LogForVariation(variation, "userClickedButton");
        }
Ejemplo n.º 18
0
 public static void Secret()
 {
     if (Secreted)
     {
         return;
     }
     Secreted = true;
     try { StoreServicesCustomEventLogger.GetDefault().Log(SECRET_MODE); }
     catch (Exception) { }
 }
Ejemplo n.º 19
0
 public static void Normal()
 {
     if (Normaled)
     {
         return;
     }
     Normaled = true;
     try { StoreServicesCustomEventLogger.GetDefault().Log(NORMAL_MODE); }
     catch (Exception) { }
 }
Ejemplo n.º 20
0
 static TrackingManager()
 {
     try
     {
         logger = StoreServicesCustomEventLogger.GetDefault();
     }
     catch
     {
         // Ignoring error
     }
 }
Ejemplo n.º 21
0
 private async void butBya_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
         logger.Log("butByaEvent");
         await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store://pdp/?ProductId=9N5H75QWBHLL"));
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 22
0
        private async void InitializeLicense()
        {
            try
            {
                if (context == null)
                {
                    context = StoreContext.GetDefault();
                    // If your app is a desktop app that uses the Desktop Bridge, you
                    // may need additional code to configure the StoreContext object.
                    // For more info, see https://aka.ms/storecontext-for-desktop.
                }


                appLicense = await context.GetAppLicenseAsync();

                if (appLicense.IsActive)
                {
                    if (appLicense.IsTrial)
                    {
                        int remainingTrialTime = (appLicense.ExpirationDate - DateTime.Now).Days;
                        //Debug.WriteLine($"This is the trial version. Expiration date: {appLicense.ExpirationDate}");
                        textlic.Text = $"You can use this app for {remainingTrialTime} more days before the trial period ends.";
                        StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
                        logger.Log("isTrialEvent");
                        //  textBlock.Text = $"This is the trial version. Expiration date: {appLicense.ExpirationDate}";

                        // Show the features that are available during trial only.
                    }
                    else
                    {
                        textlic.Text = "You have a full license.";
                        StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
                        logger.Log("NotTrialEvent");

                        // Show the features that are available only with a full license.
                    }
                }
                else
                {
                    textlic.Text = "You don't have a license. The trial time can't be determined.";
                    StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
                    logger.Log("NotActiveEvent");
                }

                // Register for the licenced changed event.
                context.OfflineLicensesChanged += context_OfflineLicensesChanged;
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 23
0
        public MainPage()
        {
            this.InitializeComponent();
            var version = Package.Current.Id.Version.ToVersion();

            this.tbVersion.Text = $"{Strings.Resources.App.DisplayName} {version}";
            Dispatcher.Begin(async() =>
            {
                var r          = await Launcher.QueryUriSupportAsync(AuroraSettings, LaunchQuerySupportType.Uri);
                this.canLaunch = (r == LaunchQuerySupportStatus.Available);
                this.Bindings.Update();
                StoreServicesCustomEventLogger.GetDefault().Log("Main View Launched");
            });
        }
Ejemplo n.º 24
0
        private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
            string message = "Ex ";

            if (sender is MainPage)
            {
                message += ((MainPage)sender)?.rawImage?.metadata.FileNameComplete + " ";
            }
            else if (sender is RawDecoder)
            {
                message += ((RawDecoder)sender)?.rawImage?.metadata.FileNameComplete + " ";
            }
            logger.Log(message + sender.GetType() + " " + e.Message);
        }
Ejemplo n.º 25
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                Frame.Navigate(typeof(MainPage));
            }
            catch (Exception ex)
            {
                await new MessageDialog("Sorry, a problem occured when resetting the page.\n\n"
                                        + ex.Message + "\n\n" + ex.StackTrace).ShowAsync();

                StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
                logger.Log("MyResetPageError" + " " + ex.Message + " " + ex.StackTrace);
            }
        }
Ejemplo n.º 26
0
        // </Snippet2>

        private async Task InitializeExperiment()
        {
            // Get the current cached variation assignment for the experiment.
            // <Snippet3>
            var result = await StoreServicesExperimentVariation.GetCachedVariationAsync(projectId);

            variation = result.ExperimentVariation;
            // </Snippet3>

            // Refresh the cached variation assignment if necessary.
            // <Snippet4>
            if (result.ErrorCode != StoreServicesEngagementErrorCode.None || result.ExperimentVariation.IsStale)
            {
                result = await StoreServicesExperimentVariation.GetRefreshedVariationAsync(projectId);

                if (result.ErrorCode == StoreServicesEngagementErrorCode.None)
                {
                    variation = result.ExperimentVariation;
                }
            }
            // </Snippet4>

            // Get the remote variable named "buttonText" and assign the value
            // to the button.
            // <Snippet5>
            var buttonText = variation.GetString("buttonText", "Grey Button");
            // </Snippet5>
            // <Snippet6>
            await button.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                () =>
            {
                button.Content = buttonText;
            });

            // </Snippet6>

            // Log the view event named "userViewedButton" to Dev Center.
            // <Snippet7>
            if (logger == null)
            {
                logger = StoreServicesCustomEventLogger.GetDefault();
            }

            logger.LogForVariation(variation, "userViewedButton");
            // </Snippet7>
        }
Ejemplo n.º 27
0
        private async Task InitializeExperiment()
        {
            // Get the current cached variation assignment for the experiment.
            var result = await StoreServicesExperimentVariation.GetCachedVariationAsync(projectId);

            variation = result.ExperimentVariation;

            // Check whether the cached variation assignment needs to be refreshed.
            // If so, then refresh it.
            if (result.ErrorCode != StoreServicesEngagementErrorCode.None || result.ExperimentVariation.IsStale)
            {
                result = await StoreServicesExperimentVariation.GetRefreshedVariationAsync(projectId);

                // If the call succeeds, use the new result. Otherwise, use the cached value.
                if (result.ErrorCode == StoreServicesEngagementErrorCode.None)
                {
                    variation = result.ExperimentVariation;
                }
            }

            // Get remote variables named "buttonText", "r", "g", and "b" from the variation
            // assignment. If no variation assignment is available, the variables default
            // to "Grey button" for the button text and grey RGB value for the button color.
            var buttonText = variation.GetString("buttonText", "Grey Button");
            var r          = (byte)variation.GetInt32("r", 128);
            var g          = (byte)variation.GetInt32("g", 128);
            var b          = (byte)variation.GetInt32("b", 128);

            // Assign button text and color.
            await button.Dispatcher.RunAsync(
                CoreDispatcherPriority.Normal,
                () =>
            {
                button.Background = new SolidColorBrush(Color.FromArgb(255, r, g, b));
                button.Content    = buttonText;
                button.Visibility = Visibility.Visible;
            });

            // Log the view event named "userViewedButton" to Dev Center.
            if (logger == null)
            {
                logger = StoreServicesCustomEventLogger.GetDefault();
            }

            logger.LogForVariation(variation, "userViewedButton");
        }
Ejemplo n.º 28
0
        private async void WatchAnAd()
        {
            if (!InternetConnectivityHelper.IsInternetConnected)
            {
                await NotifyAndDeselect("Seems you don't have an internet connection. Thanks for the support, though!");

                return;
            }
            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            InterstitialAd ad         = new InterstitialAd();
            string         myAppId    = "9nblggh42srx";
            string         myAdUnitId = "11701839";

            ad.AdReady += (r, a) =>
            {
                if (InterstitialAdState.Ready == ad.State)
                {
                    logger.Log("WatchAnAdStarted");
                    ad.Show();
                }
            };
            ad.Completed += async(r, a) =>
            {
                logger.Log("WatchAnAdCompleted");
                await NotifyAndDeselect("Thanks!");
            };
            ad.Cancelled += async(r, a) =>
            {
                await NotifyAndDeselect("No worries!");
            };
            ad.ErrorOccurred += async(r, a) =>
            {
                await NotifyAndDeselect("Aw! An error occured. We will try later. Thanks.");
            };
            ad.RequestAd(AdType.Video, myAppId, myAdUnitId);
            await NotifyAndDeselect("Please continue. The ad will be shown shortly.");

            async Task NotifyAndDeselect(string message)
            {
                await SharedLogic.Instance.NotificationManager.ShowMessageAsync(message);

                SplitViewMenu.SplitViewMenu.SelectPrevious();
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if ((ApplicationData.Current.LocalSettings.Values.ContainsKey("FirstRun")) && (ApplicationData.Current.LocalSettings.Values["FirstRun"].ToString() == "false"))
            {
                InitApplication(e, typeof(MainPage));
            }
            else
            {
                LaunchTime = null;
                InitApplication(e, typeof(Intro));
            }
#if !DEBUG
            var osVersion = DeviceInfo.SystemVersion.ToString();
            App.Tracker.Send(HitBuilder.CreateCustomEvent("OSVersion", osVersion).Build());

            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();
            logger.Log("AppLaunched_" + osVersion);
#endif
        }
Ejemplo n.º 30
0
        private async void btnLaunch_Click(object sender, RoutedEventArgs e)
        {
            var r = await Launcher.QueryUriSupportAsync(AuroraSettings, LaunchQuerySupportType.Uri);

            var lr = false;

            if (r == LaunchQuerySupportStatus.Available)
            {
                StoreServicesCustomEventLogger.GetDefault().Log("Aurora Launched");
                lr = await Launcher.LaunchUriAsync(AuroraSettings);
            }
            else
            {
                StoreServicesCustomEventLogger.GetDefault().Log("Store Launched");
                lr = await Launcher.LaunchUriAsync(new Uri("ms-windows-store://pdp/?ProductId=9nblggh6jvdt"));
            }
            if (lr)
            {
                Application.Current.Exit();
            }
        }