Exemple #1
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            StorageFile outputFile = null;
            await Task.Delay(1000);

            if (inputFile != null)
            {
                outputFile = await HuffmanFileManager.GetFileDecompressedToSave(inputFile.DisplayName);
            }
            else
            {
                tips.Text = "程序发生异常";
                goto finish;
            }
            if (outputFile == null)
            {
                tips.Text = "您取消了操作";
                goto finish;
            }

            tips.Text = "正在解压\n请将程序保持在前台运行";
            await new Decoder().DecodeFile(inputFile, outputFile);
            tips.Text = "解压完成";

finish:
            await Task.Delay(1000);

            App.Current.Exit();
        }
Exemple #2
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            await Task.Delay(1000);

            StorageFile inputFile = await HuffmanFileManager.GetFileToBeCompressed();

            if (inputFile == null)
            {
                tips.Text = "您取消了操作";
                goto finish;
            }

            tips.Text = "您需要将文件存放到哪里?";
            await Task.Delay(1000);

            StorageFile outputFile = await HuffmanFileManager.GetFileCompressedToSave(inputFile.DisplayName + ".wugzh3");

            if (outputFile == null)
            {
                tips.Text = "您取消了操作";
                goto finish;
            }

            tips.Text = "正在压缩\n请将程序保持在前台运行";
            await new Encoder().EncodeFile(inputFile, outputFile);
            tips.Text = "压缩完成";

finish:
            await Task.Delay(1000);

            App.Current.Exit();
        }