예제 #1
0
        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));
        }
예제 #2
0
        private bool IsMatch(PrefixConversion x)
        {
            if (this.Conversion.Prefix.Power != x.Prefix.Power)
            {
                return(false);
            }

            return(true);
        }
예제 #3
0
        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()),
            };
        }
예제 #4
0
        public static PrefixConversionVm Create(FactorConversion factorConversion, Prefix prefix)
        {
            var prefixConversion = PrefixConversion.Create(factorConversion, prefix);

            return(new PrefixConversionVm(factorConversion.PrefixConversions, factorConversion, prefixConversion));
        }
예제 #5
0
 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
 }