Exemplo n.º 1
0
        public MainWindow(LauncherContext launcherContext)
        {
            Instance = this;
#if DEBUG
            launcherContext.LauncherSettingsManager.Reset();
#endif
            LauncherContext = launcherContext;
            Settings        = new LauncherSettingsManager();
            ProfileManager  = new ProfileManager();
            ProfileManager.Load();
            //Populate for the first time
            if (ProfileManager.ServerProfiles.Count == 0)
            {
                ProfileManager.ServerProfiles.Insert(0, ServerProfile.OfficialProfile);
                ProfileManager.SaveServerProfiles();
            }

            ChangeAppTheme();

            AccentColors = ThemeManager.Accents
                           .Select(a =>
                                   new AccentColorMenuData
            {
                Name       = a.Name,
                ColorBrush = a.Resources["AccentColorBrush"] as Brush
            }).ToList();
            AppThemes = ThemeManager.AppThemes
                        .Select(a =>
                                new AppThemeMenuData
            {
                Name             = a.Name,
                BorderColorBrush = a.Resources["BlackColorBrush"] as Brush,
                ColorBrush       = a.Resources["WhiteColorBrush"] as Brush
            }).ToList();

            InitializeComponent();
            MainProgressReporter.ReporterProgressBar.SetVisibilitySafe(Visibility.Hidden);
            _disableWhilePatching = new Control[]
            {
                LaunchButton,
                NewProfileButton,
                ClientProfileComboBox,
                ServerProfileComboBox
            };

            _updateClose = false;
        }