示例#1
0
        /// <summary>
        /// The OnSaveRecordButton_Clicked
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>The source of the event.</param>
        /// <param name="e">The e<see cref="EventArgs"/>Instance containing the event data.</param>
        private void OnSaveRecordButton_Clicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var authorOp = new AuthorsTextOperations();
            var fileName = string.Empty;

            if (this.rbtnOneAuthor.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text);
            }
            else if (this.rbtnTwoAuthors.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text, this.txtSecondAuthor.Text);
            }
            else if (this.rbtnThreeAuthors.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text, this.txtSecondAuthor.Text, this
                                                   .txtThirdAuthor.Text);
            }

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            if (!Directory.Exists(dirAuthors))
            {
                return;
            }

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors, fileName);

            DirectoryFileOperationsClass.CreateNewFile(filePath);
        }