Exemple #1
0
        public void PushPopTest()
        {
            var stack = new PageStack();

            Assert.That(stack.Count, Is.EqualTo(0));

            stack.Push(new Page {
                Name = "Page1", Data = null
            });
            Assert.That(stack.Count, Is.EqualTo(1));
            Assert.That(stack.Peek().Name, Is.EqualTo("Page1"));

            stack.Push(new Page {
                Name = "Page2", Data = null
            });
            Assert.That(stack.Count, Is.EqualTo(2));
            Assert.That(stack.Peek().Name, Is.EqualTo("Page2"));

            var page2 = stack.Pop();

            Assert.That(page2.Name, Is.EqualTo("Page2"));
            Assert.That(stack.Count, Is.EqualTo(1));
            Assert.That(stack.Peek().Name, Is.EqualTo("Page1"));

            var page1 = stack.Pop();

            Assert.That(page1.Name, Is.EqualTo("Page1"));
            Assert.That(stack.Count, Is.EqualTo(0));
        }
Exemple #2
0
    public static void Back(object result = null, Admission admision = null)
    {
        if (AdmissionManager.busing)
        {
            return;
        }
        var page = PageStack.Pop();

        if (page != null)
        {
            pagePool.Put(page.name, page);
        }
        if (PageStack.Count > 0)
        {
            var top = PageStack.Peek();
            Debug.Log("Back to: " + top.name);
            top.OnResult(result);
        }
        else
        {
            Debug.Log("All pages poped!");
        }
        if (admision != null)
        {
            AdmissionManager.Play(admision, page, PageStack.Peek());
        }
        RepositionMask();
    }
        public void GoBack()
        {
            var lastPage = CurrentPage;

            PageStack.Pop();
            CallOnNavigatedFrom(lastPage, CurrentPage);
        }
        private static void BackButton_Callback(Direction parameter)
        {
            if (PageStack.Count == 0)
            {
                return;
            }
            var page = PageStack.Pop();         // Remove current page.

            HidePage(page, parameter);          // Hide current page.
        }
Exemple #5
0
    public void OnGUI()
    {
        Instance = this;
        //if (disposer == null)
        //{
        //    disposer = InvertApplication.ListenFor<ICommandEvents>(this);
        //}

        //if (disposer2 == null)
        //{
        //    disposer2 = InvertApplication.ListenFor<INodeItemEvents>(this);
        //}
        GUIHelpers.IsInsepctor = false;
        // DrawTitleBar("uFrame Help");

        if (DocumentationProvider == null)
        {
            EditorGUILayout.HelpBox(string.Format("No Help Found"), MessageType.Info);
            return;
        }
        EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
        if (GUILayout.Button("Sidebar", EditorStyles.toolbarButton))
        {
            EditorPrefs.SetBool("uFrameHelpSidebar", !EditorPrefs.GetBool("uFrameHelpSidebar", true));
        }
        if (PageStack.Count > 0)
        {
            if (GUILayout.Button("Back", EditorStyles.toolbarButton))
            {
                PageStack.Pop();
            }
        }
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Export To Html", EditorStyles.toolbarButton))
        {
            var folder = EditorUtility.SaveFolderPanel("Documentation Output Path", null, null);

            if (folder != null)
            {
                var tocDocs = new HtmlDocsBuilder(Pages, "toc", "Screenshots");
#if DEBUG
                tocDocs.PageLinkHandler = page =>
                {
                    return(string.Format("<a href=\"/docs/mvvm/{0}.html\">{1}</a>", page.Name.Replace(" ", ""), page.Name));
                };
#endif
                tocDocs.Output.AppendFormat("<div class='toc'>");
                foreach (var page in Pages.OrderBy(p => p.Order))
                {
                    tocDocs.OutputTOC(page, tocDocs.Output);
                }
                tocDocs.Output.Append("</div>");
                File.WriteAllText(Path.Combine(folder, "toc.html"), tocDocs.ToString());

                foreach (var page in AllPages())
                {
                    var docsBuilder = new HtmlDocsBuilder(Pages, "content", "Screenshots");
                    tocDocs.Output.AppendFormat("<div class='content'>");
                    page.GetContent(docsBuilder);
                    tocDocs.Output.Append("</div>");


                    File.WriteAllText(Path.Combine(folder, page.Name.Replace(" ", "") + ".html"), docsBuilder.ToString());
                }
            }
        }
        EditorGUILayout.EndHorizontal();


        EditorGUILayout.BeginHorizontal();
        if (EditorPrefs.GetBool("uFrameHelpSidebar", true))
        {
            _tocScrollPosition = EditorGUILayout.BeginScrollView(_tocScrollPosition, GUILayout.Width(260));
            EditorGUI.DrawRect(new Rect(_tocScrollPosition.x, _tocScrollPosition.y, Screen.width, Screen.height), new Color(0.3f, 0.3f, 0.4f));
            ShowPages(Pages);
            EditorGUILayout.EndScrollView();
        }


        _pageScrollPosition = EditorGUILayout.BeginScrollView(_pageScrollPosition);
        EditorGUI.DrawRect(new Rect(_pageScrollPosition.x, _pageScrollPosition.y, Screen.width, Screen.height), new Color(0.8f, 0.8f, 0.8f));


        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(15f);
        EditorGUILayout.BeginVertical();
        if (CurrentPage != null)
        {
            GUILayout.BeginVertical(new GUIStyle()
            {
                padding   = new RectOffset(0, 20, 10, 50),
                alignment = TextAnchor.MiddleCenter
            });
            CurrentPage.GetContent(this);

            if (CurrentPage.ChildPages.Any())
            {
                Title2("Pages:");
            }
            foreach (var pages in CurrentPage.ChildPages.OrderBy(x => x.Order))
            {
                LinkToPage(pages);
            }

            if (false)
            {
                foreach (var childPage in CurrentPage.ChildPages)
                {
                    childPage.PageContent(this);
                }
            }
            GUILayout.EndVertical();
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EndScrollView();



        EditorGUILayout.EndHorizontal();
    }
Exemple #6
0
        private void BackToBeforePage()
        {
            var parentPage = PageStack.Pop();

            page.Frame.Navigate(parentPage, PageStack);
        }