/// <summary>
/// 异步保存文件
/// </summary>
/// <param name="logout"></param>
/// <returns></returns>
private bool SaveFileAsync(string fileName)
{
try
{
BackgroundWorker workAssign = new BackgroundWorker();
workAssign.DoWork += SaveFileDoWork;
workAssign.RunWorkerAsync(fileName);
return true;
}
catch (System.Exception ex)
{
StaticMethod.WriteLog(ex);
return false;
}
}
/// <summary>
/// 执行
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveFileDoWork(object sender, DoWorkEventArgs e)
{
try
{
var fileName = e.Argument.ToString();
for (int i = 0; i < m_streams.Count; i++)
{
Metafile image = new Metafile(m_streams[i]);
image.Save(fileName + "_" + i + ".png", ImageFormat.Png);
}
}
catch (System.Exception ex)
{
StaticMethod.WriteLog(ex);
}
}