Exemplo n.º 1
0
 public void SetButton(int newIndex, Category category, CategoryPanel categoryPanel)
 {
     this.category      = category;
     this.categoryPanel = categoryPanel;
     index           = newIndex;
     buttonName.text = category.CategoryName;
     icon.sprite     = category.Icon;
 }
Exemplo n.º 2
0
 private void initializeCategories()
 {
     foreach (Category c in this.categories.Values)
     {
         CategoryPanel category = new CategoryPanel(c);
         pMenu.Controls.Add(category);
     }
 }
Exemplo n.º 3
0
 public LibraryPage(MainWindow window, string search = null)
 {
     this.window = window;
     InitializeComponent();
     LoadLibrary();
     CategoryPanel.Focus();
     if (search != null)
     {
         Thread.Sleep(10);
         CategoryPanel.SelectedItem = search;
     }
 }
Exemplo n.º 4
0
        private bool ClosePage()
        {
            CategoryPanel cp = _pages[(int)_currentPageID];

            if (!cp.Commit(_options))
            {
                return(false);
            }
            this.Controls.Remove(cp);
            PanelItemAt(_currentPageID).Selected = false;
            _categoryItems.Invalidate(true);
            return(true);
        }
Exemplo n.º 5
0
        private void ShowPage(PageID p)
        {
            if (_pages[(int)p] == null)
            {
                _pages[(int)p] = CreatePage(p);
            }

            _currentPageID = p;
            CategoryPanel cp = _pages[(int)p];

            cp.InitUI(_options);
            this.Controls.Add(cp);
            PanelItemAt(p).Selected = true;
            _categoryItems.Invalidate(true);
        }
Exemplo n.º 6
0
    void Awake()
    {
        _popupManager = FindObjectOfType <PopupManager>();
        if (_popupManager == null)
        {
            return;
        }

        _gameManager   = FindObjectOfType <GameManager>();
        _categoryPanel = GetComponentInChildren <CategoryPanel>();

        foreach (var item in categoryScrollerCanvases)
        {
            item.Init(this);
        }

        _canvas = GetComponent <Canvas>();
        HideCanvas();
    }
