Exemplo n.º 1
0
        /// <summary>
        ///     Save the path to where user saved spelling list to.
        ///     Used to give user a selection of spelling lists to open.
        /// </summary>
        /// <created>art2m,5/19/2019</created>
        /// <changed>art2m,5/19/2019</changed>
        public static void SaveSpellingListPath()
        {
            MyMessagesClass.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var dirPath = SpellingPropertiesClass.CurrentUserSpellingListDirectory;

            DialogResult retVal;
            const string caption = "Name spelling list.";
            const string prompt  = "You must enter a name for this spelling list. It can be name and date.";

            using (var dlgInput = new InputDialog());
            {
                retVal = dlgInput.GetFileName(caption, prompt);
            }

            if (DialogResult.OK == retVal)
            {
                if (string.IsNullOrEmpty(SpellingPropertiesClass.UserSpellListName))
                {
                    MyMessagesClass.WarningMessage = "You need to name this file in order to save it.";
                    MyMessagesClass.ShowWarningMessageBox();
                    return;
                }

                var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(
                    dirPath,
                    SpellingPropertiesClass.UserSpellListName);
                WriteWordsToFile(filePath, Words);
            }
            else
            {
                MyMessagesClass.WarningMessage = "You need to name this file in order to save it.";
                MyMessagesClass.ShowWarningMessageBox();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Save the path to where user saved spelling list to.
        ///     Used to give user a selection of spelling lists to open.
        /// </summary>
        /// <created>art2m,5/19/2019</created>
        /// <changed>art2m,5/19/2019</changed>
        public static void SaveSpellingListPath()
        {
            MyMessagesClass.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var dirPath = SpellingPropertiesClass.CurrentUserSpellingListDirectory;

            DialogResult retVal;

            const string caption = "Name spelling list.";
            const string prompt  = "You must enter a name for this spelling list. It can be name and date.";

            var value = string.Empty;

            using (var dlgInput = new InputDialog())
            {
                retVal = dlgInput.GetFileName(caption, prompt, ref value);
            }

            dirPath = SpellingPropertiesClass.CurrentUserSpellingListDirectory;
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathFileNameCheckCreateFile(
                dirPath,
                value);


            WriteWordsToFile(filePath);
        }