Visualizzazione post con etichetta Visual Studio. Mostra tutti i post
Visualizzazione post con etichetta Visual Studio. Mostra tutti i post

domenica 4 maggio 2008

How to embed a resource in a DotNet DLL (and how to use it)

In my previous post I proposed a web custom control useful to embed videos in your web pages.
The control is made of some server-side code written in C# and some javascript functions and one flash plug-in, both client-side.
An interesting point is that all the necessary code is embedded in a single DLL, making the exploiting process in a ASP.NET panorama easier.

Step 1
In the Solution Explorer, over the file that you want to embed, right-click and choice Properties then set “”Embedded Resource” on “Build Action” :



Step 2
If the file is a web resource that you want to reference with an URL (for example a javascript file, a flash plug-in or a css file) you must open the Properties/AssemblyInfo.cs file:


Then add the following line (Filename.extension is the file to embed, Namespace is the namespace of the project or of the control and MIME_Type is the MIME type of the file):

[assembly: WebResource(“Namespace.Filename.extension”, “MIME_Type“)]


For example in my previous project:

Step 3
Using the embed file is easy, you can obtain the referencing URL with the GetWebResourceUrl method:

Page.ClientScript. GetWebResourceUrl (this.GetType(), Namespace.Filename.extension)

That’s all!

domenica 9 marzo 2008

EmbedVideo: a web control to embed video (FLV, WFV, ...) and Flash animations

CalSoft.EmbedVideo is a web custom control for ASP.NET. It is useful to put videos or Flash animations in your web pages.
It supports AVI, WMV and any other kind of formats supported by Windows Multimedia Player and FLV files on every Flash-enabled browser thanks to OS FLV, a free Flash 9 player and, finally, SWF files. The objects are embedded with a free javascript library, SWFobject that manages also browser differences and Flash versions.
Some interesting points are:
- thanks to the SWFobject it resolve EOLAS problems (the gray frame around the control and the need for an extra click to activate it) in IE.
- all the extra files (the two JavaScript libraries and the swf player) are embedded inside a single DLL.

Installation:
- download and unzip EmbedVideo20.zip (framework 2.0) or EmbedVideo30.zip (framework 3.0) or EmbedVideo35.zip (framework 3.5)
- create your web project in Visual Web Developer 2008 (or other Visual Studio products)
- right click on the toolbox window
- click on "Choose Items ..."
- click "Browse..." and select the EmbedVideo.dll just unzipped.

Now you are ready to use the control easily in your project: drag it in the page and set the properties (the meaning of each property is banal).


The icon of the control:


Note that the current version isn't compatible with ajax.net and was developed with Visual #C Express 2008.

The control is released under GPL license; please pay attention to the licenses of applications and libraries embedded consulting the respective sites.

Download the source
Download EmbedVideo DLL for framework 2.0
Download EmbedVideo DLL for framework 3.0
Download EmbedVideo DLL for framework 3.5
Sample here

Some useful links:
OS FLV
SWFObject
Pazera Free Video to Flash Converter

martedì 20 novembre 2007

Visual Studio 2008 Express Released

Last Monday Microsoft released Visual Studio 2008 Express edition.
You can download them here.

Enjoy!