private void ManageButtonsAtIdleTime(object sender, EventArgs e)
        {
            if (_disposed)             //could happen if a version update was detected on app launch
            {
                return;
            }

            switch (_buttonManagementStage)
            {
            case ButtonManagementStage.LoadPrimary:
                LoadPrimaryCollectionButtons();
                _buttonManagementStage = ButtonManagementStage.ImprovePrimary;
                _primaryCollectionFlow.Refresh();
                break;

            //here we do any expensive fix up of the buttons in the primary collection (typically, getting vernacular captions, which requires reading their html)
            case ButtonManagementStage.ImprovePrimary:
                if (_buttonsNeedingSlowUpdate.IsEmpty)
                {
                    _buttonManagementStage = ButtonManagementStage.LoadSourceCollections;
                }
                else
                {
                    ImproveAndRefreshBookButtons();
                }
                break;

            case ButtonManagementStage.LoadSourceCollections:
                LoadSourceCollectionButtons();
                _buttonManagementStage = ButtonManagementStage.ImproveAndRefresh;
                if (Program.PathToBookDownloadedAtStartup != null)
                {
                    // We started up with a command to downloaded a book...Select it.
                    SelectBook(new BookInfo(Program.PathToBookDownloadedAtStartup, false));
                }
                break;

            case ButtonManagementStage.ImproveAndRefresh:
                ImproveAndRefreshBookButtons();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
        private void ManageButtonsAtIdleTime(object sender, EventArgs e)
        {
            if (_disposed) //could happen if a version update was detected on app launch
                return;

            switch (_buttonManagementStage)
            {
                case ButtonManagementStage.LoadPrimary:
                    LoadPrimaryCollectionButtons();
                    _buttonManagementStage = ButtonManagementStage.ImprovePrimary;
                    _primaryCollectionFlow.Refresh();
                    break;

                //here we do any expensive fix up of the buttons in the primary collection (typically, getting vernacular captions, which requires reading their html)
                case ButtonManagementStage.ImprovePrimary:
                    if (_buttonsNeedingSlowUpdate.IsEmpty)
                    {
                        _buttonManagementStage = ButtonManagementStage.LoadSourceCollections;
                    }
                    else
                    {
                        ImproveAndRefreshBookButtons();
                    }
                    break;
                case ButtonManagementStage.LoadSourceCollections:
                    LoadSourceCollectionButtons();
                    _buttonManagementStage = ButtonManagementStage.ImproveAndRefresh;
                    if (Program.PathToBookDownloadedAtStartup != null)
                    {
                        // We started up with a command to downloaded a book...Select it.
                        SelectBook(new BookInfo(Program.PathToBookDownloadedAtStartup, false));
                    }
                    break;
                case ButtonManagementStage.ImproveAndRefresh:
                    // GJM Sept 23 2015: BL-2778 Concern about memory leaks led to not updating thumbnails on
                    // source collections for new books. To undo, uncomment ImproveAndRefreshBookButtons()
                    // and comment out removing the event handler.
                    //ImproveAndRefreshBookButtons();
                    Application.Idle -= ManageButtonsAtIdleTime; // stop running to this to do nothing.
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 3
0
        private void ManageButtonsAtIdleTime(object sender, EventArgs e)
        {
            if (_disposed) //could happen if a version update was detected on app launch
                return;

            switch (_buttonManagementStage)
            {
                case ButtonManagementStage.LoadPrimary:
                    LoadPrimaryCollectionButtons();
                    _buttonManagementStage = ButtonManagementStage.ImprovePrimary;
                    _primaryCollectionFlow.Refresh();
                    break;

                //here we do any expensive fix up of the buttons in the primary collection (typically, getting vernacular captions, which requires reading their html)
                case ButtonManagementStage.ImprovePrimary:
                    if (_buttonsNeedingSlowUpdate.IsEmpty)
                    {
                        _buttonManagementStage = ButtonManagementStage.LoadSourceCollections;
                    }
                    else
                    {
                        ImproveAndRefreshBookButtons();
                    }
                    break;
                case ButtonManagementStage.LoadSourceCollections:
                    LoadSourceCollectionButtons();
                    _buttonManagementStage = ButtonManagementStage.ImproveAndRefresh;
                    break;
                case ButtonManagementStage.ImproveAndRefresh:
                    ImproveAndRefreshBookButtons();
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }