public ListLayoutPanel(ListBlockDefinition def, ListBlock block, ScrollViewer scroll) { definition = def; parentBlock = block; parentControl = scroll; }
private DefinitionBase CreateDefinition(FieldList source) { if (source == null) { return(null); } int defID = source[MessageOutFieldID.DefinitionID].AsInteger() ?? 0; short primitiveType = source[DefAgentFieldID.DefinitionType].AsShort() ?? 0; short secondaryCharacteristic = 0; DefinitionBase res = null; switch ((DefinitionType)primitiveType) { case DefinitionType.AtomicBlock: { FieldList firstStateData = (FieldList)source[DefAgentFieldID.DataPerComponentState]; if (firstStateData != null) { secondaryCharacteristic = firstStateData[DefAgentFieldID.LayoutType].AsByte() ?? 0; switch ((LayoutType)secondaryCharacteristic) { case LayoutType.Table: AtomicBlockDefinition ab = new AtomicBlockDefinition(); ab.Unpack(source); res = ab; break; case LayoutType.SingleSlot: SingleSlotBlockDefinition ssb = new SingleSlotBlockDefinition(); ssb.Unpack(source); res = ssb; break; case LayoutType.ScrollingText: ScrollingTextBlockDefinition stbd = new ScrollingTextBlockDefinition(); stbd.Unpack(source); res = stbd; break; default: DebugHelper.Out("Unsupported layout type for atomic: {0}", ((LayoutType)secondaryCharacteristic).ToString()); break; } } break; } case DefinitionType.Container: { secondaryCharacteristic = source[DefAgentFieldID.LayoutType].AsByte() ?? 0; switch ((LayoutType)secondaryCharacteristic) { case LayoutType.Box: BoxLayoutBlockDefinition bx = new BoxLayoutBlockDefinition(); bx.Unpack(source); res = bx; break; case LayoutType.Flow: ListBlockDefinition fl = new ListBlockDefinition(); fl.Unpack(source); res = fl; break; case LayoutType.Grid: GridBlockDefinition gr = new GridBlockDefinition(); gr.Unpack(source); res = gr; break; default: DebugHelper.Out("Unsupported layout type for container: {0}", ((LayoutType)secondaryCharacteristic).ToString()); break; } break; } case DefinitionType.Frame: { FrameDefinition fd = new FrameDefinition(); fd.Unpack(source); res = fd; break; } case DefinitionType.Plugin: { secondaryCharacteristic = source[DefAgentFieldID.PluginType].AsByte() ?? 0; switch ((PluginType)secondaryCharacteristic) { case PluginType.Map: MapPluginBlockDefinition mpbd = new MapPluginBlockDefinition(); mpbd.Unpack(source); res = mpbd; break; default: DebugHelper.Out("Unsupported plug-in type: {0}", ((PluginType)secondaryCharacteristic).ToString()); break; } break; } case DefinitionType.Palette: { PaletteDefinition palette = new PaletteDefinition(); palette.Unpack(source); res = palette; break; } case DefinitionType.Font: { FontDefinition font = new FontDefinition(); font.Unpack(source); res = font; break; } case DefinitionType.ApplicationEvents: { ApplicationEventsDefinition appEvents = new ApplicationEventsDefinition(); appEvents.Unpack(source); res = appEvents; break; } default: DebugHelper.Out("Unsupported definition type: {0}", ((DefinitionType)primitiveType).ToString()); break; } if ((res != null) && res.IsUnpacked) { return(res); } else { return(null); } }