Exemple #1
0
        void IUnboundNumericScaleRescaleConditions.SetUserParameters(BoundaryRescaling orgRescaling, BoundariesRelativeTo orgRelativeTo, Data.AltaxoVariant orgValue, BoundaryRescaling endRescaling, BoundariesRelativeTo endRelativeTo, Data.AltaxoVariant endValue)
        {
            long         orgV, endV;
            DateTimeKind orgK, endK;

            if (orgValue.IsType(Data.AltaxoVariant.Content.VDateTime))
            {
                var dt = orgValue.ToDateTime();
                orgV = dt.Ticks;
                orgK = dt.Kind;
            }
            else if (orgValue.CanConvertedToDouble)
            {
                double v = orgValue.ToDouble();
                orgV = (long)(v * 1E7);
                orgK = DateTimeKind.Utc;
            }
            else
            {
                throw new InvalidOperationException("Can not convert orgValue to either a DateTime or a double value.");
            }

            if (endValue.IsType(Data.AltaxoVariant.Content.VDateTime))
            {
                var dt = endValue.ToDateTime();
                endV = dt.Ticks;
                endK = dt.Kind;
            }
            else if (orgValue.CanConvertedToDouble)
            {
                double v = endValue.ToDouble();
                endV = (long)(v * 1E7);
                endK = DateTimeKind.Utc;
            }
            else
            {
                throw new InvalidOperationException("Can not convert endValue to either a DateTime or a double value.");
            }

            SetUserParameters(orgRescaling, orgRelativeTo, orgV, orgK, endRescaling, endRelativeTo, endV, endK);
        }
Exemple #2
0
        void IUnboundNumericScaleRescaleConditions.SetUserParameters(BoundaryRescaling orgRescaling, BoundariesRelativeTo orgRelativeTo, Data.AltaxoVariant orgValue, BoundaryRescaling endRescaling, BoundariesRelativeTo endRelativeTo, Data.AltaxoVariant endValue)
        {
            double orgV, endV;

            if (orgValue.CanConvertedToDouble)
            {
                orgV = orgValue.ToDouble();
            }
            else
            {
                throw new InvalidOperationException("Can not convert orgValue to a double value.");
            }

            if (orgValue.CanConvertedToDouble)
            {
                endV = endValue.ToDouble();
            }
            else
            {
                throw new InvalidOperationException("Can not convert endValue to a double value.");
            }

            SetUserParameters(orgRescaling, orgRelativeTo, orgV, endRescaling, endRelativeTo, endV);
        }