예제 #1
0
        /// <summary>
        /// Gets file name for file "Save" operation</summary>
        /// <param name="pathName">File name</param>
        /// <param name="filter">File extension filter, e.g., "Setting file (*.xml;*.txt)|*.xml;*.txt|Any (*.*)|*.*"</param>
        /// <returns>Dialog result</returns>
        public FileDialogResult SaveFileName(ref string pathName, string filter)
        {
            CustomSaveFileDialog dialog = new CustomSaveFileDialog();

            dialog.Filter           = filter;
            dialog.RestoreDirectory = true;

            // Remove the path portion, if any, just as in ATF 3.5 and earlier. http://tracker.ship.scea.com/jira/browse/WWSATF-1406
            pathName        = Path.GetFileName(pathName);
            dialog.FileName = pathName;

            dialog.ForcedInitialDirectory = GetInitialDirectory();

            // Use Initial directory when force initial is empty
            if (string.IsNullOrEmpty(dialog.ForcedInitialDirectory))
            {
                dialog.ForcedInitialDirectory = InitialDirectory;
            }

            DialogResult result = dialog.ShowDialog(GetDialogOwner());

            if (result == DialogResult.OK)
            {
                pathName = dialog.FileName;
            }

            return(DialogResultToFileDialogResult(result));
        }
예제 #2
0
        /// <summary>
        /// Gets file name for file "Save" operation</summary>
        /// <param name="pathName">File name</param>
        /// <param name="filter">File extension filter, e.g., "Setting file (*.xml;*.txt)|*.xml;*.txt|Any (*.*)|*.*"</param>
        /// <returns>Dialog result</returns>
        public DialogResult SaveFileName(ref string pathName, string filter)
        {
            CustomSaveFileDialog dialog = new CustomSaveFileDialog();
            dialog.Filter = filter;
            dialog.RestoreDirectory = true;

            // Remove the path portion, if any, just as in ATF 3.5 and earlier. http://tracker.ship.scea.com/jira/browse/WWSATF-1406
            pathName = Path.GetFileName(pathName);
            dialog.FileName = pathName;
            
            dialog.ForcedInitialDirectory = GetInitialDirectory();

            DialogResult result = dialog.ShowDialog(GetDialogOwner());
            if (result == DialogResult.OK)
                pathName = dialog.FileName;

            return result;
        }