Beispiel #1
0
        private static LinkViewModel ConvertLink(MDL.Link linkToParent, string name)
        {
            LinkViewModel vm = null;

            if (linkToParent is MDL.LinearLink linearLink)
            {
                vm = new LinearLinkViewModel()
                {
                    Id = linkToParent.Id,
                    //LinkID = linearLink.LinkID,
                    Direction   = linearLink.Direction,
                    Type        = linearLink.Type,
                    Max         = linearLink.Max,
                    Min         = linearLink.Min,
                    Pos         = linearLink.Pos,
                    Value       = linearLink.Pos,
                    Description = name
                };
            }
            else if (linkToParent is MDL.PneumaticLink pneumaticLink)
            {
                vm = new PneumaticLinkViewModel()
                {
                    Id = pneumaticLink.Id,
                    //LinkID = pneumaticLink.LinkID,
                    Direction     = pneumaticLink.Direction,
                    Type          = pneumaticLink.Type,
                    OffPos        = pneumaticLink.OffPos,
                    OnPos         = pneumaticLink.OnPos,
                    TOff          = pneumaticLink.TOff,
                    TOn           = pneumaticLink.TOn,
                    ToolActivator = pneumaticLink.ToolActivator,
                    Description   = name
                };
            }

            return(vm);
        }
Beispiel #2
0
        private static MDL.Link Convert(this MVMIL.ILinkViewModel link)
        {
            MDL.Link m = null;

            if (link is MVMIL.ILinearLinkViewModel llvm)
            {
                m = new MDL.LinearLink()
                {
                    Max = llvm.Max,
                    Min = llvm.Min,
                    Pos = llvm.Pos
                };
            }
            else if (link is MVMIL.IPneumaticLinkViewModel plvm)
            {
                var plm = new MDL.PneumaticLink()
                {
                    OffPos        = plvm.OffPos,
                    OnPos         = plvm.OnPos,
                    TOff          = plvm.TOff,
                    TOn           = plvm.TOn,
                    ToolActivator = plvm.ToolActivator
                };

                m = plm;
            }

            if (m != null)
            {
                m.Id        = link.Id;
                m.Direction = link.Direction;
                m.Type      = link.Type;
            }

            return(m);
        }