Exemple #1
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();
        }