private static bool tryGetValue(DateTimeOffsetTimeFormatValueCombiner combiner, DateTimeOffset duration, object format, out object convertedValue)
        {
            var dateStepDescription = new MvxLiteralSourceStepDescription();

            dateStepDescription.Literal = duration;

            var formatStepDescription = new MvxLiteralSourceStepDescription();

            formatStepDescription.Literal = format;

            var steps = new[]
            {
                new MvxLiteralSourceStep(dateStepDescription),
                new MvxLiteralSourceStep(formatStepDescription)
            };

            return(combiner.TryGetValue(steps, out convertedValue));
        }
        private static bool tryGetValue(TimeSpan duration, object format, out object convertedValue)
        {
            var durationStepDescription = new MvxLiteralSourceStepDescription();

            durationStepDescription.Literal = duration;

            var formatStepDescription = new MvxLiteralSourceStepDescription();

            formatStepDescription.Literal = format;

            var steps = new[]
            {
                new MvxLiteralSourceStep(durationStepDescription),
                new MvxLiteralSourceStep(formatStepDescription)
            };

            return(combiner.TryGetValue(steps, out convertedValue));
        }
Пример #3
0
        public void TestLiteralDoubleBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxLiteralSourceStepDescription()
            {
                Literal = 13.72
            };

            var source = new MySource()
            {
                IntProperty1 = 42
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(double), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual(13.72, value);
        }
Пример #4
0
        public void TestLiteralStringBinding()
        {
            var realSourceStepFactory = SetupSourceStepFactory();

            var sourceStepDescription = new MvxLiteralSourceStepDescription()
            {
                Literal = "Love it"
            };

            var source = new MySource()
            {
                IntProperty1 = 42
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Love it", value);
        }