예제 #1
0
		/// <summary>
		/// Moves the selected list items to a folder that is asked for by a dialog.
		/// </summary>
		/// <param name="ctrl">Project browse controller.</param>
		public static void CopySelectedListItemsToMultipleFolders(this ProjectBrowseController ctrl)
		{
			var list = ctrl.GetSelectedListItems();

			string originalFolderName = null;
			bool areDocumentsFromOneFolder = ctrl.IsProjectFolderSelected(out originalFolderName);

			var dlgDoc = new Altaxo.Gui.ProjectBrowser.CopyItemsToMultipleFolderData();
			dlgDoc.RelocateReferences = true;
			if (!Current.Gui.ShowDialog(ref dlgDoc, "Select folders to copy to", false))
				return;

			foreach (var newFolderName in dlgDoc.FoldersToCopyTo)
			{
				DocNodePathReplacementOptions relocateOptions = null;
				if (true == dlgDoc.RelocateReferences)
				{
					relocateOptions = new DocNodePathReplacementOptions();
					relocateOptions.AddPathReplacementsForAllProjectItemTypes(originalFolderName, newFolderName);
				}
				Current.Project.Folders.CopyItemsToFolder(list, newFolderName, null != relocateOptions ? relocateOptions.Visit : (DocNodeProxyReporter)null, dlgDoc.OverwriteExistingItems);
			}
		}
예제 #2
0
		/// <summary>
		/// Copy the items given in the list (tables and graphs) to a folder, which is selected by the user via a dialog box.
		/// </summary>
		/// <param name="list">List of items to delete.</param>
		/// <param name="areDocumentsFromOneFolder">If true, the list contains objects origination from only one project folder (or from subfolders of that folder). In this case the paramenter <c>originalSourceFolder</c> contains the original project folder from which the items should be copied.</param>
		/// <param name="originalSourceFolder">Original folder from which the items originate (only valid if <c>areDocumentsFromOneFolder</c> is true.</param>
		public static void CopyDocuments(IList<object> list, bool areDocumentsFromOneFolder, string originalSourceFolder)
		{
			var names = Current.Project.Folders.GetSubfoldersAsDisplayFolderNameStringList(ProjectFolder.RootFolderName, true);
			names.Insert(0, rootFolderDisplayName);
			var choices = new TextChoice(names.ToArray(), 0, true) { Description = "Choose or enter the folder to copy the items into:" };
			if (!Current.Gui.ShowDialog(ref choices, "Folder choice", false))
				return;
			string newFolderName = rootFolderDisplayName == choices.Text ? ProjectFolder.RootFolderName : ProjectFolder.ConvertDisplayFolderNameToFolderName(choices.Text);

			DocNodePathReplacementOptions relocateOptions = null;
			if (areDocumentsFromOneFolder)
			{
				var relocateData = Current.Gui.YesNoCancelMessageBox("Do you want to relocate the references in the copied plots so that they point to the destination folder?", "Question", null);
				if (null == relocateData)
					return;

				if (true == relocateData)
				{
					relocateOptions = new DocNodePathReplacementOptions();
					relocateOptions.AddPathReplacementsForAllProjectItemTypes(originalSourceFolder, newFolderName);
				}
			}

			Current.Project.Folders.CopyItemsToFolder(list, newFolderName, null != relocateOptions ? relocateOptions.Visit : (DocNodeProxyReporter)null, false);
		}