Bloom.CollectionTab.LibraryListView.OnClickBook C# (CSharp) Method

OnClickBook() private method

private OnClickBook ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void OnClickBook(object sender, EventArgs e)
        {
            var thisBtn = (Button)sender;

            if (!IsUsableBook(thisBtn))
            {
                MessageBox.Show(LocalizationManager.GetString("CollectionTab.HiddenBookExplanationForSourceCollections", "Because this is a source collection, Bloom isn't offering any existing shells as sources for new shells. If you want to add a language to a shell, instead you need to edit the collection containing the shell, rather than making a copy of it. Also, the Wall Calendar currently can't be used to make a new Shell."));
                return;
            }
            var bookInfo = GetBookInfoFromButton(thisBtn);
            if (bookInfo == null)
                return;

            var lastClickTime = _lastClickTime;
            _lastClickTime = DateTime.Now;

            try
            {
                if (SelectedBook != null && bookInfo == SelectedBook.BookInfo)
                {
                    //I couldn't get the DoubleClick event to work, so I rolled my own
                    if (Control.MouseButtons == MouseButtons.Left &&
                        DateTime.Now.Subtract(lastClickTime).TotalMilliseconds < SystemInformation.DoubleClickTime)
                    {
                        _model.DoubleClickedBook();
                    }
                    else
                    {
                        // detect click on book dropdown menu
                        var pt = thisBtn.PointToClient(MousePosition);
                        if ((pt.X > thisBtn.Width - 12) && (pt.Y > thisBtn.Height - 12))
                        {
                            _bookTriangle_Click(thisBtn, pt);
                        }
                    }
                    return; // already selected, nothing to do.
                }
            }
            catch (Exception error) // Review: is this needed now bulk of method refactored into SelectBook?
            {
                //skip over the dependency injection layer
                if (error.Source == "Autofac" && error.InnerException != null)
                    error = error.InnerException;

                SIL.Reporting.ErrorReport.NotifyUserOfProblem(error, "Bloom cannot display that book.");
            }
            SelectBook(bookInfo);
        }