Initialize2() public method

Initialize the header and message before showing the dialog used whenever a file from outside LangProject.LinkedFilesRootDir is linked from this project to find out whether the user wants to move or copy into LangProject.LinkedFilesRootDir or to leave the file where it is.
public Initialize2 ( string sRootDir, IHelpTopicProvider helpTopicProvider, bool isLocal ) : void
sRootDir string
helpTopicProvider IHelpTopicProvider
isLocal bool
return void
Exemplo n.º 1
0
        private static string MoveCopyOrLeaveFile(string sFile, string subFolder, string sRootDirExternalLinks,
                                                  IHelpTopicProvider helpTopicProvider, bool isLocal)
        {
            try
            {
                if (!Directory.Exists(subFolder))
                {
                    Directory.CreateDirectory(subFolder);
                }
            }
            catch (Exception e)
            {
                Logger.WriteEvent(String.Format("Error creating the directory: '{0}'", subFolder));
                Logger.WriteError(e);
                return(sFile);
            }

            // Check whether the file is found within the directory.  If so, just return.
            if (FileIsInExternalLinksFolder(sFile, sRootDirExternalLinks))
            {
                return(sFile);
            }

            using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg())
            {
                dlg.Initialize2(sFile, subFolder, helpTopicProvider, isLocal);
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return(null);                       // leave where it is.
                }
                return(PerformMoveCopyOrLeaveFile(sFile, subFolder, dlg.Choice));
            }
        }
		private static string[] MoveCopyOrLeaveFiles(string[] files, string subFolder, string sRootDirExternalLinks,
			IHelpTopicProvider helpTopicProvider, bool isLocal)
		{
			try
			{
				if (!Directory.Exists(subFolder))
					Directory.CreateDirectory(subFolder);
			}
			catch (Exception e)
			{
				Logger.WriteEvent(string.Format("Error creating the directory: '{0}'", subFolder));
				Logger.WriteError(e);
				return files;
			}

			// Check whether the file is found within the directory.
			if (files.All(f => FileIsInExternalLinksFolder(f, sRootDirExternalLinks)))
				return files;

			using (var dlg = new MoveOrCopyFilesDlg())
			{
				dlg.Initialize2(subFolder, helpTopicProvider, isLocal);
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					FileLocationChoice choice = dlg.Choice;
					return files.Select(f => PerformMoveCopyOrLeaveFile(f, subFolder, choice)).ToArray();
				}

				return files;
			}
		}
Exemplo n.º 3
0
        private static string[] MoveCopyOrLeaveFiles(string[] files, string subFolder, string sRootDirExternalLinks,
                                                     IHelpTopicProvider helpTopicProvider)
        {
            try
            {
                if (!Directory.Exists(subFolder))
                {
                    Directory.CreateDirectory(subFolder);
                }
            }
            catch (Exception e)
            {
                Logger.WriteEvent(string.Format("Error creating the directory: '{0}'", subFolder));
                Logger.WriteError(e);
                return(files);
            }

            // Check whether the file is found within the directory.
            if (files.All(f => FileIsInExternalLinksFolder(f, sRootDirExternalLinks)))
            {
                return(files);
            }

            using (var dlg = new MoveOrCopyFilesDlg())
            {
                dlg.Initialize2(subFolder, helpTopicProvider);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    FileLocationChoice choice = dlg.Choice;
                    return(files.Select(f => PerformMoveCopyOrLeaveFile(f, subFolder, choice)).ToArray());
                }

                return(files);
            }
        }
Exemplo n.º 4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Checks to see whether the given file is located in the given root directory (or any
        /// subfolder of it) and if not prompts the user to allow FW to move, copy or leave the
        /// file.
        /// </summary>
        /// <param name="sFile">The fully-specified path name of the file.</param>
        /// <param name="sRootDir">The fully-specified path name of the external links root
        /// directory.</param>
        /// <param name="helpTopicProvider">The help topic provider.</param>
        /// <returns>The fully specified path name of the file to use, which might be the same
        /// as the given path or it could be in its new location under the external links folder
        /// if the user elected to move or copy it.</returns>
        /// ------------------------------------------------------------------------------------
        public static string MoveCopyOrLeaveFile(string sFile, string sRootDir,
                                                 IHelpTopicProvider helpTopicProvider)
        {
            // Check whether the file is found within the directory.  If so, just return.
            if (FileIsInExternalLinksFolder(sFile, sRootDir))
            {
                return(sFile);
            }

            using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg())
            {
                dlg.Initialize2(sFile, sRootDir, helpTopicProvider);
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return(null);                       // leave where it is.
                }
                return(PerformMoveCopyOrLeaveFile(sFile, sRootDir, dlg.Choice));
            }
        }
Exemplo n.º 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Checks to see whether the given file is located in the given root directory (or any
		/// subfolder of it) and if not prompts the user to allow FW to move, copy or leave the
		/// file.
		/// </summary>
		/// <param name="sFile">The fully-specified path name of the file.</param>
		/// <param name="sRootDir">The fully-specified path name of the external links root
		/// directory.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <returns>The fully specified path name of the file to use, which might be the same
		/// as the given path or it could be in its new location under the external links folder
		/// if the user elected to move or copy it.</returns>
		/// ------------------------------------------------------------------------------------
		public static string MoveCopyOrLeaveFile(string sFile, string sRootDir,
			IHelpTopicProvider helpTopicProvider)
		{
			// Check whether the file is found within the directory.  If so, just return.
			if (FileIsInExternalLinksFolder(sFile, sRootDir))
				return sFile;

			using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg())
			{
				dlg.Initialize2(sFile, sRootDir, helpTopicProvider);
				if (dlg.ShowDialog() != DialogResult.OK)
					return null;	// leave where it is.
				return PerformMoveCopyOrLeaveFile(sFile, sRootDir, dlg.Choice);
			}
		}
Exemplo n.º 6
0
		private static string MoveCopyOrLeaveFile(string sFile, string subFolder, string sRootDirExternalLinks,
			IHelpTopicProvider helpTopicProvider, bool isLocal)
		{
			try
			{
				if (!Directory.Exists(subFolder))
					Directory.CreateDirectory(subFolder);
			}
			catch (Exception e)
			{
				Logger.WriteEvent(String.Format("Error creating the directory: '{0}'", subFolder));
				Logger.WriteError(e);
				return sFile;
			}

			// Check whether the file is found within the directory.  If so, just return.
			if (FileIsInExternalLinksFolder(sFile, sRootDirExternalLinks))
				return sFile;

			using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg())
			{
				dlg.Initialize2(sFile, subFolder, helpTopicProvider, isLocal);
				if (dlg.ShowDialog() != DialogResult.OK)
					return null;	// leave where it is.
				return PerformMoveCopyOrLeaveFile(sFile, subFolder, dlg.Choice);
			}
		}