private void RemovableBanner_OnClick(object sender, EventArgs e)
        {
            var authenticated    = HSReplayNetOAuth.IsFullyAuthenticated;
            var collectionSynced = Account.Instance.CollectionState.Any();

            Influx.OnCollectionSyncingBannerClicked(authenticated, collectionSynced);
            if (!authenticated || !collectionSynced)
            {
                Options.TreeViewItemHSReplayCollection.IsSelected = true;
                FlyoutOptions.IsOpen = true;
                if (!authenticated)
                {
                    var successUrl = Helper.BuildHsReplayNetUrl("decks", "collection_syncing_banner",
                                                                new[] { "modal=collection" });
                    HSReplayNetHelper.TryAuthenticate(successUrl).Forget();
                }
            }
            else
            {
                HSReplayNetHelper.OpenDecksUrlWithCollection("collection_syncing_banner");
            }
        }
Exemple #2
0
#pragma warning disable 1998
        public static async void Initialize()
#pragma warning restore 1998
        {
            LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en-US");
            _startUpTime = DateTime.UtcNow;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            Config.Load();
            Log.Info($"HDT: {Helper.GetCurrentVersion()}, Operating System: {Helper.GetWindowsVersion()}, .NET Framework: {Helper.GetInstalledDotNetVersion()}");
            var splashScreenWindow = new SplashScreenWindow();

#if (SQUIRREL)
            if (Config.Instance.CheckForUpdates)
            {
                var updateCheck = Updater.StartupUpdateCheck(splashScreenWindow);
                while (!updateCheck.IsCompleted)
                {
                    await Task.Delay(500);

                    if (splashScreenWindow.SkipUpdate)
                    {
                        break;
                    }
                }
            }
#endif
            splashScreenWindow.ShowConditional();
            Log.Initialize();
            Reflection.Exception += e => Log.Warn("HearthMirror Exception: " + e);
            ConfigManager.Run();
            LocUtil.UpdateCultureInfo();
            var newUser = ConfigManager.PreviousVersion == null;
            LogConfigUpdater.Run().Forget();
            LogConfigWatcher.Start();
            UITheme.InitializeTheme().Forget();
            ThemeManager.Run();
            ResourceMonitor.Run();
            Game = new GameV2();
            Game.SecretsManager.OnSecretsChanged += cards => Overlay.ShowSecrets(cards);
            MainWindow = new MainWindow();
            MainWindow.LoadConfigSettings();
            MainWindow.Show();
            splashScreenWindow.Close();

            if (Config.Instance.DisplayHsReplayNoteLive && ConfigManager.PreviousVersion != null && ConfigManager.PreviousVersion < new Version(1, 1, 0))
            {
                MainWindow.FlyoutHsReplayNote.IsOpen = true;
            }

            if (ConfigManager.UpdatedVersion != null)
            {
#if (!SQUIRREL)
                Updater.Cleanup();
#endif
                MainWindow.FlyoutUpdateNotes.IsOpen = true;
                MainWindow.UpdateNotesControl.SetHighlight(ConfigManager.PreviousVersion);
#if (SQUIRREL && !DEV)
                if (Config.Instance.CheckForDevUpdates && !Config.Instance.AllowDevUpdates.HasValue)
                {
                    MainWindow.ShowDevUpdatesMessage();
                }
#endif
            }
            DataIssueResolver.Run();

#if (!SQUIRREL)
            Helper.CopyReplayFiles();
#endif
            BackupManager.Run();

            if (Config.Instance.PlayerWindowOnStart)
            {
                Windows.PlayerWindow.Show();
            }
            if (Config.Instance.OpponentWindowOnStart)
            {
                Windows.OpponentWindow.Show();
            }
            if (Config.Instance.TimerWindowOnStartup)
            {
                Windows.TimerWindow.Show();
            }

            PluginManager.Instance.LoadPluginsFromDefaultPath();
            MainWindow.Options.OptionsTrackerPlugins.Load();
            PluginManager.Instance.StartUpdateAsync();

            UpdateOverlayAsync();

            if (Config.Instance.ShowCapturableOverlay)
            {
                Windows.CapturableOverlay = new CapturableOverlayWindow();
                Windows.CapturableOverlay.Show();
            }

            if (LogConfigUpdater.LogConfigUpdateFailed)
            {
                MainWindow.ShowLogConfigUpdateFailedMessage().Forget();
            }
            else if (LogConfigUpdater.LogConfigUpdated && Game.IsRunning)
            {
                MainWindow.ShowMessageAsync("Hearthstone restart required", "The log.config file has been updated. HDT may not work properly until Hearthstone has been restarted.").Forget();
                Overlay.ShowRestartRequiredWarning();
            }
            LogWatcherManger.Start(Game).Forget();

            RemoteConfig.Instance.Load();
            HotKeyManager.Load();

            if (Helper.HearthstoneDirExists && Config.Instance.StartHearthstoneWithHDT && !Game.IsRunning)
            {
                HearthstoneRunner.StartHearthstone().Forget();
            }

            HSReplayNetHelper.UpdateAccount().Forget();

            Initialized = true;

            Influx.OnAppStart(
                Helper.GetCurrentVersion(),
                newUser,
                HSReplayNetOAuth.IsFullyAuthenticated,
                HSReplayNetOAuth.AccountData?.IsPremium?.Equals("true", StringComparison.InvariantCultureIgnoreCase) ?? false,
                (int)(DateTime.UtcNow - _startUpTime).TotalSeconds,
                PluginManager.Instance.Plugins.Count
                );
        }
 private void CollectionUploadedToast_OnClicked(object sender, EventArgs e)
 {
     ToastManager.ForceCloseToast(this);
     HSReplayNetHelper.OpenDecksUrlWithCollection("collection_uploaded_toast");
 }