private async void LoadVersionList()
        {
            LoadingProgressLabel.Content = "Loading versions from cache";
            LoadingProgressBar.Value     = 1;

            LoadingProgressGrid.Visibility = Visibility.Visible;

            try {
                await _versions.LoadFromCache();
            } catch (Exception e) {
                Debug.WriteLine("List cache load failed:\n" + e.ToString());
            }

            LoadingProgressLabel.Content = "Updating versions list from " + VERSIONS_API;
            LoadingProgressBar.Value     = 2;
            try {
                await _versions.DownloadList();
            } catch (Exception e) {
                Debug.WriteLine("List download failed:\n" + e.ToString());
                MessageBox.Show("Failed to update version list from the internet. Some new versions might be missing.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            LoadingProgressLabel.Content = "Loading imported versions";
            LoadingProgressBar.Value     = 3;
            await _versions.LoadImported();

            LoadingProgressGrid.Visibility = Visibility.Collapsed;
        }
        public MainWindow()
        {
            InitializeComponent();
            ShowBetasCheckbox.DataContext = this;
            ShowInstalledVersionsOnlyCheckbox.DataContext = this;

            if (File.Exists(PREFS_PATH))
            {
                UserPrefs = JsonConvert.DeserializeObject <Preferences>(File.ReadAllText(PREFS_PATH));
            }
            else
            {
                UserPrefs = new Preferences();
                RewritePrefs();
            }

            _versions = new VersionList("versions.json", IMPORTED_VERSIONS_PATH, this);
            VersionList.ItemsSource = _versions;
            var view = CollectionViewSource.GetDefaultView(VersionList.ItemsSource) as CollectionView;

            view.Filter = VersionListFilter;
            _userVersionDownloaderLoginTask = new Task(() => {
                _userVersionDownloader.EnableUserAuthorization();
            });
            Dispatcher.Invoke(async() => {
                try {
                    await _versions.LoadFromCache();
                } catch (Exception e) {
                    Debug.WriteLine("List cache load failed:\n" + e.ToString());
                }
                try {
                    await _versions.DownloadList();
                } catch (Exception e) {
                    Debug.WriteLine("List download failed:\n" + e.ToString());
                }
                await _versions.LoadImported();
            });
            ThemesController.SetTheme(GetThemeEnum(UserPrefs.Theme));
        }