Exemple #1
0
        private async void ConvertButton_ClickAsync(object sender, RoutedEventArgs e)
        {
            if (MdfFile != null && IsoFile != null)
            {
                ConversionProgressBar.Visibility = Visibility.Visible;

                CancelButton.IsEnabled  = true;
                ConvertButton.IsEnabled = false;

                ConversionResult conversionResult = await Task.Run(() => Mdf2IsoConverter.ConvertAsync(
                                                                       MdfFile,
                                                                       IsoFile,
                                                                       progress,
                                                                       LogViewer.LogWriter,
                                                                       token: tokenSource.Token
                                                                       ));

                await ProcessConversionResult(conversionResult);
            }
        }
Exemple #2
0
        private async Task ProcessAlreadyIso()
        {
            logger.Log("Conversion.InputAlreadyISO");
            ContentDialog alreadyIsoChoiceDialog = new ContentDialog
            {
                Title             = "Input file is already in ISO format",
                Content           = "You can change the extension directly to .iso, or copy its content to the new file",
                PrimaryButtonText = "Copy it as a new .iso file",
            };

            //Move option is available only on 1703 and later, beacause of number of buttons

            bool isCloseButtonTextSupported = ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.ContentDialog",
                                                                               nameof(ContentDialog.CloseButtonText));

            if (isCloseButtonTextSupported)
            {
                alreadyIsoChoiceDialog.SecondaryButtonText = "Just rename the .mdf file to .iso";
                alreadyIsoChoiceDialog.CloseButtonText     = "Cancel";
            }
            else
            {
                alreadyIsoChoiceDialog.SecondaryButtonText = "Cancel";
            }

            ContentDialogResult choiceDialogResult = await alreadyIsoChoiceDialog.ShowAsync();

            switch (choiceDialogResult)
            {
            case ContentDialogResult.Primary:
                CopyResult copyResult = await Task.Run(() => Mdf2IsoConverter.CopyAsync(
                                                           MdfFile,
                                                           IsoFile,
                                                           progress,
                                                           LogViewer.LogWriter,
                                                           token: tokenSource.Token
                                                           ));
                await ProcessCopyResult(copyResult);

                break;

            case ContentDialogResult.Secondary:
                if (isCloseButtonTextSupported)
                {
                    bool renameResult = await ChangeExtension();
                    await ProcessRenameResult(renameResult);
                }
                else
                {
                    logger.Log("AlreadyIso.DoNothing");
                }
                break;

            case ContentDialogResult.None:
                logger.Log("AlreadyIso.DoNothing");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }