Building a large app where we want to be able to ship updated icons like
patches/assign different "skins", etc.
So, I'm looking at storing sets of related icons in assemblies that will be
loaded dynamically.
Some questions:
What's the "best practices" way to load an assembly where its only purpose
is to provide resources?
In my simplistic view, I would just do something like this:
{
Assembly theAssembly = Assembly.LoadFi le(theFileName) ;
Image theImage =
Image.FromStrea m(theAssembly.G etManifestResou rceStream(resou rceID));
}
Now, I'm not looking for the "quick fix" here, this needs to be durable and
enterprise-grade. Is there somewhere else that I should be looking?
I thought about the resource manager, but it seems to be all about
internationaliz ation, and that's not really what I'm trying to solve here. 4 1774
J.Marsch <jm*****@newsgr oup.nospam> wrote: Building a large app where we want to be able to ship updated icons like patches/assign different "skins", etc.
So, I'm looking at storing sets of related icons in assemblies that will be loaded dynamically.
Some questions:
What's the "best practices" way to load an assembly where its only purpose is to provide resources?
In my simplistic view, I would just do something like this: { Assembly theAssembly = Assembly.LoadFi le(theFileName) ; Image theImage = Image.FromStrea m(theAssembly.G etManifestResou rceStream(resou rceID)); }
Now, I'm not looking for the "quick fix" here, this needs to be durable and enterprise-grade. Is there somewhere else that I should be looking?
I thought about the resource manager, but it seems to be all about internationaliz ation, and that's not really what I'm trying to solve here.
One way to make things simpler might be to include a single type in the
resource assembly - that way you can make sure the assembly is loaded
(and get a reference to the Assembly object) just by using
typeof(TypeInRe sourceAssembly) (etc).
Now, if you've already got a type within the assembly, you could make
that some kind of ImageManager type which is able to load the resources
requested and return images directly.
Does that help at all?
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Actually, yes that does help. I still think that I am going to have to load
the assembly dynamically, but it might be handy to have a manager sitting in
there to help with pulling out the resources -- I'll have to noodle on that
a bit.
Oh, and here's why I _think_ I need to do dynamic loads (I'm not dead-set on
that idea yet):
These icons might change as a result of a user preference. For example:
today maybe the set of icons in the assembly supports the "blue" XP look.
Maybe next week, we ship a download that supports the "silver" XP theme, and
maybe next year we toss one out that is more appropriate to Longhorn.
Even that is a simplification. There is a specific type of partition (think
of it as a business entity) in this system, and the user can associate
different color schemes with different entities. As they move from entity
to entity, the application will change in obvious ways (different large
icons and headings), and subtly (different accent colors and tree icons,
etc).
So these resource assemblies are sort of like extensions, or plug-ins but
they do not offer code, just alternate resources. In some ways, that is
kind of like internationaliz ation; it's just that the selection of the
resource set is not tied to culture.
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com... J.Marsch <jm*****@newsgr oup.nospam> wrote: Building a large app where we want to be able to ship updated icons like patches/assign different "skins", etc.
So, I'm looking at storing sets of related icons in assemblies that will be loaded dynamically.
Some questions:
What's the "best practices" way to load an assembly where its only purpose is to provide resources?
In my simplistic view, I would just do something like this: { Assembly theAssembly = Assembly.LoadFi le(theFileName) ; Image theImage = Image.FromStrea m(theAssembly.G etManifestResou rceStream(resou rceID)); }
Now, I'm not looking for the "quick fix" here, this needs to be durable and enterprise-grade. Is there somewhere else that I should be looking?
I thought about the resource manager, but it seems to be all about internationaliz ation, and that's not really what I'm trying to solve here.
One way to make things simpler might be to include a single type in the resource assembly - that way you can make sure the assembly is loaded (and get a reference to the Assembly object) just by using typeof(TypeInRe sourceAssembly) (etc).
Now, if you've already got a type within the assembly, you could make that some kind of ImageManager type which is able to load the resources requested and return images directly.
Does that help at all?
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
J.Marsch <jm*****@newsgr oup.nospam> wrote: Actually, yes that does help. I still think that I am going to have to load the assembly dynamically, but it might be handy to have a manager sitting in there to help with pulling out the resources -- I'll have to noodle on that a bit.
Oh, and here's why I _think_ I need to do dynamic loads (I'm not dead-set on that idea yet):
These icons might change as a result of a user preference. For example: today maybe the set of icons in the assembly supports the "blue" XP look. Maybe next week, we ship a download that supports the "silver" XP theme, and maybe next year we toss one out that is more appropriate to Longhorn.
Even that is a simplification. There is a specific type of partition (think of it as a business entity) in this system, and the user can associate different color schemes with different entities. As they move from entity to entity, the application will change in obvious ways (different large icons and headings), and subtly (different accent colors and tree icons, etc).
So these resource assemblies are sort of like extensions, or plug-ins but they do not offer code, just alternate resources. In some ways, that is kind of like internationaliz ation; it's just that the selection of the resource set is not tied to culture.
Right. That seems pretty reasonable, yes. You may want to think about
organising your resources in the same way as for cultures, with a
hierarchy (which in your case may be arbitrarily deep). So, for
instance, you might have:
MyResources
MyResources-Windows
MyResources-Windows-XP
MyResources-Windows-XP-Silver
MyResources-Windows-XP-Blue
MyResources-Windows-Longhorn
MyResources-Linux
MyResources-Linux-Gnome
MyResources-Linux-KDE
with each deferring requests for any unfound resources to its "parent".
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Yes, that makes sense. Thank you for the commentary, Jon.
-- Jeremy
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com... J.Marsch <jm*****@newsgr oup.nospam> wrote: Actually, yes that does help. I still think that I am going to have to load the assembly dynamically, but it might be handy to have a manager sitting in there to help with pulling out the resources -- I'll have to noodle on that a bit.
Oh, and here's why I _think_ I need to do dynamic loads (I'm not dead-set on that idea yet):
These icons might change as a result of a user preference. For example: today maybe the set of icons in the assembly supports the "blue" XP look. Maybe next week, we ship a download that supports the "silver" XP theme, and maybe next year we toss one out that is more appropriate to Longhorn.
Even that is a simplification. There is a specific type of partition (think of it as a business entity) in this system, and the user can associate different color schemes with different entities. As they move from entity to entity, the application will change in obvious ways (different large icons and headings), and subtly (different accent colors and tree icons, etc).
So these resource assemblies are sort of like extensions, or plug-ins but they do not offer code, just alternate resources. In some ways, that is kind of like internationaliz ation; it's just that the selection of the resource set is not tied to culture.
Right. That seems pretty reasonable, yes. You may want to think about organising your resources in the same way as for cultures, with a hierarchy (which in your case may be arbitrarily deep). So, for instance, you might have:
MyResources MyResources-Windows MyResources-Windows-XP MyResources-Windows-XP-Silver MyResources-Windows-XP-Blue MyResources-Windows-Longhorn MyResources-Linux MyResources-Linux-Gnome MyResources-Linux-KDE
with each deferring requests for any unfound resources to its "parent".
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Adrian MacNair |
last post by:
Hi,
I created an image gallery which displays 63 images in a slideshow. The
problem is that the show was slow because each image loaded one at a time
during the show. No problem right? I just did a preload script. But then the
user has to sit for 5 minutes waiting for 63 images to download! My images
are about 640x480 and average 100kb. Is this too much for one page to load?
Should I load my slideshow into differerent windows? If so,...
|
by: D. Yates |
last post by:
Hi,
I am looking for an example of how to extract bitmap images from an embedded
resource file (a file with *.res extension, which can be viewed inside of
the ide and can hold bitmaps, icons, string tables, etc.) and place them
into a imagelist.
I have found examples using the resource manager to create a "resource file"
like so:
ResourceWriter rw = new ResourceWriter (
|
by: Novice |
last post by:
I'm afraid I will incur the wraith of Mr. Powell on this one - but I did read
his #1 FAQ and some others and I still can't figure this out.
I created this little c# app. and I have a PictureBox in my Form. I load
this image from the filesystem into the PictureBox and then I draw random
little lines on the image. Then when I minimize and reopen the application
the little lines are gone.
Is there a way to save my lines in memory and...
|
by: Joshua Kendall |
last post by:
I have a splash screen that is set to a timer. When the
timer reaches it's Interval of 1000, I want it to load
the next form in my project. My brother knows VB6 from
school but can't figure out whats wrong with my code.
Need help ASAP!
Thank you for your help in advance!
|
by: Joshua Kendall |
last post by:
I need to know the code to load another form. In vb6 it's
simply "load" what is it in dotnet?
Anyway here's my code:
Public Class Splash
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
| |
by: Ivan Sammut |
last post by:
Hi,
Anyone can give me an example on how to load a bitmap from resource.
Thanks
Ivan
|
by: Chris Tomlinson |
last post by:
Hi, is there any way to specify the sequence in which images load on a web
page?
More specifically, here is what we need to achieve:
Image1 starts loading first and the browser does not continue through the
HTML until Image1 has loaded COMPLETELY. When Image1 is done, Image2 BEGINS
loading. When Image2 is 100% done, only then does Image 3 begin... and so
on...
|
by: MsNews |
last post by:
Hi,
I'm creating a free Icon library in C# with source code include, it already
support .ico/.dll../exe and I'd like to support .ICL format too, I need to
load a file .ICL (Icon Library) that basically it is a 16-bit dll and then
after that I can extracts and insert icons inside.
I tried the only function in Win32API left for 16bit (LoadModule), it loads
the library but Windows starts to give strange message boxes, as "Not enough...
|
by: speedcoder |
last post by:
hi all,
i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and incurred a network hit per image file.
i wanted to avoid the overhead of a separate network connection for each image file, so i bundled all the images into the JAR file. yet, somehow, the loading time for the applet is slower now! i'm totally...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |