예제 #1
0
        /// <summary>
        /// Invoked when it comes time to set the root
        /// </summary>
        private void CreateMenu()
        {
            var root = new RootElement(Title);

            root.Add(new Section()
            {
                new MenuElement("Add Pattern", () => OpenAddPatternView(), Images.Menu.Plus)
            });

            var browseSection = new Section()
            {
                HeaderView = new MenuSectionView("Browse")
            };

            root.Add(browseSection);
            browseSection.Add(new MenuElement("Recently Added", () => {
                var c = new RecentPatternsViewController();
                NavigationController.PushViewController(c, true);
            }, Images.Menu.Recent));
            browseSection.Add(new MenuElement("UI Patterns", () => {
                var c = new PatternCategoriesViewController();
                NavigationController.PushViewController(c, true);
            }, Images.Menu.UIPatterns));
            browseSection.Add(new MenuElement("Icons", () => {
                var c = new IconBrowserController();
                NavigationController.PushViewController(c, true);
            }, Images.Menu.Icons));



            var albumSection = new Section()
            {
                HeaderView = new MenuSectionView("Albums")
            };

            root.Add(albumSection);

            var imageCount = Data.Database.Main.Table <ProjectImage>().Count();

            _allProjects = new MenuElement("All Albums", imageCount.ToString(), UITableViewCellStyle.Value1)
            {
                Image = Images.Menu.AllAlbums
            };
            _allProjects.Tapped += () => {
                if (Data.Database.Main.Table <ProjectImage>().Count() > 0)
                {
                    NavigationController.PushViewController(new LocalViewPatternsViewController()
                    {
                        Title = "All"
                    }, true);
                }
                else
                {
                }
            };
            albumSection.Add(_allProjects);

            var projects = Data.Database.Main.Table <Project>();

            foreach (var p in projects)
            {
                var project = p;
                var element = new ProjectElement(project, this)
                {
                    Image = Images.Menu.Album
                };
                albumSection.Add(element);
            }

//            albumSection.Add(new MenuElement("Add Album", () => {
//                PresentViewController(new UINavigationController(new NewAlbumViewController((r) => {
//                    DismissViewController(true, null);
//                })), true, null);
//            }, null));
//

            var moreSection = new Section()
            {
                HeaderView = new MenuSectionView("Info")
            };

            root.Add(moreSection);
            moreSection.Add(new MenuElement("About", () => NavigationController.PushViewController(new AboutController(), true), Images.Menu.Info));
            moreSection.Add(new MenuElement("Feedback & Support", () => {
                var config = UserVoice.UVConfig.Create("appreciateui.uservoice.com", "y2jtRDr35UyLi2fjSv16bA", "x9U5XhzGUPdsghNbzNq3UHxtGDeuETsuwT4ufmV2Q");
                UserVoice.UserVoice.PresentUserVoiceInterface(this, config);
            }, Images.Menu.Feedback));

            Root = root;
        }
예제 #2
0
        /// <summary>
        /// Invoked when it comes time to set the root
        /// </summary>
        private void CreateMenu()
        {
            var root = new RootElement(Title);
            root.Add(new Section() {
                new MenuElement("Add Pattern", () => OpenAddPatternView(), Images.Menu.Plus)
            });

            var browseSection = new Section() { HeaderView = new MenuSectionView("Browse") };
            root.Add(browseSection);
            browseSection.Add(new MenuElement("Recently Added", () => {
                var c = new RecentPatternsViewController();
                NavigationController.PushViewController(c, true);
            }, Images.Menu.Recent));
            browseSection.Add(new MenuElement("UI Patterns", () => {
                var c = new PatternCategoriesViewController();
                NavigationController.PushViewController(c, true);
            }, Images.Menu.UIPatterns));
            browseSection.Add(new MenuElement("Icons", () => {
                var c = new IconBrowserController();
                NavigationController.PushViewController(c, true);
            }, Images.Menu.Icons));

            var albumSection = new Section() { HeaderView = new MenuSectionView("Albums") };
            root.Add(albumSection);

            var imageCount = Data.Database.Main.Table<ProjectImage>().Count();
            _allProjects = new MenuElement("All Albums", imageCount.ToString(), UITableViewCellStyle.Value1) { Image = Images.Menu.AllAlbums };
            _allProjects.Tapped += () => {
                if (Data.Database.Main.Table<ProjectImage>().Count() > 0)
                    NavigationController.PushViewController(new LocalViewPatternsViewController() { Title = "All" }, true);
                else
                {
                }
            };
            albumSection.Add(_allProjects);

            var projects = Data.Database.Main.Table<Project>();
            foreach (var p in projects)
            {
                var project = p;
                var element = new ProjectElement(project, this) { Image = Images.Menu.Album };
                albumSection.Add(element);
            }

            //            albumSection.Add(new MenuElement("Add Album", () => {
            //                PresentViewController(new UINavigationController(new NewAlbumViewController((r) => {
            //                    DismissViewController(true, null);
            //                })), true, null);
            //            }, null));
            //

            var moreSection = new Section() { HeaderView = new MenuSectionView("Info") };
            root.Add(moreSection);
            moreSection.Add(new MenuElement("About", () => NavigationController.PushViewController(new AboutController(), true), Images.Menu.Info));
            moreSection.Add(new MenuElement("Feedback & Support", () => {
                var config = UserVoice.UVConfig.Create("appreciateui.uservoice.com", "y2jtRDr35UyLi2fjSv16bA", "x9U5XhzGUPdsghNbzNq3UHxtGDeuETsuwT4ufmV2Q");
                UserVoice.UserVoice.PresentUserVoiceInterface(this, config);
            }, Images.Menu.Feedback));

            Root = root;
        }