示例#1
0
        public TopMenuViewModel(int topmenuid, IEnumerable<MenuCategory> categories, IEnumerable<TopMenuBinding> topmenubindings)
            : this()
        {
            this.SelectedTopMenuId = topmenuid;
            foreach (var category in categories)
            {
                // An EditorViewModel will be used by Editor Template:
                var smcevm = new SelectMenuCategoryEditorViewModel(category);
                this.MenuCategories.Add(smcevm);
            }

            foreach (var binding in topmenubindings)
            {
                var checkCategory =
                    this.MenuCategories.Find(r => r.MenuCategoryId == binding.MenuCategoryId);
                checkCategory.Selected = true;
            }
        }
        public TopMenuViewModel(int topmenuid, IEnumerable <MenuCategory> categories, IEnumerable <TopMenuBinding> topmenubindings)
            : this()
        {
            this.SelectedTopMenuId = topmenuid;
            foreach (var category in categories)
            {
                // An EditorViewModel will be used by Editor Template:
                var smcevm = new SelectMenuCategoryEditorViewModel(category);
                this.MenuCategories.Add(smcevm);
            }

            foreach (var binding in topmenubindings)
            {
                var checkCategory =
                    this.MenuCategories.Find(r => r.MenuCategoryId == binding.MenuCategoryId);
                checkCategory.Selected = true;
            }
        }