public void RemoveSwitchEditVm(SwitchEditorVm switchEditVm) { _updateSuscriptions[switchEditVm].Dispose(); _updateSuscriptions.Remove(switchEditVm); SwitchEditVms.Remove(switchEditVm); SetSwitchUpdates(false); ReIndex(); SetSwitchUpdates(true); Serialize(); }
public void AddSwitchEditVm(SwitchEditorVm switchEditVm, int sorterPosition) { _updateSuscriptions[switchEditVm] = switchEditVm.OnSwitchEditVmChanged.Subscribe(vm => Serialize()); SwitchEditVms.Insert(sorterPosition, switchEditVm); SetSwitchUpdates(false); ReIndex(); SetSwitchUpdates(true); //Serialize(); }
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(); }
void Serialize() { Serialized = SwitchEditVms.Select( vm => KeyPairRepository.KeyPairFromKeys(vm.LowKey.Value, vm.HiKey.Value)) .ToSerialized(); }