Syed Faraz 的个人资料dotCompilerator日志列表 工具 帮助

Mahmood Syed Faraz

职业
地点
兴趣
http://www.orkut.com/Profile.aspx?uid=11884971834262767472

订阅源

所有者还没有为此模块指定订阅源。

dotCompilerator

scattered outbound thoughts
1月22日

New Blogging home

As of this day and onwards, I m perpetually shifting to wordpress.com for my blogging activities,
this my new address
http://farazmahmood.wordpress.com

c ya there


11月4日

Oreintation Aware Control Revisited

few days back i have posted about the orientation aware control (OAc) , how much it  is beneficial to the mobile development and other stuf.
 
well while working with oac i observed that , the resource names generated follow the VS naming convention as they are generated by build process. , and your source code should follow certain heirarchy, otherwise your resources will be named incorrectly. Also OAC expects all the resources to be embeded in the main assembly and file based resources will not be loaded,OAC utilizes Localization feature of .net framework, but overrides the component resrouce manager to look for resource in the main assembly only ,
 
for my aplication it was more desirable to have resource splitted in to culture base resources, for each resolution. after spending some time with msbuild i found that this is acheivable.
for generating proper resource names i used <LogicalName>myresourcename.resource</LogicalName>
 
for generating separte setallite assemblies for each resource. i added few build action
 <ItemGroup>
              <AvailableItemName Include="EmbeddedResource320_240" /> 
              <AvailableItemName Include="EmbeddedResource480_640" /> 
              <AvailableItemName Include="EmbeddedResource640_480" /> 
 </ItemGroup>
then updated build action of each resoultiion related resx to its build type , like abc.320-240.resx , will have build action "EmbeddedResource320_240" and so on
 
and then override the After Res Gen build event in my project file
 
 
  <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>
      
       <Message Text="@(OACResrouceWithCustomCulture) " />
        <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>
problem solved :D:D
i dont know the behavour when localizing control with different languages
:)
regards
 
10月3日

25th or 24th ,to be or not to be

  There seems to be a lot of misconception about birthdays and birth anniversary. I mentioned its my 25 th birthday not the 25th BIRTHDAY ANNIVERSARY.  as i was born on 26th September 1982,
:)
One interesting thing  i observerd, is the point view of deducting from facts , most of the people tried to correct me as being 25 year old since  its my 25th birthday . I wonder why didn't they correct me that it should be my 24th  BIRTHDAY  as i m 24 year old ,i.e other way around.


any thougths????
9月26日

25th birthday

Today is my 25th birthday ,mashAllah  i m now 24 years old , thnx to all my friends and relatives for bearing me so long :)
 
i guess my 28th birthdate will collide with eid-ul-fitar, hmm , i wonder, how the world will manage to celebrate the two occasions simulataneously.
 
faraz
 
 
9月12日

Orientation Aware Control

       Orientation aware control for windows mobile device( windows mobile 5.0) is an outcome from patterns and practice group at microsoft.  now adays mobile deivces support different resoultion and orientation. (i ll refer to Windows mobile 5.0 device simply as devices from now on). the available resolution are 240*320, 640*480, 240*240, 480*480 with portrati and landscape orientation . as with .net compact framework, we can build application to target different devices with with same code base , the problem lies where there are different resolution and orientation  .this was quite cumbersome ,until the orientation aware control was released by Paterrens and practice group as part of mobile client software factory.


u can derive all ur  controls from the orientation aware control ,orientation hooks up with the windows mobile api to get notified when orientation changes,it makes use of Resource localization feature , and creates different custom resource culture for different res /orientation and applying them accordingly.

as most of u people know that VS2005/vs2003 expects certian files to be in certain physcial folder hierarchy . here u can find these naming convention. the generated resources name follow these convention.

so what if ur source code hirerachy is a bit different then expected by VS ,as we have in our current application. Since OAC make heavy use of resources and those resource are getting named as per defualt rules, the OAC does not seem to work properly.:(. 

the solution, was to some how instruct the VS to generate the proper name, or to revise the source code herirachy. later was not appropriate since we were going to handover the build to the testing dept after 3 days and this may lead to havoc. so i researched on the first option ,trying to instruct VS , i dwelled within msbuild csproj files, and target files , to get to know how these are generated. and found out that these are generated via task GenerateManifestResourceName. One solution that readily poped up at the moment was to override the task and implement the new behaviour, but that would result in the maintaining a complete custom copy of microsoft msbuild default target files, which may lead to unknow behaviour in case of some updates,
next option was to introduce new Include Type (embeded resource,compile ,content are existing one), i.e. include the new resources as say OACResx , and  write a task to process , and inject the task using BeforeResGen task. that sound quite better, and definitly i was going to implement that but i found  an easeir solution. that is if u want to name ur resource ur way then just insert a tag <LogicalName>ur name goes here </LogicalName> in the Embeded resource node. this wil generate ur desired name, i made heavy use of this feature in my application.

so now OAC is performing great.Althoug i have to edit the  csproj file after creating new control, but thats just one time thing not of much pain. OAC designer should support this kind of thing, i m reviewing their source code for possible changes. will let u know if found something interesting.




 
Statistic!!
Visitor Number
Free 

Website Counter