public void Setup() { ErrorReport.IsOkToInteractWithUser = false; _tmpFolder = new TemporaryFolder("IMDIArchiveHelperTestFolder"); _model = new IMDIArchivingDlgViewModel(kAppName, kTitle, kArchiveId, null, true, SetFilesToArchive, _tmpFolder.Path); }
public void Setup() { ErrorReport.IsOkToInteractWithUser = false; _tmpFolder = new TemporaryFolder("IMDIArchiveHelperTestFolder"); _model = new IMDIArchivingDlgViewModel(kAppName, kTitle, kArchiveId, null, true, dummyAction => { }, _tmpFolder.Path); _messages = new List <MessageData>(); _model.OnDisplayMessage += (msg, type) => { _messages.Add(new MessageData(msg, type)); }; }
internal static Project Project = null; // Set for testing /// ------------------------------------------------------------------------------------ internal static void ArchiveUsingIMDI(IIMDIArchivable element) { var destFolder = Program.CurrentProject.IMDIOutputDirectory; // Move IMDI export folder to be under the mydocs/saymore if (string.IsNullOrEmpty(destFolder)) { destFolder = Path.Combine(NewProjectDlgViewModel.ParentFolderPathForNewProject, "IMDI Packages"); } // SP-813: If project was moved, the stored IMDI path may not be valid, or not accessible if (!CheckForAccessiblePath(destFolder)) { destFolder = Path.Combine(NewProjectDlgViewModel.ParentFolderPathForNewProject, "IMDI Packages"); } // now that we added a separate title field for projects, make sure it's not empty var title = string.IsNullOrEmpty(element.Title) ? element.Id : element.Title; var model = new IMDIArchivingDlgViewModel(Application.ProductName, title, element.Id, element.ArchiveInfoDetails, element is Project, element.SetFilesToArchive, destFolder) { HandleNonFatalError = (exception, s) => ErrorReport.NotifyUserOfProblem(exception, s) }; element.InitializeModel(model); using (var dlg = new IMDIArchivingDlg(model, ApplicationContainer.kSayMoreLocalizationId, Program.DialogFont, Settings.Default.ArchivingDialog)) { dlg.ShowDialog(Program.ProjectWindow); Settings.Default.ArchivingDialog = dlg.FormSettings; // remember choice for next time if (model.OutputFolder != Program.CurrentProject.IMDIOutputDirectory) { Program.CurrentProject.IMDIOutputDirectory = model.OutputFolder; Program.CurrentProject.Save(); } } }
/// ------------------------------------------------------------------------------------ public void InitializeModel(IMDIArchivingDlgViewModel model) { //Set project metadata here. model.OverrideDisplayInitialSummary = fileLists => DisplayInitialArchiveSummary(fileLists, model); ArchivingHelper.SetIMDIMetadataToArchive(this, model); }