void initialize(SceneUIElement parent, IContainerBoundsProvider boundsProvider, IChildren <SceneUIElement> children) { this.StandardDepth = 0.0f; this.parentElement = parent; this.childSet = children; Solver = new PinnedBoxes2DLayoutSolver( new BoxContainer(boundsProvider)); items = new List <LayoutItem>(); }
//public Setting(ISetting children) //{ // Name = "Test"; // FatherName = "TestFather"; // childrenCollection = new SettingCollection() { DefaultValue = -1, FullName = "Children Name 1", Enabled = false }; // if (children != null) // { // //if (flag) // //{ // // ///////////////////////////////////////////////////////////////////// // // //// Using Generic Mapper Configuration /// // // ///////////////////////////////////////////////////////////////////// // // var mapper = ObjectMapperFactory.CreateMapper<ISetting, ISetting>(); // // mapper.Map(children, this); // //} // //else // //{ // ///////////////////////////////////////////////////////////////////// // //// Using Profile Registration Mapper Configuration /// // ///////////////////////////////////////////////////////////////////// // var config = new MapperConfiguration( // cfg => // { // cfg.CreateMap<Setting, Setting>(); // cfg.CreateMap<SettingCollection, SettingCollection>() // .AfterMap((src, dst, resolutionContext) => // { // //dst.Clear(); // //foreach(var item in src) // //{ // // dst.Add(resolutionContext.Mapper.Map<SettingElement>(item)); // //} // }); // cfg.CreateMap<SettingElement, SettingElement>(); // }); // config.AssertConfigurationIsValid(); // var mapper = new Mapper(config); // var test = mapper.Map<ISetting, ISetting>(children); // mapper.Map(children, this); // //} // } //} public static IChildren MapProfile(IChildren children) { if (children != null) { var config = new MapperConfiguration( cfg => { cfg.CreateMap <Children, Children>(); cfg.CreateMap <ChildrenCollection, ChildrenCollection>(); cfg.CreateMap <ChildrenConfigElement, ChildrenConfigElement>(); }); config.AssertConfigurationIsValid(); ////var test = AssemblyMappingSetting.CreateMapper(typeof(Children).Assembly); var mapper = new Mapper(config); return(mapper.Map <IChildren, IChildren>(children)); } return(children); }
static void Main(string[] args) { var listOfElelement = new List <ChildrenConfigElement>() { new ChildrenConfigElement() { CityName = "Lahore", SchoolName = "City School Lahore" }, new ChildrenConfigElement() { CityName = "Karachi", SchoolName = "City School Karachi" } }; var chilCollection = new ChildrenCollection() { DefaultValue = -2, FullName = "Children Name 2", Enabled = true }; listOfElelement.ForEach(r => chilCollection.Add(r)); IChildren setting = new Children() { Name = "Fahad", FatherName = "Anwar UL Haq", childrenCollection = chilCollection }; //Setting setting2 = new Setting(setting); IChildren setting3 = Children.MapProfile(setting); Console.WriteLine("Source Object Values are... "); ///////////////////////////////////////////////////////////////////// //// Setting 1 /// ///////////////////////////////////////////////////////////////////// //PrintProperties(setting, 1); //Console.WriteLine("/////////////////////////////////////////////////"); /////////////////////////////////////////////////////////////////////// ////// Setting 2 After Generic Map /// /////////////////////////////////////////////////////////////////////// //PrintProperties(setting2, 1); Console.WriteLine("/////////////////////////////////////////////////"); ///////////////////////////////////////////////////////////////////// //// Setting 3 After Assembly Map /// ///////////////////////////////////////////////////////////////////// PrintProperties(setting3, 1); Console.ReadLine(); }
public Children(IChildren children, bool flag = true) { Name = "Test"; FatherName = "TestFather"; childrenCollection = new ChildrenCollection() { DefaultValue = -1, FullName = "Children Name 1", Enabled = false }; if (children != null) { if (flag) { ///////////////////////////////////////////////////////////////////// //// Using Generic Mapper Configuration /// ///////////////////////////////////////////////////////////////////// var mapper = ObjectMapperFactory.CreateMapper <IChildren, IChildren>(); mapper.Map(children, this); } else { ///////////////////////////////////////////////////////////////////// //// Using Profile Registration Mapper Configuration /// ///////////////////////////////////////////////////////////////////// var config = new MapperConfiguration( cfg => { cfg.CreateMap <Children, Children>() .PreserveReferences(); cfg.CreateMap <ChildrenCollection, ChildrenCollection>() .PreserveReferences(); cfg.CreateMap <ChildrenElements, ChildrenElements>() .PreserveReferences(); }); config.AssertConfigurationIsValid(); var mapper = new Mapper(config); mapper.Map(children, this); } } }
public HUDElementLayout(SceneUIElement parent, IContainerBoundsProvider elementBoundsProvider, IChildren <SceneUIElement> children) { initialize(parent, elementBoundsProvider, children); }
public HUDElementLayout(SceneUIElement parent, IBoxModelElement boxElement, IChildren <SceneUIElement> children) { initialize(parent, new BoxModelElementContainerProvider(boxElement), children); }