// Upload file asynchronously private async void UploadFilesAsync(string[] files) { this.startLoading(); foreach (var file in files) { CustomMessageBox customMessageBox = new CustomMessageBox(); string fileName = System.IO.Path.GetFileName(file); string fullPath = System.IO.Path.GetFullPath(file); string content = File.ReadAllText(fullPath); string pdfContent = File.ReadAllText(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + @"\Resources\pdf\index.html"); pdfContent = pdfContent.Replace("#image", Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + @"\Resources\pdf\whitehat.png"); DispatchingServiceReference.DecodeFileIn decodeFileIn = new DispatchingServiceReference.DecodeFileIn { FileName = fileName, Content = content, Md5 = CalculateMD5Hash(content) }; Message request = new Message() { application = appWindow.getAppInfo(), operation = "decode", decodeFileIn = decodeFileIn, userToken = appWindow.getUser().token }; await this.proxy.DispatcherAsync(request).ContinueWith(t => { this.resp = t.Result; float float_ratio = resp.decodeFileout.Ratio * 100; int ratio = (int)float_ratio; customMessageBox.setEmailBody("Secret : " + resp.decodeFileout.Secret.ToString()); customMessageBox.setExportText(resp.decodeFileout.Text); pdfContent = pdfContent.Replace("#text", resp.decodeFileout.Text).Replace("#email", resp.decodeFileout.Secret.ToString()).Replace("#percent", ratio.ToString() + "%"); customMessageBox.setPdfContent(pdfContent); }); if ("DECODE_IMPOSSIBLE".Equals(resp.status)) { MessageBox.Show(resp.description); } else { customMessageBox.ShowDialog(); } this.stopLoading(); } }