Ejemplo n.º 1
0
        public NewCylinderView(NewCylinderViewModel viewModel, ILoggerFacade logger)
            : base(viewModel, logger)
        {
            this.viewModel = viewModel;

            this.cylinder = new Cylinder();
            Children.Add(cylinder);

            cylinder.Bind(Cylinder.Radius1Property, () => viewModel.Diameter, diameter => diameter / 2);
            cylinder.Bind(Cylinder.Radius2Property, () => viewModel.Diameter, diameter => diameter / 2);
            cylinder.Bind(Cylinder.Point1Property,
                          () => viewModel.Center,
                          () => viewModel.Axis,
                          () => viewModel.Length,
                          (center, axis, length) => center + 0.5 * length * axis);
            cylinder.Bind(Cylinder.Point2Property,
                          () => viewModel.Center,
                          () => viewModel.Axis,
                          () => viewModel.Length,
                          (center, axis, length) => center - 0.5 * length * axis);

            cylinder.SetMaterials(GetDefaultFrontAndBackMaterials(viewModel));
        }
 public Editor(Point startPos, LineRange lineRange, NewCylinderViewModel viewModel)
     : base(startPos, lineRange, viewModel)
 {
     this.viewModel = viewModel;
 }