/// <summary>

        /// Called when the OK button has been pressed. Runs the resource saving

        /// code as a resource thread operation.

        /// </summary>

        public override void Save()

        {

            Core.ResourceAP.RunJob( new MethodInvoker( DoSave ) );

            Core.TextIndexManager.QueryIndexing( _book.Id );

        }

 

        /// <summary>

        /// Runs in the resource thread and saves the data entered by the user

        /// to the resource store.

        /// </summary>

        private void DoSave()

        {

            _book.SetProp( "Name", _edtName.Text );

            _book.DeleteLinks( PropTypes.BookAuthor );

           

            // Parse the list of author names separated with

            string[] authors = _edtAuthors.Text.Split( ',', ';' );

            foreach( string author in authors )

            {

                if ( author.Trim().Length == 0 )

                {

                    continue;

                }

                IContact contact = Core.ContactManager.FindOrCreateContact( null, author.Trim() );

                if ( contact != null )

                {

                    _book.AddLink( PropTypes.BookAuthor, contact.Resource );

                }

            }

 

            _book.SetProp( PropTypes.PubYear, (int) _udYear.Value );

 

            if ( _edtIsbn.Text.Length > 0 )

            {

                _book.SetProp( PropTypes.Isbn, _edtIsbn.Text );

            }

            else

            {

                _book.DeleteProp( PropTypes.Isbn );

            }

        }