private void FileZip_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(SavePath.Text)) { WinForms.MessageBox.Show("Please select your file.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); SavePath.Focus(); return; } string filename = SavePath.Text; Thread thread = new Thread(t => { using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) { FileInfo fi = new FileInfo(filename); zip.AddFile(filename); System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(filename); zip.SaveProgress += Zip_SaveFileProgress; zip.Save(string.Format($"{di.Parent.FullName}/{di.Name}.zip")); } }) { IsBackground = true }; thread.Start(); }