Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        public void CheckDirectoryExistsCreateDirectory_TestDirectoryExistsOrIsCreated()
        {
            // Assign
            SpellingPropertiesClass.AppDataDirectoryPath =
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            var dirPath1 = SpellingPropertiesClass.AppDataDirectoryPath;

            // Act
            var dirPath = DirectoryFileOperationsClass.CheckDirectoryExistsCreateDirectory(dirPath1);

            // Assert
            Assert.IsTrue(Directory.Exists(dirPath));
        }