Пример #1
0
        public void RemoveSwitchEditVm(SwitchEditorVm switchEditVm)
        {
            _updateSuscriptions[switchEditVm].Dispose();
            _updateSuscriptions.Remove(switchEditVm);

            SwitchEditVms.Remove(switchEditVm);
            SetSwitchUpdates(false);
            ReIndex();
            SetSwitchUpdates(true);
            Serialize();
        }
Пример #2
0
        public void AddSwitchEditVm(SwitchEditorVm switchEditVm, int sorterPosition)
        {
            _updateSuscriptions[switchEditVm]
                = switchEditVm.OnSwitchEditVmChanged.Subscribe(vm => Serialize());

            SwitchEditVms.Insert(sorterPosition, switchEditVm);
            SetSwitchUpdates(false);
            ReIndex();
            SetSwitchUpdates(true);
            //Serialize();
        }
Пример #3
0
        public GenomeEditorSwitchIndexVm(int keyCount, IReadOnlyList <IKeyPair> keyPairs)
        {
            _keyCount = keyCount;

            for (var i = 0; i < keyPairs.Count; i++)
            {
                var switchEditVm = new SwitchEditorVm(KeyCount)
                {
                    SorterPosition = i,
                    LowKey         = keyPairs[i].LowKey,
                    HiKey          = keyPairs[i].HiKey,
                    NotifyEnabled  = true
                };

                _updateSuscriptions[switchEditVm]
                    = switchEditVm.OnSwitchEditVmChanged.Subscribe(vm => Serialize());

                SwitchEditVms.Add(switchEditVm);
            }

            Serialize();
        }
Пример #4
0
 void Serialize()
 {
     Serialized = SwitchEditVms.Select(
         vm => KeyPairRepository.KeyPairFromKeys(vm.LowKey.Value, vm.HiKey.Value))
                  .ToSerialized();
 }