Made file saves async compatible.

This commit is contained in:
Kevin Pope 2014-10-11 15:11:26 -07:00
parent fbe1333cf0
commit 992c8a2430
4 changed files with 80 additions and 62 deletions

View file

@ -155,14 +155,17 @@ namespace MatterHackers.MatterControl
string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Project|*.zip", initialDirectory: documentsPath);
System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog(ref saveParams);
if (streamToSaveTo != null)
{
streamToSaveTo.Close();
ExportToProjectArchive(saveParams.FileName);
}
FileDialog.SaveFileDialog(saveParams, onSaveFileSelected);
}
void onSaveFileSelected(SaveFileDialogParams saveParams)
{
if (saveParams.FileName != null)
{
ExportToProjectArchive(saveParams.FileName);
}
}
static string applicationDataPath = ApplicationDataStorage.Instance.ApplicationUserDataPath;
static string defaultManifestPathAndFileName = Path.Combine(applicationDataPath, "data", "temp", "project-assembly", "manifest.json");
static string defaultProjectPathAndFileName = Path.Combine(applicationDataPath, "data", "default.zip");