xsharp.eu • How to manage resources in XIDE
Page 1 of 1

How to manage resources in XIDE

Posted: Mon Jul 10, 2017 4:14 am
by wriedmann
Hello,

since I had some difficulties to understand how to add resources in XIDE to use them in my X# program, I wrote a small test program. But there is also other people that has the same understanding problems.
Therefore I would like to post it here.
1) "Add existing" - "Add resource files"
You can retrieve it with:

Code: Select all

oAssembly := Assembly.GetExecutingAssembly()
oBitmap	:= Bitmap{ oAssembly:GetManifestResourceStream( "blue.png" ) }

2) "Create new" - "New resource file"

Code: Select all

oResourceManager := System.Resources.ResourceManager{ "bitmap", oAssembly }
oObject := oResourceManager:GetObject( "red.png" )
if oObject is Bitmap
  oBitmap := ( Bitmap ) oResourceManager:GetObject( "red.png" )
endif
You can find the complete working code including samples how to list the resources as XIDE export file here:

ResourcesSample.zip

Hope to help someone.

Wolfgang

How to manage resources in XIDE

Posted: Mon Jul 10, 2017 6:55 am
by FFF
Wolfgang,
cool, and thx for the embedded link to MS doc.
One question: in the article he mentions
"...use of an alternate resource name after the comma of the file name to be embedded. The alternate resource name allows you to provide arbitrarily period-nested names for resources, regardless of the name of the file. It's the alternate name that makes it into the assembly..."
If i'd like to do so, how/where could i add the alternate name in Xide?

TIA
Karl

How to manage resources in XIDE

Posted: Mon Jul 10, 2017 7:08 am
by wriedmann
Hi Karl,

I'll do some tests, maybe speak with Chris, and let you know in the next days.

Wolfgang

How to manage resources in XIDE

Posted: Mon Jul 10, 2017 7:27 am
by FFF
No hurry, asked only of curiosity ;)

How to manage resources in XIDE

Posted: Mon Jul 10, 2017 1:50 pm
by Chris
Hi Karl,

Hmm, that's not support at the moment, but I can add an option in the resource file item for specifying the namespace. If you needed to do that now, you would have to specify the resource via a direct /resource compiler option (in the general options editbox of the app properties). The syntax of the compiler switch in x# is exactly the same as in c#.

Chris

How to manage resources in XIDE

Posted: Tue Jul 11, 2017 5:47 am
by wriedmann
Hi Chris,

thank you very much! So I don't need to investigate more at this time. (it's not that I have too much time <g>)

Wolfgang