Exemplo n.º 1
0
    protected void Application_Startup(object sender, StartupEventArgs e)
    {
        // Set crash logs output to Logs - any unhandled exceptions will be saved to a text file locally.
        // Release only, because we want to see Exceptions in IDE during development.
#if RELEASE
        Application.Current.DispatcherUnhandledException += OnUnhandledException;
#endif

        // Set default culture for all threads for this application (affects date and string formats, e.g. periods instead of commas)
        CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
        CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
        CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

        // Load JSONs.
        GameAssetsHelper.Load();

        var gameWindow = new GameWindow();
        Current.MainWindow = gameWindow;
        gameWindow.Show();

        UserDataHelper.Load();

        (GameAssets.Pages["MainMenu"] as MainMenuPage).UpdateCreateHeroButton();
        (GameAssets.Pages["MainMenu"] as MainMenuPage).UpdateSelectOrDeleteHeroButtons();

        // Save current time as the application's start time (for achievement tracking).
        User.SessionStartDate = DateTime.Now;

        GeneralToolTipHelper.SetGlobalToolTipDelay();
    }