Exemplo n.º 7
0
        private CategoryPanel CreatePage(PageID p)
        {
            CategoryPanel panel = null;

            switch (p)
            {
            case PageID.Display:
                panel = new DisplayOptionPanel();
                break;

            case PageID.Terminal:
                panel = new TerminalOptionPanel();
                break;

            case PageID.Peripheral:
                panel = new PeripheralOptionPanel();
                break;

            case PageID.Command:
                panel = new CommandOptionPanel();
                break;

            case PageID.SSH:
                panel = new SSHOptionPanel();
                break;

            case PageID.Connection:
                panel = new ConnectionOptionPanel();
                break;

            case PageID.Generic:
                panel = new GenericOptionPanel();
                break;
            }

            Debug.Assert(panel != null);
            panel.BorderStyle = BorderStyle.FixedSingle;
            panel.Location    = new Point(_categoryItems.Right + 4, _categoryItems.Top);
            panel.Size        = new Size(this.Width - _categoryItems.Width - 16, _categoryItems.Height);
            return(panel);
        }
    /// <summary>
    /// Gets <c>CategoryPanel</c> instance for the input settings group.
    /// </summary>
    /// <param name="group"><c>SettingsCategoryInfo</c> instance representing settings group</param>
    /// <param name="groupNo">Number representing index of the processing settings group</param>
    private CategoryPanel GetCategoryPanel(SettingsCategoryInfo group, int groupNo)
    {
        string title;

        if (IsSearchTextValid)
        {
            var categories    = SettingsCategoryInfoProvider.GetCategoriesOnPath(group.CategoryIDPath);
            var categoryNames = categories.Select(c =>
            {
                var displayName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(c.CategoryDisplayName));
                if (c.CategoryIsGroup)
                {
                    return(displayName);
                }

                var url = string.Format("~/CMSModules/Settings/Pages/Categories.aspx?selectedCategoryId={0}&selectedSiteId={1}", c.CategoryID, SiteID);
                url     = ResolveUrl(url);

                var name = string.Format("<a href=\"\" onclick=\"selectCategory('{0}');\">{1}</a>", url, displayName);
                return(name);
            });
            title = categoryNames.Join(" > ");
        }
        else
        {
            title = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(group.CategoryDisplayName));
        }

        var panel = new CategoryPanel
        {
            ID = string.Format(@"CategoryPanel{0}", groupNo),
            DisplayRightPanel = false,
            AllowCollapsing   = false,
            Text     = title,
            RenderAs = HtmlTextWriterTag.Div
        };

        return(panel);
    }
    /// <summary>
    /// Gets <c>CategoryPanel</c> instance for the input settings group.
    /// </summary>
    /// <param name="group"><c>SettingsCategoryInfo</c> instance representing settings group</param>
    /// <param name="groupNo">Number representing index of the processing settings group</param>
    private CategoryPanel GetCategoryPanel(SettingsCategoryInfo group, int groupNo)
    {
        string title;
        if (IsSearchTextValid)
        {
            var categories = SettingsCategoryInfoProvider.GetCategoriesOnPath(group.CategoryIDPath);
            var categoryNames = categories.Cast<SettingsCategoryInfo>().Select(c =>
            {
                var displayName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(c.CategoryDisplayName));
                if (c.CategoryIsGroup)
                {
                    return displayName;
                }

                var url = string.Format("~/CMSModules/Settings/Pages/Categories.aspx?selectedCategoryId={0}&selectedSiteId={1}", c.CategoryID, SiteID);
                url = ResolveUrl(url);

                var name = string.Format("<a href=\"\" onclick=\"selectCategory('{0}');\">{1}</a>", url, displayName);
                return name;
            });
            title = categoryNames.Join(" > ");
        }
        else
        {
            title = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(group.CategoryDisplayName));
        }

        var panel = new CategoryPanel
        {
            ID = string.Format(@"CategoryPanel{0}", groupNo),
            DisplayRightPanel = false,
            AllowCollapsing = false,
            Text = title,
            RenderAs = HtmlTextWriterTag.Div
        };

        return panel;
    }
    /// <summary>
    /// Gets <c>CategoryPanel</c> instance for the input settings group.
    /// </summary>
    /// <param name="group"><c>SettingsCategoryInfo</c> instance representing settings group</param>
    /// <param name="groupNo">Number representing index of the proccesing settings group</param>
    /// <returns><c>CategoryPanel</c> object.</returns>
    private CategoryPanel GetCategoryPanel(SettingsCategoryInfo group, int groupNo)
    {
        CategoryPanel p = new CategoryPanel();
        p.ID = string.Format(@"CategoryPanel{0}", groupNo);
        p.DisplayActions = false;
        p.AllowCollapsing = false;

        if ((!string.IsNullOrEmpty(mSearchText)) && (mSearchText.Length >= mSearchLimit))
        {
            p.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(GetCategoryNames(group.CategoryIDPath)));
        }
        else
        {
            p.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(group.CategoryDisplayName));
        }
        return p;
    }
 /// <summary>
 /// Adds input text as <c>LiteralControl</c> to the controls colection of the input <c>CategoryPanel</c>.
 /// </summary>
 /// <param name="p"><c>CategoryPanel</c> instance</param>
 /// <param name="text">Text representing <c>LiteralControl</c></param>
 private void AddLiteral(CategoryPanel p, string text)
 {
     p.Controls.Add(new LiteralControl(text));
 }
 /// <summary>
 /// Adds input control into the controls collection of the input category panel.
 /// </summary>
 /// <param name="p"><c>CategoryPanel</c> whose control collection should be modified</param>
 /// <param name="ctl">Control that should be added to the <c>CategoryPanel</c> controls collection</param>
 /// <param name="literalBefore">If not <c>null</c> new <c>LiteralControl</c> will be added before the control</param>
 /// <param name="literalAfter">If not <c>null</c> new <c>LiteralControl</c> will be added after the control</param>
 private void AddControl(CategoryPanel p, Control ctl, string literalBefore, string literalAfter)
 {
     if (!string.IsNullOrEmpty(literalBefore))
     {
         p.Controls.Add(new LiteralControl(literalBefore));
     }
     if (ctl != null)
     {
         p.Controls.Add(ctl);
     }
     if (!string.IsNullOrEmpty(literalAfter))
     {
         p.Controls.Add(new LiteralControl(literalAfter));
     }
 }