/// ********************************************************************************
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static void AddNewUserToUserNameFile()
        {
            MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var unc = new UsersNameCollection();

            if (unc.ContainsItem(SpellingPropertiesClass.UserName))
            {
                MyMessages.InformationMessage = "This user all ready exists.";
                MyMessages.ShowInformationMessageBox();
            }

            unc.AddItem(SpellingPropertiesClass.UserName);

            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperations.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            SpellingReadWriteClass.WriteUserNameFile(filePath);
        }
Example #2
0
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/17/2019</changed>
        private static void AddNewUserToUserNameFile()
        {
            // TODO: Make method for editing and deleting users from user file.

            // TODO: Make method for adding existing spelling lists to current user.

            var unc = new UsersNameCollection();

            if (unc.ContainsItem(SpellingPropertiesClass.UserName))
            {
                MyMessages.InformationMessage = "This user all ready exists.";
                MyMessages.ShowInformationMessageBox();
            }

            unc.AddItem(SpellingPropertiesClass.UserName);

            SpellingReadWriteClass.WriteUserNameFile();

            var dirPath = DirectoryFileOperations.CheckDirectoryPathExistsCreate();

            var retVal = DirectoryFileOperations.CreateUserSpellingListDirectory(dirPath);

            if (!retVal)
            {
                MyMessages.ErrorMessage = "Unable to create user directory.";
                MyMessages.ShowErrorMessageBox();
            }
        }
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/17/2019</changed>
        private static void AddNewUserToUserNameFile()
        {
            MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var unc = new UsersNameCollection();

            if (unc.ContainsItem(SpellingPropertiesClass.UserName))
            {
                MyMessages.InformationMessage = "This user all ready exists.";
                MyMessages.ShowInformationMessageBox();
            }

            unc.AddItem(SpellingPropertiesClass.UserName);

            SpellingReadWriteClass.WriteUserNameFile();

            var dirPath = DirectoryFileOperations.CheckDirectoryPathExistsCreate();

            var retVal = DirectoryFileOperations.CreateUserSpellingListDirectory(dirPath);

            if (retVal)
            {
                return;
            }

            MyMessages.ErrorMessage = "Unable to create user directory.";
            MyMessages.ShowErrorMessageBox();
        }
        /// <summary>
        /// if user enters text save it to user name.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Instance containing the event data.</param>
        private void OnButtonOk_Click(object sender, EventArgs e)
        {
            var name = this.txtUserName.Text.Trim();

            if (string.IsNullOrEmpty(name) || name.Length < 1)
            {
                SpellingPropertiesClass.UserName = string.Empty;
                return;
            }

            SpellingPropertiesClass.UserName = name;

            if (UsersNameCollection.ContainsItem(name))
            {
                MyMessagesClass.InformationMessage =
                    "This user name all ready exists. Go to select user name to use this name.";

                MyMessagesClass.ShowInformationMessageBox();

                return;
            }

            SpellingReadWriteClass.WriteUserNameFile(SpellingPropertiesClass.UserNameFilePath);

            var dirPath = DirectoryFileOperationsClass.CombineStringsMakeDirectoryPath(
                SpellingPropertiesClass.Art2MSpellDirectoryPath,
                SpellingPropertiesClass.UserName);


            DirectoryFileOperationsClass.CheckDirectoryExistsCreateDirectory(dirPath);
        }
        /// ********************************************************************************
        /// <summary>
        ///     Remove the user name from the All names listed file.
        /// </summary>
        /// <param name="filePath">The path to the file names list file.</param>
        /// <returns>True if successful else false.</returns>
        /// <created>art2m,5/23/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static bool ReadTheUserNameFileIntoCollection(string filePath)
        {
            var retVal = SpellingReadWriteClass.ReadUserNameFile(filePath);

            if (!retVal)

            {
                return(false);
            }

            retVal = UsersNameCollection.ContainsItem(SpellingPropertiesClass.UserName);

            if (!retVal)
            {
                return(false);
            }

            var index = UsersNameCollection.GetItemIndex(SpellingPropertiesClass.UserName);

            retVal = UsersNameCollection.RemoveItemAt(index);

            if (!retVal)
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/17/2019</changed>
        private static void AddNewUserToUserNameFile()
        {
            MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var unc = new UsersNameCollection();

            if (unc.ContainsItem(SpellingPropertiesClass.UserName))
            {
                MyMessages.InformationMessage = "This user all ready exists.";
                MyMessages.ShowInformationMessageBox();
            }

            unc.AddItem(SpellingPropertiesClass.UserName);

            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var filePath = DirectoryFileOperations.CombineStringsMakeFilePath()


                           SpellingReadWriteClass.WriteUserNameFile(filePath);

            MyMessages.ErrorMessage = "Unable to create user directory.";
            MyMessages.ShowErrorMessageBox();
        }
Example #7
0
        /// ********************************************************************************
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static void AddNewUserToUserNameFile()
        {
            NameOfMethod = MethodBase.GetCurrentMethod().Name;

            if (UsersNameCollection.ContainsItem(SpellingPropertiesClass.UserName))
            {
                InformationMessage = V2;
                ShowInformationMessageBox();
            }
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/17/2019</changed>
        private static void AddNewUserToUserNameFile()
        {
            // TODO: Make method for editing and deleting users from user file.

            // TODO: Make method for adding existing spelling lists to current user.

            SpellingReadWriteClass.WriteUserNameFile();

            var Unc = new UsersNameCollection();

            if (!Unc.ContainsItem(SpellingPropertiesClass.UserName))
            {
                Unc.AddItem(SpellingPropertiesClass.UserName);
            }
        }
        /// <summary>
        ///     Add new users name to theAr2mSpell User List file.
        /// </summary>
        /// <created>art2m,5/17/2019</created>
        /// <changed>art2m,5/17/2019</changed>
        private static void AddNewUserToUserNameFile()
        {
            // TODO: Make method for editing and deleting users from user file.

            // TODO: Make method for adding existing spelling lists to current user.

            var unc = new UsersNameCollection();

            if (unc.ContainsItem(SpellingPropertiesClass.UserName))
            {
                MyMessages.InformationMessage = "This user all ready exists.";
                MyMessages.ShowInformationMessageBox();
            }

            unc.AddItem(SpellingPropertiesClass.UserName);

            SpellingReadWriteClass.WriteUserNameFile();
        }
        /// <summary>
        /// if user enters text save it to user name.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Instance containing the event data.</param>
        private void OnButtonOk_Click(object sender, EventArgs e)
        {
            var name = this.txtUserName.Text.Trim();

            if (string.IsNullOrEmpty(name) || name.Length < 1)
            {
                SpellingPropertiesClass.UserName = string.Empty;
                return;
            }

            SpellingPropertiesClass.UserName = name;

            if (UsersNameCollection.ContainsItem(name))
            {
                MyMessagesClass.InformationMessage =
                    "This user name all ready exists. Go to select user name to use this name.";

                MyMessagesClass.sh
            }

            // TODO: May not be writting user name to file!
            SpellingReadWriteClass.WriteUserNameFile(filePath);
        }