Exemplo n.º 1
0
        private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (ConfigurationManager.IsBrandNewConfiguration)
            {
                OpenIntegratedHelp(HelpCategory.GettingStarted);
            }

            await Dispatcher.Yield(DispatcherPriority.SystemIdle);

            skillSelectorWindow = new SkillSelectorWindow {
                Owner = this
            };
            WindowManager.InitializeWindow(skillSelectorWindow);

            advancedSearchWindow = new AdvancedSearchWindow(rootViewModel)
            {
                Owner = this
            };
            WindowManager.InitializeWindow(advancedSearchWindow);

            if (await LoadData() == false)
            {
                Application.Current.Shutdown();
                return;
            }

            loadoutManager = new LoadoutManager(rootViewModel);
            rootViewModel.SetLoadoutManager(loadoutManager);

            string lastOpenedLoadout = GlobalData.Instance.Configuration.LastOpenedLoadout;
            Dictionary <string, SkillLoadoutItemConfigurationV3> loadout = GlobalData.Instance.Configuration.SkillLoadouts;

            if (loadout != null && lastOpenedLoadout != null && loadout.TryGetValue(lastOpenedLoadout, out SkillLoadoutItemConfigurationV3 loadoutConfig))
            {
                loadoutManager.Open(lastOpenedLoadout, loadoutConfig);
            }

            rootViewModel.SearchResultsViewModel.IsDataLoading = false;
            rootViewModel.SearchResultsViewModel.IsDataLoaded  = true;

            rootViewModel.NotifyDataLoaded();

            rootViewModel.CreateSolverData();
        }