示例#1
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);
		}
示例#2
0
		public bool InitializeDocument(params object[] args)
		{
			if (null == args || 0 == args.Length || !(args[0] is TextChoice))
				return false;

			_doc = (TextChoice)args[0];
			return true;
		}
示例#3
0
		/// <summary>
		/// Move the items given in the list (tables and graphs) to a new location. The new location is ask for in a dialog.
		/// </summary>
		/// <param name="list">List of items to move.</param>
		public static void MoveDocuments(IList<object> list)
		{
			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 move the items into:" };
			if (!Current.Gui.ShowDialog(ref choices, "Folder choice", false))
				return;

			string newFolderName = rootFolderDisplayName == choices.Text ? ProjectFolder.RootFolderName : ProjectFolder.ConvertDisplayFolderNameToFolderName(choices.Text);
			Current.Project.Folders.MoveItemsToFolder(list, newFolderName);
		}