public void Launch(Form parentForm, ProjectInfo projectInfo) { string wesayZipFilePath = Path.Combine(Path.GetTempPath(), projectInfo.Name + "_wesay.zip"); BackupMaker.BackupToExternal(projectInfo.PathToTopLevelDirectory, wesayZipFilePath, projectInfo.FilesBelongingToProject); var emailProvider = Palaso.Email.EmailProviderFactory.PreferredEmailProvider(); var msg = emailProvider.CreateMessage(); msg.AttachmentFilePath.Add(wesayZipFilePath); msg.To.Add(_settings.Email); msg.Subject = StringCatalog.GetFormatted( "{0} WeSay Project Data", "The subject line of the email send by the 'Send Email' Action. The {0} will be replaced by the name of the project, as in 'Greek WeSay Project Data'", projectInfo.Name); msg.Body = StringCatalog.Get("The latest WeSay project data is attached."); //I tried hard to get this to run in a thread so it wouldn't block wesay, //but when called in a thread we always just get the generic '2' back. // EmailMessage emailWorker = // new EmailMessage( // subject, // body, // msg); ///emailWorker.SendMail(); /// msg.Send(emailProvider); // review (CP): This is different from the mapi popup used previously }
private void DoBackup(IUsbDriveInfo info) { _checkForUsbKeyTimer.Enabled = false; _noteLabel.Visible = false; _topLabel.Text = "~Backing Up..."; Refresh(); try { string dest = Path.Combine(info.RootDirectory.FullName, _projectInfo.Name + "_wesay.zip"); BackupMaker.BackupToExternal(_projectInfo.PathToTopLevelDirectory, dest, _projectInfo.FilesBelongingToProject); _topLabel.Text = "~Backup Complete"; _noteLabel.Visible = true; _noteLabel.Text = String.Format("~Files backed up to {0}", dest); } catch (Exception e) { ErrorReport.NotifyUserOfProblem( "WeSay could to perform the backup. Reason: {0}", e.Message); _topLabel.Text = "~Files were not backed up."; _topLabel.ForeColor = Color.Red; } _cancelButton.Text = "&OK"; }