예제 #1
0
        // We could not find anything that matched the user's request
        private ActionResult UnrecognizedRequest(string request)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb ("Unrecognized Request", null, "unrecognized"));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - Unrecognized Request", title);

            return View ("UnrecognizedRequest", (object)request);
        }
예제 #2
0
        // The user has passed us a namespace ("System"),
        // show the types in that namespace
        // ex: http://localhost/mscorlib.dll/System
        private ActionResult Namespace(NamespaceModel ns)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb (ns.Assembly, ns.AssemblyUrl, "reference"));
            bc.Crumbs.Add (new Crumb (ns.Name, null, "namespace"));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - {1} Namespace", title, ns.Name);

            return View ("Namespace", ns);
        }
예제 #3
0
        // The user has passed us a type ("System.String"),
        // show the documentation of the type
        // ex: http://localhost/mscorlib.dll/System.String
        private ActionResult Type(TypeModel type)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb (type.Assembly, type.AssemblyUrl, "reference"));
            bc.Crumbs.Add (new Crumb (type.Namespace, type.NamespaceUrl, "namespace"));
            bc.Crumbs.Add (new Crumb (type.Name, null, type.TypeIcon));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - {1} Type", title, type.Name);

            return View ("Type", type);
        }
예제 #4
0
        // The user has passed us a type member ("System.String.Trim ()"),
        // show the documentation of the member
        // ex: http://localhost/mscorlib.dll/System.String.Trim
        private ActionResult Member(MemberModel member)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb (member.Assembly, member.AssemblyUrl, "reference"));
            bc.Crumbs.Add (new Crumb (member.Namespace, member.NamespaceUrl, "namespace"));
            bc.Crumbs.Add (new Crumb (member.ParentType, member.TypeUrl, "pubclass"));
            bc.Crumbs.Add (new Crumb ("Members", member.MembersUrl, "members"));
            bc.Crumbs.Add (new Crumb (member.FormattedSignature, null, member.MemberIcon));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - {1}.{2}", title, member.ParentType, member.Name);

            return View ("Member", member);
        }
예제 #5
0
        // The user hasn't given us enough information to narrow down
        // their request to a specific namespace/type/member.  Show a
        // disambiguation page for them to choose from.
        private ActionResult Disambiguation(List<BaseDocModel> options)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb ("Disambiguation", null, "help"));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - Disambiguation", title);

            return View ("Disambiguation", options);
        }
예제 #6
0
        // The user has passed us an assembly ("mscorlib.dll"),
        // show the namespaces in that assembly
        // ex: http://localhost/mscorlib.dll/System
        private ActionResult Assembly(AssemblyModel model)
        {
            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb (model.Name, null, "reference"));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - {1} Assembly", title, model.Name);

            return View ("Assembly", model);
        }
예제 #7
0
        // The user has not requested anything, show the
        // list of assemblies we provide documentation for
        // ex: http://localhost/
        private ActionResult Assemblies()
        {
            var index = ModelFactory.GetIndex ();

            BreadCrumb bc = new BreadCrumb ();
            bc.Crumbs.Add (new Crumb ("Home", "", "home"));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - Home", title);

            return View ("Index", index);
        }
예제 #8
0
        // The user has given us a type ("System.String"), and
        // wants to see the members on the type
        // ex: http://localhost/mscorlib.dll/System.String/Members
        public ActionResult Members(string assembly, string path)
        {
            var index = ModelFactory.GetIndex ();

            // Find the requested assembly
            var assem = index.Where (p => string.Compare (p.Name, assembly, true) == 0).FirstOrDefault ();

            if (assem == null)
                return UnrecognizedRequest (string.Format ("{0}/{1}/Members", assembly, path));

            // Decode the user's request
            var reqs = assem.ParseRequest (path);

            // We couldn't find anything that matched the user's request
            if (reqs.Count == 0)
                return UnrecognizedRequest (path + "/Members");

            TypeModel type = null;

            foreach (BaseDocModel req in reqs)
                if (req is TypeModel) {
                    type = (TypeModel)req;
                    break;
                }

            // We couldn't find anything that matched the user's request
            if (type == null)
                return UnrecognizedRequest (path + "/Members");

            // Make a complete type, not a shallow one
            type = ModelFactory.CreateType (assembly, type.Namespace, type.Name, false);

            // Build the breadcrumb menu
            BreadCrumb bc = new BreadCrumb ();

            bc.Crumbs.Add (new Crumb ("Home", "~", "home"));
            bc.Crumbs.Add (new Crumb (type.Assembly, type.AssemblyUrl, "reference"));
            bc.Crumbs.Add (new Crumb (type.Namespace, type.NamespaceUrl, "namespace"));
            bc.Crumbs.Add (new Crumb (type.Name, type.TypeUrl, type.TypeIcon));
            bc.Crumbs.Add (new Crumb ("Members", null, "members"));

            ViewData["BreadCrumb"] = bc;
            ViewData["Title"] = string.Format ("{0} - {1} Members", title, type.Name);

            return View ("Members", type);
        }