public static PrefixConversionVm Create(Unit unit, Prefix prefix) { var identityConversion = new PartConversion.IdentityConversion(unit); var prefixConversion = PrefixConversion.Create(unit, prefix); return(new PrefixConversionVm(unit.PrefixConversions, identityConversion, prefixConversion)); }
private bool IsMatch(PrefixConversion x) { if (this.Conversion.Prefix.Power != x.Prefix.Power) { return(false); } return(true); }
private PrefixConversionVm(ObservableCollection <PrefixConversion> conversions, PrefixConversion prefixConversion) : base(prefixConversion) { this.conversions = conversions; this.disposable = new CompositeDisposable { conversions.ObservePropertyChangedSlim() .SubscribeOn(TaskPoolScheduler.Default) .Subscribe(_ => this.OnPropertyChanged(nameof(this.IsUsed))), prefixConversion.ObservePropertyChanged(x => x.Symbol) .SubscribeOn(TaskPoolScheduler.Default) .Where(_ => this.IsUsed) .SubscribeAsync(() => this.UpdateAsync()), }; }
public static PrefixConversionVm Create(FactorConversion factorConversion, Prefix prefix) { var prefixConversion = PrefixConversion.Create(factorConversion, prefix); return(new PrefixConversionVm(factorConversion.PrefixConversions, factorConversion, prefixConversion)); }
private PrefixConversionVm(ObservableCollection <PrefixConversion> conversions, IConversion baseConversion, PrefixConversion prefixConversion) { this.conversions = conversions; this.baseConversion = baseConversion; this.Conversion = prefixConversion; conversions.ObservePropertyChangedSlim() .Subscribe(_ => this.OnPropertyChanged(nameof(this.IsUsed))); // no need for IDisposable }