コード例 #1
0
ファイル: ScoreCenterGui.cs プロジェクト: mbekoe/scorecenter
        private void UpdateListView(BaseScore sc, bool back)
        {
            //Tools.LogMessage("UpdateListView: {0} back = {1}", item.Label, back);
            m_currentLine   = 0;
            m_currentColumn = 0;
            m_lines         = null;

            // clear grid and hide next button
            ShowNextButton(false);
            ShowNextPrevScoreButtons(false);
            lock (m_lock) ClearGrid();

            bool currIsFolder = (m_currentScore == null || m_currentScore.IsContainer());

            m_currentScore = sc;

            bool reselect = true;

            if (back)
            {
                if (!currIsFolder)
                {
                    m_level--;
                }
                m_level--;

                if (lstDetails.Visible)
                {
                    LoadScores(sc);
                }
                else
                {
                    lstDetails.Visible = true;
                    reselect           = false; // no need to reselect
                }

                if (reselect && m_prevIndex.Count > 0)
                {
                    // always pop
                    int prev = m_prevIndex.Pop();

                    // if enough set
                    if (lstDetails.Count > prev)
                    {
                        lstDetails.SelectedListItemIndex = prev;
                    }
                }
            }
            else
            {
                if (sc != null)
                {
                    sc.ResetRangeValue();
                }
                if (currIsFolder)
                {
                    m_level++;
                }

                if (sc.IsContainer())
                {
                    LoadScores(sc);
                }
                else
                {
                    DisplayScore();
                    lstDetails.Visible = (lblVisible == null || !lblVisible.Visible);
                    // pop the score index because it does not need to be reselected
                    m_prevIndex.Pop();
                }
            }

            SetScoreProperties(sc);
        }