public ImportOptionWindowVM(DDIImportOption importOption)
        {
            menuItems = new ObservableCollection<CheckMenuItemVM>();

            CheckMenuItemVM curCategory = null;
            foreach (MenuElem elem in importOption.MenuElems)
            {
                CheckMenuItemVM menuItem = null;
                if (elem.IsCategory) {
                    menuItem = new CheckMenuItemVM(elem);
                    menuItems.Add(menuItem);
                    curCategory = menuItem;
                }
                else
                {
                    menuItem = new CheckMenuItemVM(elem);
                    curCategory.Add(menuItem);
                }
                menuItem.UpdateSelfCheckedStatus(true);
            }

            List<CheckMenuItemVM> leafMenuItems = LeafMenuItems;
            foreach (CheckMenuItemVM menuItem in leafMenuItems)
            {
                List<CheckMenuItemVM> relatedMenuItems = CheckMenuItemVM.FindByMenuElems(leafMenuItems, importOption.GetRelatedMenuElems(menuItem.MenuElem));
                menuItem.RelatedMenuItems.AddRange(relatedMenuItems);
            }
        }
Exemple #2
0
        public static List <CheckMenuItemVM> FindByMenuElems(List <CheckMenuItemVM> menuItems, List <MenuElem> menuElems)
        {
            List <CheckMenuItemVM> results = new List <CheckMenuItemVM>();

            foreach (MenuElem menuElem in menuElems)
            {
                CheckMenuItemVM menuItem = FindByMenuElem(menuItems, menuElem);
                if (menuItem == null)
                {
                    throw new ApplicationException();
                }
                results.Add(menuItem);
            }
            return(results);
        }
Exemple #3
0
 public void Add(CheckMenuItemVM menuItem)
 {
     menuItem.ParentMenuItem = this;
     menuItems.Add(menuItem);
 }
Exemple #4
0
 private void Log(string msg, CheckMenuItemVM menuItem)
 {
     Debug.WriteLine(msg + " [" + menuItem.Title + "] IsChecked=" + menuItem.IsChecked);
 }
 private void Log(string msg, CheckMenuItemVM menuItem)
 {
     Debug.WriteLine(msg + " [" + menuItem.Title + "] IsChecked=" + menuItem.IsChecked);
 }
 public void Add(CheckMenuItemVM menuItem)
 {
     menuItem.ParentMenuItem = this;
     menuItems.Add(menuItem);
 }