separat resource files for different resolutions

Topics: Mobile Client Software Factory
Nov 1, 2006 at 11:16 PM
originally posted by: Faraz_Mahmood

well i have used the OAC and i must appreciate your efforts. i want to create different resoruce dll for different resolution ,can you guid me , how this will be acheived. at moment all the resrources get embeded in the controls' assembly file,
i have checked the source file for ResourceManager ,and found a note that the build process should be fixed to achieve this behaviour, can you explain a bit further,. this note can be found where you setup private field of the resource manager so that it loads the resource from assembly,

regards
Nov 2, 2006 at 2:09 AM
originally posted by: dcazzulino

I'm working on precisely that feature for our extended version of the control (see http://orientationaware.net).
It's not trivial to implement, as I found that generating multiple resource files also breaks the cool design-time experience we have now for embedded OACs (where they show the layout that matches that of the containing control/form).

You can notice that this doesn't work either for the standard .NET localization feature. Try localizing a user control. dropping it in a parent control/form and change the parent language. The embedded child control will not refresh to show the corresponding culture.

Fixing that is proving to be quite tricky, but I'm confident we'll have a CTP before the end of november, and an RTM version before EOY.

Thanks!
Nov 5, 2006 at 8:13 AM
originally posted by: Faraz_Mahmood

i got some success in generating separate satellite assemblies for different resoultion,
i added resolution related BUILD ACTION TYPE in project file.
<ItemGroup>
<AvailableItemName Include="EmbeddedResource320_240" />
<AvailableItemName Include="EmbeddedResource480_640" />
<AvailableItemName Include="EmbeddedResource640_480" />
</ItemGroup>

assigne each resoultion related resource file its build specified build type
then override the AfterResGen build target as follows

<Target Name="AfterResGen">

<CreateItem Include="@(EmbeddedResource320_240)" AdditionalMetadata="Culture=320-240">
<Output TaskParameter="Include" ItemName="OACResrouceWithCustomCulture"/>
</CreateItem>

<CreateItem Include="@(EmbeddedResource480_640)" AdditionalMetadata="Culture=480-640">
<Output TaskParameter="Include" ItemName="OACResrouceWithCustomCulture"/>
</CreateItem>

<CreateItem Include="@(EmbeddedResource640_480)" AdditionalMetadata="Culture=640-480">
<Output TaskParameter="Include" ItemName="OACResrouceWithCustomCulture"/>
</CreateItem>


<MakeDir Directories="$(IntermediateOutputPath)%(OACResrouceWithCustomCulture.Culture)"/>
<GenerateResource Sources="@(OACResrouceWithCustomCulture)" OutputResources="@(OACResrouceWithCustomCulture->'$(IntermediateOutputPath)%(LogicalName)')">

<Output TaskParameter="OutputResources" ItemName="OACResrouces"/>
<Output TaskParameter="FilesWritten" ItemName="FileWrites"/>
</GenerateResource>



<AL EmbedResources="@(OACResrouces)"
Culture="%(OACResrouces.Culture)"
ProductName="$(Satellite_ProductName)"
ProductVersion="$(Satellite_ProductVersion)"
TemplateFile="$(IntermediateOutputPath)$(TargetName)$(TargetExt)"
Title="$(Satellite_Title)"
ToolPath="$(AlToolPath)"
Trademark="$(Satellite_Trademark)"
Version="$(Satellite_Version)"
OutputAssembly= "$(IntermediateOutputPath)%(OACResrouces.Culture)\$(TargetName).resources.dll">

<Output TaskParameter="OutputAssembly" ItemName="OACSatelliteAssemblies"/>

</AL>

<Copy SourceFiles="@(OACSatelliteAssemblies)"
DestinationFiles="@(OACSatelliteAssemblies->'$(OutDir)%(Culture)\$(TargetName).resources.dll')"
SkipUnchangedFiles="true">

<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>

</Copy>


</Target>

that does the job , but i dont know what will happen in case you have localized file of OAC resource for different langauges. i.e 320-240_ar etc etc
regards