示例#1
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     this.Suspending         += OnSuspending;
     this.UnhandledException += App_UnhandledException;
     Microsoft.HockeyApp.HockeyClient.Current.Configure("836884b121284cbcbd6f1f0dbc787c6b");
     try
     {
         var English = new System.Globalization.CultureInfo("en-us");
         System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator   = English.NumberFormat.NumberDecimalSeparator;
         System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator = English.NumberFormat.CurrencyDecimalSeparator;
         System.Globalization.CultureInfo.CurrentCulture.NumberFormat.PercentDecimalSeparator  = English.NumberFormat.PercentDecimalSeparator;
     }
     catch { }
     try
     {
         var index = SettingsSetters.GetThemeIndex();
         if (index == 0)
         {
             this.RequestedTheme = ApplicationTheme.Dark;
         }
         if (index == 1)
         {
             this.RequestedTheme = ApplicationTheme.Light;
         }
     }
     catch
     {
         this.RequestedTheme = ApplicationTheme.Light;
     }
 }
示例#2
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 (e != null)
            {
                if (e.PreviousExecutionState == ApplicationExecutionState.Running)
                {
                    Window.Current.Activate();
                    return;
                }
                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                if (e.Kind == ActivationKind.VoiceCommand)
                {
                }
            }
            try
            {
                var index = SettingsSetters.GetThemeIndex();
                if (index == 1)
                {
                    StatusBar.GetForCurrentView().ForegroundColor = Colors.Black;
                }
                else
                {
                    StatusBar.GetForCurrentView().ForegroundColor = Colors.White;
                }
            }
            catch { }
            StartFluent();
            Resources["ToggleButtonBackgroundChecked"]            = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlHighlightListAccentLowBrush"] = Color.FromArgb(255, 96, 165, 255);
            Resources["ToggleSwitchFillOn"]                 = Color.FromArgb(255, 96, 165, 255);
            Resources["HyperlinkButtonForeground"]          = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlBackgroundAccentBrush"] = Color.FromArgb(255, 96, 165, 255);
            SplashScreen         splashScreen = e.SplashScreen;
            ExtendedSplashScreen eSplash      = null;

            if (e.Arguments != "")
            {
                var sp = e.Arguments.Split(',');
                eSplash = new ExtendedSplashScreen(splashScreen, new Uri($"https://google.com/maps/@?api=1&map_action=map&center={sp[0]},{sp[1]}&zoom=17", UriKind.RelativeOrAbsolute));
            }
            else
            {
                eSplash = new ExtendedSplashScreen(splashScreen);
            }
            // Register an event handler to be executed when the splash screen has been dismissed.
            Window.Current.Content = eSplash;
            Window.Current.Activate();
            App.Current.Suspending  += Current_Suspending;
            CoreApplication.Exiting += CoreApplication_Exiting;
        }