/// <summary>
        /// Event handler for the import mod pack button clicked
        /// </summary>
        private async void ImportModPackButton_Click(object sender, RoutedEventArgs e)
        {
            _progressController = await this.ShowProgressAsync("Importing ModPack", "Please Stand By...");

            var importList = (from SimpleModPackEntries selectedItem in ModListView.SelectedItems select selectedItem.JsonEntry).ToList();

            var modListDirectory = new DirectoryInfo(Path.Combine(_gameDirectory.Parent.Parent.FullName, XivStrings.ModlistFilePath));

            var progressIndicator = new Progress <double>(ReportProgress);

            TotalModsImported = await _texToolsModPack.ImportModPackAsync(_modPackDirectory, importList, _gameDirectory, modListDirectory, progressIndicator);

            await _progressController.CloseAsync();

            DialogResult = true;
        }
        /// <summary>
        /// Writes all selected mods to game data
        /// </summary>
        private async void FinalizeImport()
        {
            _progressController = await this.ShowProgressAsync("Importing ModPack", "Please Stand By...");

            var texToolsModPack = new TTMP(new DirectoryInfo(Properties.Settings.Default.ModPack_Directory), XivStrings.TexTools);

            var importList = new List <ModsJson>();

            foreach (var wizPageItem in importModPackWizard.Items)
            {
                var wizPage = wizPageItem as WizardPage;

                if (wizPage.Content is ImportWizardModPackControl control)
                {
                    var optionList = control.OptionsList;

                    foreach (var optionListItem in optionList.Items)
                    {
                        if (((ModOptionJson)optionListItem).IsChecked)
                        {
                            importList.AddRange(((ModOptionJson)optionListItem).ModsJsons);
                        }
                    }
                }
            }

            foreach (var modsJson in importList)
            {
                modsJson.ModPackEntry = _modPackEntry;
            }

            var gameDirectory    = new DirectoryInfo(Properties.Settings.Default.FFXIV_Directory);
            var modListDirectory = new DirectoryInfo(Path.Combine(gameDirectory.Parent.Parent.FullName, XivStrings.ModlistFilePath));

            var progressIndicator = new Progress <double>(ReportProgress);

            TotalModsImported = await texToolsModPack.ImportModPackAsync(_modPackDirectory, importList, gameDirectory, modListDirectory, progressIndicator);

            await _progressController.CloseAsync();

            DialogResult = true;
        }
        /// <summary>
        /// Event handler for when the import modpack button is clicked
        /// </summary>
        private async void ImportModPackButton_Click(object sender, RoutedEventArgs e)
        {
            _progressController = await this.ShowProgressAsync(UIMessages.ModPackImportTitle, UIMessages.PleaseStandByMessage);

            try
            {
                var importList = new List <ModsJson>();

                var selectedModpackNames = (from modpack in (List <BackupModpackItemEntry>)ModpackList.ItemsSource
                                            where (modpack.IsChecked)
                                            select modpack).Select(entry => entry.ModpackName);

                // Separately add the mods that aren't associated to any modpacks if they are to be included in the backup
                if (selectedModpackNames.Contains(UIStrings.Standalone_Non_ModPack))
                {
                    importList.AddRange(from modsJson in _modsJsons
                                        where (modsJson.ModPackEntry == null)
                                        select modsJson);
                }

                importList.AddRange(from modsJson in _modsJsons
                                    where (selectedModpackNames.Contains(modsJson.ModPackEntry?.name))
                                    select modsJson);


                var texToolsModPack   = new TTMP(new DirectoryInfo(Properties.Settings.Default.ModPack_Directory), XivStrings.TexTools);
                var gameDirectory     = new DirectoryInfo(Properties.Settings.Default.FFXIV_Directory);
                var modListDirectory  = new DirectoryInfo(System.IO.Path.Combine(gameDirectory.Parent.Parent.FullName, XivStrings.ModlistFilePath));
                var progressIndicator = new Progress <(int current, int total, string message)>(ReportProgress);

                var importResults = await Task.Run(async() =>
                {
                    return(await texToolsModPack.ImportModPackAsync(_modpackDirectory, importList, gameDirectory, modListDirectory, progressIndicator));
                });

                TotalModsImported = importResults.ImportCount;
                TotalModsErrored  = importResults.ErrorCount;
                ImportDuration    = importResults.Duration;

                if (!string.IsNullOrEmpty(importResults.Errors))
                {
                    FlexibleMessageBox.Show(
                        $"{UIMessages.ErrorImportingModsMessage}\n\n{importResults.Errors}", UIMessages.ErrorImportingModsTitle,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                FlexibleMessageBox.Show(
                    $"{UIMessages.ErrorImportingModsMessage}\n\n{ex.Message}", UIMessages.ErrorImportingModsTitle,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                await _progressController.CloseAsync();
            }

            if (_messageInImport)
            {
                var durationString = ImportDuration.ToString("0.00");
                await this.ShowMessageAsync(UIMessages.ImportCompleteTitle,
                                            string.Format(UIMessages.SuccessfulImportCountMessage, TotalModsImported, TotalModsErrored, durationString));
            }

            MainWindow.GetMainWindow().ReloadItem();

            DialogResult = true;
        }