Пример #1
0
        public void DownloadFile(byte[] fileBytes)
        {
            Invoke((Action)(() => { FileSaveDialog.ShowDialog(); }));
            var myStream = FileSaveDialog.OpenFile();

            myStream.Write(fileBytes, 0, fileBytes.Length);
            myStream.Close();
        }
Пример #2
0
 private void ExportToFileButton_Click(object sender, EventArgs e)
 {
     FileSaveDialog.InitialDirectory = Directory.GetCurrentDirectory();
     if (FileSaveDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             JsonFileSerializer.SerializeSnapshotsToJson(ImportedDatabase, FileSaveDialog.OpenFile());
         }
         catch (Exception Ex)
         {
             if (Ex is JsonSerializationException || Ex is JsonReaderException)
             {
                 GUIHelper.ThrowWarning("File error", "Serialization failed.");
             }
         }
     }
 }