/// ********************************************************************************
 /// <summary>
 /// Place all the user names from the collection into the list box.
 /// User can then select there name and get all of there spelling list.
 /// </summary>
 /// <created>art2m,5/20/2019</created>
 /// <changed>art2m,5/23/2019</changed>
 /// ********************************************************************************
 private void FillListBoxWithUserNames()
 {
     for (var index = 0; index < UsersNameCollection.ItemsCount(); index++)
     {
         this.lstUsers.Items.Add(UsersNameCollection.GetItemAt(index));
     }
 }
        /// ********************************************************************************
        /// <summary>
        /// Place all the user names from the collection into the list box.
        /// User can then select there name and get all of there spelling list.
        /// </summary>
        /// <created>art2m,5/20/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private void FillListBoxWithUserNames()
        {
            var userNames = new UsersNameCollection();

            for (var index = 0; index < userNames.ItemsCount(); index++)
            {
                this.lstUsers.Items.Add(userNames.GetItemAt(index));
            }
        }
        private static bool OverWriteUserNameFile(string filePath)
        {
            try
            {
                MyMessagesClass.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                using (var writer = new StreamWriter(filePath, false))
                {
                    for (var index = 0; index < UsersNameCollection.ItemsCount(); index++)
                    {
                        writer.WriteLine(UsersNameCollection.GetItemAt(index));
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        /// ********************************************************************************
        /// <summary>
        ///     OverWrite file using the User Collection after a user has been removed from
        ///     the list.
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        /// <created>art2m,5/28/2019</created>
        /// <changed>art2m,5/28/2019</changed>
        /// ********************************************************************************
        private static bool OverWriteUserNameFile(string filePath)
        {
            try
            {
                MyMessagesClass.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                using (var writer = new StreamWriter(filePath, false))
                {
                    for (var index = 0; index < UsersNameCollection.ItemsCount(); index++)
                    {
                        writer.WriteLine(UsersNameCollection.GetItemAt(index));
                    }
                }

                return(true);
            }
            catch (ArgumentNullException ex)
            {
                MyMessagesClass.ErrorMessage = "The path variable contains a null string. " + filePath;

                Debug.WriteLine(ex.ToString());

                MyMessagesClass.ShowErrorMessageBox();

                return(false);
            }
            catch (ArgumentException ex)
            {
                MyMessagesClass.ErrorMessage = "The file path value is a null string. " + filePath;

                Debug.WriteLine(ex.ToString());

                MyMessagesClass.ShowErrorMessageBox();

                return(false);
            }
            catch (DirectoryNotFoundException ex)
            {
                MyMessagesClass.ErrorMessage = "Unable to locate the directory.";

                Debug.WriteLine(ex.ToString());

                MyMessagesClass.ShowErrorMessageBox();

                return(false);
            }
            catch (PathTooLongException ex)
            {
                MyMessagesClass.ErrorMessage = "the file path is to long.";

                Debug.WriteLine(ex.ToString());

                MyMessagesClass.ShowErrorMessageBox();

                return(false);
            }
            catch (SecurityException ex)
            {
                MyMessagesClass.ErrorMessage = "The operation has caused a security violation.";

                Debug.WriteLine(ex.ToString());

                return(false);
            }
            catch (IOException ex)
            {
                MyMessagesClass.ErrorMessage = "File path has invalid characters in it. " + filePath;

                Debug.WriteLine(ex.ToString());

                MyMessagesClass.ShowErrorMessageBox();

                return(false);
            }
        }