Aashish Singh Negi ...... The Pro

My photo
Mumbai/Rudraprayag, Maharashtra/Uttarakhand, India
Hello Friends, This is Aashish Singh Negi from Mumbai. I natively belong to Uttarakhand. I completed my engineering in Information Technology from Sinhgad Institute,Lonavla Of Pune University. I love Programming......... I know some programming languages like C,C++,Visual Basic,C#,SQL,etc. and work upon various technologies like ASP .NET,Silverlight 3.0,Silverlight 4 Beta, Microsoft Pivot, Photosynth,Deep Zoom, Azure Cloud Computing, etc. I love techno topic very much.Love to watch videos of new technologies(softwares,hardwares,etc) launched by different companies............
Showing posts with label beta. Show all posts
Showing posts with label beta. Show all posts

Saturday, January 9, 2010

Silverlight 4 Beta - Playing with WebCam, Printing Support

First of all i should thank a bunch of people who helped me in creating this application.

You can view the Silverlight 4 application i created at http://testing.aashishnegi.com/Default.html. You should have a WebCam on your machine and the machine should be installed with Silverlight 4 Developer Runtime. It will not work in silverlight3 plug-in nor the plug-in will get updated through the popup it displays. You should manually download and install the SL4 Runtime from Silverlight.net.
Now i will briefly discuss about the project and how you can have a little modifications and try out various new things.
Lets start with a preview of how the screen looks and the controls i placed on the screen.



  • WebCam & Mic Support: Lets start and see how we can add the webcam support to the application.
CaptureSource provides us with the methods that work with specific audio or video capture from the associated capture device.






After the CaptureSource is initialized, VideoCaptureDevice can be used to to get the default device configuration. CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice() provides it with the default configures video device. If you right click on Silverlight App and select the Silverlight Plug-in then under the WebCam/Mic tab, we can select and set the default device.

After this the CaptureSource we created above can be used to control the camera. The CaptureSource.Start() and CaptureSource.Stop() will start and stop the cam. As the use of Cam requires user intervention the methods CaptureDeviceConfiguration.AllowedDeviceAccess  and the function CaptureDeviceConfiguration.RequestDeviceAccess() provides user with following dialog box for access request.








In above code the “viewer” is a rectangle that is filled with the brush “VideoBrush” to display the captured input of device.


Clicking Of Pic is something i felt a bit difficult and i referred Vikram’s Blog for understanding this. Following is the code bit for it.





AsyncCaptureImage() can be used to click a snap from the CaptureSource. The Image img is used to add the image to the list box after it is clicked.
  • Saving the image as PNG: This section will tell how to save the image we clicked. For this you can refer the following bit of code. .NET Image Tools Library is used in following code lines. .NET Image Tools made it very easy.






  • Printing Support: Lets see how we can print something using Silverlight 4 printing support.




Here we can see that PrintDocument class provides printing capabilities for a Silverlight application. As in above code we can see i initialized the PrintDocument and initiated a EventHandler which checks for when the PrintingPage event occurs. Print() can be used to show a Print dialog box.

The PageVisual property is used to choose what elements or rather UIElements we need to print.The PrintableArea defines the area to be printed. HasMorePages represents whether there are more pages to print. Its a bool that returns true if there are more pages to print.

StartPrint can be used if we need to perform some special handling or set up before beginning the printing. The EndPrint event can be used to perform cleanup operations after printing is complete or to detect errors that occured during the printing process. EndPrintEventArgs.Error property will give out the error occured.
  • I am currently working with the other new features of Silverlight 4 Beta like Out-of-browser Network Support, Drag and Drop + ClipBoard support, WCF RIA, RightClick support, etc. I will soon blog about these too.

  • Thank You all for visiting my blog.

- Aashish Singh Negi
Twitter @aashishnegi
Phone: +919970141082

Wednesday, December 16, 2009

Exploring Silverlight 4 Beta ........

Hello Friends,

Recently Microsoft announced the next version of Silverlight to be released very soon. Currently in its beta Silverlight 4 has come up with very cool new features.

For writing this article i took the help of the recent Silverligt 4 Beta Documentation available online. You can also download the same and get started.

Those who are new to Silverlight, lets see what this documentation says about it .....

What is Silverlight ?

Microsoft Silverlight is a cross-browser, cross-platform implementation of the .NET Framework for building and delivering the next generation of media experiences and rich interactive applications (RIA) for the Web. Silverlight unifies the capabilities of the server, the Web, and the desktop, of managed code and dynamic languages, of declarative and traditional programming, and the power of Windows Presentation Foundation (WPF).

Silverlight enables you to create a state-of-the-art application that has the following features:

- It is a cross-browser, cross-platform technology. It runs in all popular Web browsers, including Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari, and on Microsoft Windows and Apple Mac OS X. You can design and develop your application without having to worry about which browser or platform your users have.

- It is supported by a very small download that installs in seconds.

- It streams video and audio. It scales video quality to everything from mobile devices to desktop browsers to 720p HDTV video modes.

- It includes compelling graphics that users can manipulate—drag, turn, and zoom—directly in the browser.

- It reads data and updates the display, but it doesn't interrupt the user by refreshing the whole page.


Other Features Of Silverlight ....

- WPF and XAML. XAML. Silverlight includes a subset of the Windows Presentation Foundation (WPF) technology, which greatly extends the elements in the browser for creating UI. WPF lets you create immersive graphics, animation, media, and other rich client features, extending browser-based UI beyond what is available with HTML alone. Extensible Application Markup Language (XAML) provides a declarative markup syntax for creating elements.

- Extensions to JavaScript. Silverlight provides extensions to the universal browser scripting language that provide control over the browser UI, including the ability to work with WPF elements.

- Networking support. Silverlight includes support for HTTP over TCP. You can connect to WCF, SOAP, or ASP.NET AJAX services and receive XML, JSON, or RSS data.

- LINQ. Silverlight includes language-integrated query (LINQ), which enables you to program data access using intuitive native syntax and strongly typed objects in .NET Framework languages.


Whats new in Silverlight 4 (Beta) .....

- New Out-of-Browser Features

- Elevated Trust

- Support for Late Binding

- DRM for Offline Scenarios

- Right to Left Flow Direction

- RichTextArea Control

- WebBrowser and HtmlBrush Controls

- ViewBox Control

- Implicit Styles

- Applying Multiple Transforms is Simplified

- Networking with Multicast

- Printing

- Data Binding Improvements

- Navigation Extensibility

- Collection Sets

- Parsing and Formatting Time Intervals

- Drag-and-Drop and Clipboard Scenarios

- Right-click Mouse Events

- Webcam and Microphone Support

- ADO.NET Data Services

- WCF RIA Services

- Silverlight Designer Improvements

- Dynamic Language Runtime


I will be discussing all of above features in my coming blogs .... so keep pinging me on http://blog.aashishnegi.com/

- Aashish Singh Negi

Mail : aashish.negi@sitgeeks.com

Twitter @aashishnegi

Phone : +919970141082