public ProgramEntryViewModel(ProgramEntry menuEntry) : base(menuEntry) { _menuEntry = menuEntry; FullPath = menuEntry.FullPath; IsDirectory = menuEntry.IsDirectory; Childs = ViewModelHelper.CreateReadOnlyDispatcherCollection( menuEntry.Childs, model => new ProgramEntryViewModel(model), DispatcherHelper.UIDispatcher ); CompositeDisposable.Add(Childs); var listener = new PropertyChangedEventListener(DesktopStartMenuContext.Current) { "IsApplicationActive", (sender, e) => { if(DesktopStartMenuContext.Current.IsApplicationActive && IsExpand) { IsExpand = false; } } }; }
public void AddEntry(ProgramEntry entry) { if(!_childs.Any()) { _childs.Add(entry); return; } for (int i = 0; i < _childs.Count; i++ ) { if (0 <= Comparison(_childs[i], entry)) { _childs.Insert(i,entry); break; } if(i == _childs.Count - 1) { _childs.Add(entry); break; } } }
public Programs() { Entry = new ProgramEntry(null,null); }