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

TOPIC: How to manage resources in XIDE

How to manage resources in XIDE 2 years 1 week ago #2067

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1631
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
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 1 week ago #2073

  FFF's Avatar FFF Offline Posts: 617
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

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

How to manage resources in XIDE 2 years 1 week ago #2074

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1631
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
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 1 week ago #2075

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

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

How to manage resources in XIDE 2 years 1 week ago #2080

  Chris's Avatar Chris Offline Posts: 1222
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 1 week ago #2087

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1631
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

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

  • Page:
  • 1