예제 #1
0
        /// <summary>
        /// Gets the appropriate folder name for this author.
        /// </summary>
        /// <param name="author">The name of the author as it appears in the document.</param>
        /// <returns>The folder name, relative, with ending '\'.</returns>
        internal string GetFolderForAuthor(string author)
        {
            // Check for the author already being in the hash
            if( this.authorToFolderHash.ContainsKey(author) )
            {
                return (string) authorToFolderHash[author];
            }
            else
            {
                OptionsDialog od = new OptionsDialog();

                if( author == null )
                    author = "<Blank>";

                // Set the questionLabel, infoLabel, and options
                od.questionLabel.Text = "A document from a new author is being received."
                    + "Please select or type the name of the Section in which you would"
                    + "like the notes to be placed.";
                od.infoLabel.Text = "Author: " + author;
                od.options.Text = "";
                od.checkBox.Text = "Save this setting for this author.";
                od.checkBox.Checked = true;

                foreach( object obj in authorToFolderHash.Values )
                {
                    od.options.Items.Add( obj );
                }

                // Show the dialog
                od.ShowDialog();

                string foldername = od.options.Text.Trim();
                if( !foldername.EndsWith("\\") && foldername == "" )
                    foldername += "\\";

                // Save the setting if necessary
                if( od.checkBox.Checked )
                    authorToFolderHash.Add( author, foldername );

                // Retrieve the selection from the combo box and return it
                return foldername;
            }
        }
        /// <summary>
        /// Gets the appropriate folder name for this author.
        /// </summary>
        /// <param name="author">The name of the author as it appears in the document.</param>
        /// <returns>The folder name, relative, with ending '\'.</returns>
        internal string GetFolderForAuthor(string author)
        {
            // Check for the author already being in the hash
            if( this.authorToFolderHash.ContainsKey(author) )
            {
                return (string) authorToFolderHash[author];
            }
            else
            {
                OptionsDialog od = new OptionsDialog();

                if( author == null )
                    author = Strings.Blank;

                // Set the questionLabel, infoLabel, and options
                od.questionLabel.Text = Strings.DocumentFromNewAuthor;
                od.infoLabel.Text = string.Format(CultureInfo.CurrentCulture, Strings.Author, author);
                od.options.Text = string.Empty;
                od.checkBox.Text = Strings.SaveThisSetting;
                od.checkBox.Checked = true;

                foreach( object obj in authorToFolderHash.Values )
                {
                    od.options.Items.Add( obj );
                }

                // Show the dialog
                od.ShowDialog();

                string foldername = od.options.Text.Trim();
                if( !foldername.EndsWith("\\") && foldername == string.Empty )
                    foldername += "\\";

                // Save the setting if necessary
                if( od.checkBox.Checked )
                    authorToFolderHash.Add( author, foldername );

                // Retrieve the selection from the combo box and return it
                return foldername;
            }
        }