public static DeviceCategory ParseDeviceCategory(JsonObject data, IStringProvider stringProvider, IContextActionProvider contextActionProvider) { bool showDeviceShelf = bool.Parse(data["ShowDeviceShelf"].GetString()); Vector3 shelfOffset = data["ShelfOffset"].GetObject().GetVector3(); Vector3 deviceOffset = data["DeviceOffset"].GetObject().GetVector3(); Vector3 spotlightOffset = data["SpotlightOffset"].GetObject().GetVector3(); Vector3 spotlight1Offset = data["Spotlight1Offset"].GetObject().GetVector3(); Vector3 pointlightOffset = data["PointlightOffset"].GetObject().GetVector3(); Dictionary <string, List <PropertyBitmapPickerItem> > sharedBitmapLists = new Dictionary <string, List <PropertyBitmapPickerItem> >(); JsonArray nodes = data["SharedBitmapLists"].GetArray(); foreach (var node in nodes) { JsonObject nodeObject = node.GetObject(); string id = nodeObject["Id"].GetString(); List <PropertyBitmapPickerItem> list = PropertyBitmapPickerItem.ParsePropertyBitmapPickerItemList(nodeObject["List"].GetArray()); sharedBitmapLists.Add(id, list); } var retVal = new DeviceCategory(data["Id"].GetString(), showDeviceShelf, shelfOffset, deviceOffset, spotlightOffset, spotlight1Offset, pointlightOffset, sharedBitmapLists, null, data["Caption"].GetString(), data["Thumbnail"].GetString(), data["ThumbnailHeight"].GetNumber(), data["ThumbnailTopMargin"].GetNumber()); var defaultDevice = Device.ParseDevice(data["DefaultDevice"].GetObject(), stringProvider, contextActionProvider, null, retVal); retVal.DefaultDevice = defaultDevice; return(retVal); }
public override IProperty Clone() { List <PropertyBitmapPickerItem> clonedItems = new List <PropertyBitmapPickerItem>(_listItems.Count); for (int i = 0; i < _listItems.Count; i++) { clonedItems.Add(_listItems[i].Clone()); } PropertyBitmapPickerItem clonedSelected = null; if (_selectedItem != null) { clonedSelected = clonedItems.FirstOrDefault((a) => a.Id == _selectedItem.Id); } return(new PropertyBitmapPicker(_id, _header, clonedSelected, clonedItems, _isVisibleInProductEditor, _isVisibleInMyLights, _metadata.Clone())); }
public static PropertyBitmapPicker ParsePropertyBitmapPicker(JsonObject data, Dictionary <string, List <PropertyBitmapPickerItem> > sharedBitmapLists) { string bitmapListId = data["Bitmaps"].GetString(); var bitmapItems = sharedBitmapLists[bitmapListId]; string valueId = data["Value"].GetString(); PropertyBitmapPickerItem selected = bitmapItems.FirstOrDefault((a) => a.Id == valueId); bool isVisibleInProductEditor = bool.Parse(data["IsVisibleInProductEditor"].GetString()); bool isVisibleInMyLights = bool.Parse(data["IsVisibleInMyLights"].GetString()); List <PropertyMetadataItem> metadata = null; if (data.ContainsKey("Metadata")) { metadata = PropertyMetadataItem.ParsePropertyMetadataItemList(data["Metadata"].GetArray()); } return(new PropertyBitmapPicker(data["Id"].GetString(), data["Caption"].GetString(), selected, bitmapItems, isVisibleInProductEditor, isVisibleInMyLights, metadata)); }
private void Item_BitmapPickerItemClicked(PropertyBitmapPickerItem obj) { SelectedItem = obj; }
public PropertyBitmapPicker(string id, string header, PropertyBitmapPickerItem selectedItem, List <PropertyBitmapPickerItem> listItems, bool isVisibleInProductEditor, bool isVisibleInMyLights, List <PropertyMetadataItem> metadata) : base(id, PropertyEditorType.BitmapPicker, header, isVisibleInProductEditor, isVisibleInMyLights, metadata) { _selectedItem = selectedItem; _listItems = listItems; }