示例#1
0
 public void BindingWithPropertyNameOneWayToSourceWorks()
 {
     var source = new Source();
     var destination = new Destination();
     var engine =
         new BindingEngine(destination, source)
         .Bind("DestinationData", "Data", BindingType.OneWayToSource);
     destination.DestinationData = 5;
     Assert.AreEqual(5, source.Data);
 }
示例#2
0
 public void BindingWithExpressionsOneWayToSourceWorks()
 {
     var source = new Source();
     var destination = new Destination();
     var engine =
         new BindingEngine<Destination, Source>(destination, source)
         .Bind(d => d.DestinationData, s => s.Data, BindingType.OneWayToSource);
     destination.DestinationData = 5;
     Assert.AreEqual(5, source.Data);
 }
示例#3
0
        public SceneControlData(
            TranslateSceneWidget translateWidg, RotateSceneWidget rotateWidg, TransformModeViewModel transformModeModel)
        {
            TransformActorModel = new TransformActorViewModel();
            TranslateSceneWidget = translateWidg;
            RotateSceneWidget = rotateWidg;

            TranslateBindingEngine =
                    new BindingEngine<TranslateSceneWidget, TransformActorViewModel>(TranslateSceneWidget, TransformActorModel)
                        .Bind(tw => tw.Position, a => a.Position, BindingType.TwoWays)
                        .Bind(tw => tw.Active, a => a.TranslateWidgetMode)
                        .Bind(tw => tw.Visible, a => a.TranslateWidgetMode);

            RotateBindingEngine =
                    new BindingEngine<RotateSceneWidget, TransformActorViewModel>(RotateSceneWidget, TransformActorModel)
                        .Bind(tw => tw.Position, a => a.Position, BindingType.TwoWays)
                        .Bind(tw => tw.Rotation, a => a.Rotation, BindingType.TwoWays)
                        .Bind(tw => tw.Active, a => a.RotateWidgetMode)
                        .Bind(tw => tw.Visible, a => a.RotateWidgetMode);

            _transformModeModel = transformModeModel;
            _transformModeModel.OnWidgetModeChanges += OnWidgetModeChanges;
            TransformActorModel.WidgetMode = _transformModeModel.WidgetMode;
        }