View previous topic :: View next topic |
Author |
Message |
Dierk Droth
Joined: 16 Nov 2010 Posts: 27
|
Posted: Tue Dec 07, 2010 5:19 pm Post subject: Change access modifier? |
|
|
Hi,
How could the access modifier of the generated .resx be changed, e.g. from "no code generation" to "Public".
If that is not possible: is there a way to have Globalizer generate the resources into a file which I manually created with access modifier "Public"?
Thanks |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Dec 07, 2010 11:24 pm Post subject: |
|
|
I'm not sure what you mean by the access modifier? Do you mean that you want to generate a code wrapper to allow type safe access code programmatic access to the resources?
I'm not sure why you would need to do this - but if that is want you want then you can modify the properties of the resources files after Globalizer.NET creates them. If you set the Custom Tool property to "ResXFileCodeGenerator" then Visual Studio will automatically generate a wrapper class for the resx file - however the name it choose for this by default will clash with the name of the Window/Form class. So you also need to set the Custom Tool Namespace property to avoid this. For instance set it to "WpfApp.Resources". Then you can access the resources programmatically through the generated WppApp.Resources.MyWindow class. _________________ Infralution Support |
|
Back to top |
|
|
Dierk Droth
Joined: 16 Nov 2010 Posts: 27
|
Posted: Wed Dec 08, 2010 7:19 am Post subject: |
|
|
Here is my thought process:
- Globalizer generates a .resx file on extracting string resources from an XAML
- I'm using that .resx to manually add more resources which I needed in my code behind
- however, if I set the access modifier of that .resx file in my VS2010 from "No code generation" to "Public" (to work with the code wrappers for my manually generated ressources) I get this error
"Partial declarations of 'XAML file name' have conflicting accessibility modifiers"
Same happens when setting "ResXFileCodeGenerator" as you suggested
Any idea what's going wrong?
Thanks |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Dec 08, 2010 7:33 am Post subject: |
|
|
You'll get that error unless you set the Custom Tool Namespace as I described. That's because otherwise the type name of the generated class for accessing the resources will be the same as is generated for the WPF Window class. _________________ Infralution Support |
|
Back to top |
|
|
Dierk Droth
Joined: 16 Nov 2010 Posts: 27
|
Posted: Wed Dec 08, 2010 1:17 pm Post subject: |
|
|
Excellent! That resolved the issue.
Thanks for your great support |
|
Back to top |
|
|
|