fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: How to manage resources in XIDE

How to manage resources in XIDE 2 years 4 months ago #2067

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1854
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:
oAssembly := Assembly.GetExecutingAssembly()
oBitmap	:= Bitmap{ oAssembly:GetManifestResourceStream( "blue.png" ) }
2) "Create new" - "New resource file"
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
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Last edit: by wriedmann. Reason: Typo

How to manage resources in XIDE 2 years 4 months ago #2073

  FFF's Avatar FFF Offline Posts: 738
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
Regards
Karl

Please Log in or Create an account to join the conversation.

How to manage resources in XIDE 2 years 4 months ago #2074

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1854
Hi Karl,

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

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

How to manage resources in XIDE 2 years 4 months ago #2075

  FFF's Avatar FFF Offline Posts: 738
No hurry, asked only of curiosity ;)
Regards
Karl

Please Log in or Create an account to join the conversation.

How to manage resources in XIDE 2 years 4 months ago #2080

  Chris's Avatar Chris Offline Posts: 1460
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
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

How to manage resources in XIDE 2 years 4 months ago #2087

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1854
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
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

  • Page:
  • 1