Example #1
0
        private void HandleRomListChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Remove:
                MenuLayout.StartItemsUpdate();
                for (int i = 0; i < e.OldItems.Count; ++i)
                {
                    var program = e.OldItems[i] as ProgramDescription;
                    MenuLayout.MarkProgramMissing(program, LtoFlash.ActiveLtoFlashDevices.Select(vm => vm.Device).Where(m => m.IsValid));
                    ////MenuLayout.MenuLayout.RemoveChildFromHierarchy(f => (f is INTV.LtoFlash.Model.Program) && ((f as INTV.LtoFlash.Model.Program).Description == program));
                }
                MenuLayout.FinishItemsUpdate(false);     // The menu isn't really changing here...
                break;

            case NotifyCollectionChangedAction.Add:
                MenuLayout.StartItemsUpdate();
                for (int i = 0; i < e.NewItems.Count; ++i)
                {
                    var program = e.NewItems[i] as ProgramDescription;
                    MenuLayout.MarkProgramAvailable(program, LtoFlash.ActiveLtoFlashDevices.Select(vm => vm.Device).Where(m => m.IsValid));
                }
                MenuLayout.FinishItemsUpdate(false);     // The menu isn't actually changing
                break;

            default:
                ////MenuLayout.MarkProgramMissing(program);
                break;
            }
        }