// Factory public static CopyPasteItemBase FactoryConvertFrom(AdminShell.Referable rf) { // try fake a copy paste item (order matters!) CopyPasteItemBase res = CopyPasteItemSME.ConvertFrom(rf); if (res == null) { res = CopyPasteItemSubmodel.ConvertFrom(rf); } if (res == null) { res = CopyPasteItemIdentifiable.ConvertFrom(rf); } // ok return(res); }
public static CopyPasteItemSubmodel ConvertFrom(AdminShell.Referable rf) { // access var sm = rf as AdminShell.Submodel; if (sm == null || sm.identification == null) { return(null); } // create var res = new CopyPasteItemSubmodel() { sm = sm }; // fake smref res.TryFixSmRefIfNull(); // ok return(res); }