コード例 #1
0
ファイル: SlidingMenu.cs プロジェクト: stjordanis/ra-ajax
        public void SlideTo(string path, bool animate)
        {
            List <string>   ids  = new List <string>(path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries));
            SlidingMenuItem item = Selector.Selector.FindControl <SlidingMenuItem>(this, ids[0]);

            ids.RemoveAt(0);
            OpenMenuItem(item, ids, ids.Count + 1, animate);
        }
コード例 #2
0
ファイル: SlidingMenu.cs プロジェクト: stjordanis/ra-ajax
        internal void RaiseItemClicked(SlidingMenuItem item)
        {
            if (ItemClicked != null)
            {
                ItemClicked(item, new EventArgs());
            }

            if (Navigate != null)
            {
                Navigate(this, new EventArgs());
            }
        }
コード例 #3
0
ファイル: SlidingMenu.cs プロジェクト: stjordanis/ra-ajax
        private void OpenMenuItem(SlidingMenuItem item, List <string> ids, int totalLevels, bool animate)
        {
            // Making sure item has loaded its children
            SlidingMenuLevel childLevel = item.FindChildLevel();

            if (childLevel == null)
            {
                // No more items underneath...
                childLevel   = item.Parent as SlidingMenuLevel;
                totalLevels -= (ids.Count + 1);
                ids.Clear();
            }
            else
            {
                if (childLevel.EnsureChildNodes())
                {
                    childLevel.ReRender();
                }
            }

            // Checking to see if we're finished
            if (ids.Count == 0)
            {
                // Wrapping up...
                SetAllChildrenNonVisible(this);
                ASP.Control idxFromThis = childLevel;
                while (idxFromThis != null && !(idxFromThis is SlidingMenu))
                {
                    if (idxFromThis is SlidingMenuLevel)
                    {
                        (idxFromThis as SlidingMenuLevel).Style["display"] = "";
                    }
                    idxFromThis = idxFromThis.Parent;
                }
                // Animating Menu levels...
                ASP.Control rootLevel = null;
                foreach (ASP.Control idx in Controls)
                {
                    if (idx is SlidingMenuLevel)
                    {
                        rootLevel = idx;
                        break;
                    }
                }
                BreadCrumb.Style["display"] = "gokk"; // To force a new value to the display property...
                if (animate)
                {
                    BreadCrumb.Style["display"] = "none";
                }
                if (ActiveLevel == null)
                {
                    if (!animate)
                    {
                        ((SlidingMenuLevel)rootLevel).Style[Styles.marginLeft] =
                            "-" + (100 * totalLevels) + "%";
                    }
                    else
                    {
                        new SlidingMenuItem.EffectRollOut(rootLevel,
                                                          BreadCrumb,
                                                          AnimationDuration,
                                                          false,
                                                          totalLevels)
                        .Render();
                    }
                }
                else
                {
                    if (!animate)
                    {
                        ((SlidingMenuLevel)rootLevel).Style[Styles.marginLeft] =
                            "-" + (100 * totalLevels) + "%";
                    }
                    else
                    {
                        new SlidingMenuItem.EffectRollOut(rootLevel,
                                                          BreadCrumb,
                                                          AnimationDuration,
                                                          true,
                                                          -1,
                                                          true)
                        .ChainThese(
                            new SlidingMenuItem.EffectRollOut(rootLevel,
                                                              BreadCrumb,
                                                              AnimationDuration,
                                                              false,
                                                              totalLevels))
                        .Render();
                    }
                }
                childLevel.Style["display"] = "";
                SetActiveLevel(childLevel);
            }
            else
            {
                SlidingMenuItem itemNext = Selector.Selector.FindControl <SlidingMenuItem>(childLevel, ids[0]);
                ids.RemoveAt(0);
                OpenMenuItem(itemNext, ids, totalLevels, animate);
            }
        }