示例#1
0
        private void DisplayScore(BaseScore score)
        {
            if (score.IsContainer())
            {
                return;
            }

            string[][] results = ScoreFactory.Parse(score, false, m_center.Parameters);
            m_currentLine   = 0;
            m_currentColumn = 0;
            m_lines         = results;
            ShowNextButton(false);
            ShowNextPrevScoreButtons(true);

            lock (m_lock) CreateGrid(results, score, 0, 0);
        }
示例#2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="parent"></param>
        public CreateScoreDlg(BaseScore parent)
        {
            InitializeComponent();

            rbnNone.Checked = true;
            if (parent != null)
            {
                rbnParent.Text    = parent.Name;
                rbnParent.Checked = parent.IsContainer();
                rbnParent.Enabled = rbnParent.Checked;
                m_parentId        = parent.Id;
            }
            else
            {
                rbnParent.Visible = false;
            }

            cbxType.DataSource = ScoreFactory.Instance.GetScoreTypes();
            tbxName.Text       = Properties.Resources.NewItem;
        }
示例#3
0
        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);
        }
示例#4
0
        protected override void OnShowContextMenu()
        {
            GUIListItem item      = lstDetails.SelectedListItem;
            BaseScore   itemScore = item.TVTag as BaseScore;

            int menuIndice = 1;

            #region Create Menu
            GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            menu.Reset();
            menu.SetHeading(m_center.Setup.Name);

            // configure
            menu.Add(LocalizationManager.GetString(Labels.Configuration));
            int menuConfigure = menuIndice++;

            // enable/disable live
            if (m_liveEnabled)
            {
                menu.Add(LocalizationManager.GetString(Labels.StopLive));
            }
            else
            {
                menu.Add(LocalizationManager.GetString(Labels.StartLive));
            }
            int menuLive = menuIndice++;

            // clear all live
            int menuClearLive = 0;
            if (!m_liveEnabled)
            {
                menu.Add(LocalizationManager.GetString(Labels.ClearLive));
                menuClearLive = menuIndice++;
            }

            int menuDelete  = 0;
            int menuSetHome = 0;
            int menuSetLive = 0;
            if (item.Label != "..")
            {
                // disable
                menu.Add(LocalizationManager.GetString(Labels.DisableItem, item.Label));
                menuDelete = menuIndice++;

                // set home
                if (!itemScore.IsContainer())
                {
                    menu.Add(LocalizationManager.GetString(Labels.SetAsHome));
                    menuSetHome = menuIndice++;
                }

                if (!m_liveEnabled && itemScore.CanLive())
                {
                    // set live
                    menu.Add(LocalizationManager.GetString(item.PinImage == m_livePinImage ? Labels.DisableLive : Labels.ActivateLive, item.Label));
                    menuSetLive = menuIndice++;
                }
            }

            #endregion

            // show the menu
            menu.DoModal(GetID);

            #region process user action
            if (menu.SelectedId == menuLive)
            {
                SetLiveSettings();
            }
            else if (menu.SelectedId == menuClearLive)
            {
                ClearLiveSettings();
            }
            else if (menu.SelectedId == menuConfigure)
            {
                ShowConfigurationMenu();
            }
            else if (menu.SelectedId == menuDelete)
            {
                GUIDialogYesNo dlg     = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
                string         disable = LocalizationManager.GetString(Labels.DisableItem, item.Label);
                dlg.SetHeading(m_center.Setup.Name);
                dlg.SetLine(1, LocalizationManager.GetString(Labels.DisableItem, item.Label) + " ?");
                dlg.DoModal(GetID);

                if (dlg.IsConfirmed)
                {
                    m_center.DisableScore(itemScore);
                    SaveSettings();
                }
            }
            else if (menu.SelectedId == menuSetHome)
            {
                m_center.SetHomeScore(itemScore);
                SaveSettings();
            }
            else if (menu.SelectedId == menuSetLive)
            {
                bool on = item.PinImage == m_livePinImage;
                m_center.SetLiveScore(itemScore, !on);
                string pin = "";
                if (!on)
                {
                    pin = m_livePinImage;
                }
                else if (itemScore.CanLive())
                {
                    pin = m_livePinImageDisabled;
                }

                item.PinImage = pin;
                SaveSettings();
                SetLiveStatus();
            }
            #endregion

            base.OnShowContextMenu();
        }