示例#1
0
        public App()
        {
            this.UnhandledException += App_UnhandledException;
            this.Suspending         += this.OnSuspending;

#if DEBUG
            //disable application insights on debug
            TelemetryConfiguration.Active.DisableTelemetry = true;
#else
            //config application insights
            WindowsAppInitializer.InitializeAsync();//WindowsCollectors.Metadata | WindowsCollectors.Session | WindowsCollectors.UnhandledException);
#endif

            //application insights has always to be initialized
            TelemetryClient = new TelemetryClient();

            AppSettings.Instance.ThemeChanged               += (s, e) => { UpdateTheme(e.Theme); App.TelemetryClient.TrackMetric("Theme", AppSettings.Instance.Theme == ElementTheme.Light ? 1 : 2); };
            AppSettings.Instance.TransparentTileChanged     += (s, e) => NotificationsManager.UpdateDefaultTile(e.TransparentTile);
            AppSettings.Instance.TransparentNoteTileChanged += (s, e) => NotificationsManager.UpdateAllNoteTilesBackgroundColor(e.TransparentTile);

            AppData.NotesSaved       += (s, e) => SimulateStatusBarProgressComplete();
            AppData.NoteColorChanged += async(s, _e) => { await NotificationsManager.UpdateNoteTileBackgroundColor(_e.Note, AppSettings.Instance.TransparentNoteTile); };


            this.InitializeComponent();
        }