WELCOME TO SILVERLIGHT

DARE TO BE DIFFERENT

Wednesday, June 10, 2009

Using MediaElement Control in Silverlight

  • MediaElement Control enables the user to professionally present the application in Silverlight.
  • MediaElement is same as the image brush,in MediaElement we can add Video and Audio in our applications.

Let us see a simple example

Here we use three Button Control namely Play,Pause andStop.

Play: Plays the Video.

Pause:Pauses the Video.

Stop: Stops the Video.

XAML Coding:

<MediaElement Name="abc" Source="mov1.wmv" ></MediaElement>
<Button Name="a1" Height="40" Width="40" VerticalAlignment="Bottom" HorizontalAlignment="Left" Content="play" Click="Button_Click"></Button>
<Button Name="a2" Height="40" Width="40" VerticalAlignment="Bottom" HorizontalAlignment="Center" Content="pause" Click="Button_Click_1"></Button>
<Button Name="a3" Height="40" Width="40" VerticalAlignment="Bottom" HorizontalAlignment="Right" Content="stop" Click="Button_Click_2"></Button>


C# Coding:

public partial class Page : UserControl
{
public Page()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
abc.Play();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
abc.Pause();
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
abc.Stop();
}
}

Output:




Monday, June 8, 2009

Setting Image as Background of a Calendar


<basics:Calendar.Background>
<ImageBrush ImageSource="Garden.jpg" Opacity="0.3"/>
</basics:Calendar.Background>

Formatting a Calendar


<basics:Calendar.BorderBrush>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" >
<GradientStop Color="Blue" Offset="0" />
<GradientStop Color="Red" Offset="1.0" />
</basics:Calendar.BorderBrush>

Highlighting a Day in Calendar


MonthlyCalendar.FirstDayOfWeek = DayOfWeek.Monday;
MonthlyCalendar.IsTodayHighlighted = true;

To BlackoutDates in Calendar


private void SetBlackOutDates()
{
MonthlyCalendar.BlackoutDates.Add(new CalendarDateRange(
new DateTime(2009, 1, 1),
new DateTime(2009, 1, 4)
));
}

Selection Modes and Selection Dates in calendar



<basics:Calendar SelectionMode="SingleRange">
<basics:Calendar SelectionMode="SingleDate">
<basics:Calendar SelectionMode="MultipleRange">

Display Modes in Calendar


<basics:calendar displaymode="“Year”">
<basics:calendar displaymode="“Decade”">
<basics:calendar displaymode="“Month”">



Creating a simple Calendar





<basics:calendar></basics:calendar>

Friday, May 29, 2009

What is Language Integrated Query

  • LINQ is a .NET Framework component.
  • Defines a set of proprietary query operators used to

  1. Filter data in arrays.
  2. Enumerable classes.
  3. XML (XLINQ).
  4. Relational database.
  5. Third party data sources.

Thursday, May 28, 2009

System.Threading

  • Helps facilitate multithreaded programming.
  • It allows the synchronizing of "thread activities and access to data".
  • Provides "a pool of system-supplied threads".

System.Text

Supports
1.Encodings.
2.Regular expressions.
3.Manipulating strings (StringBuilder).

System.Runtime

  • Allows you to manage the runtime behavior of an application or the CLR.
  • Some of the included abilities are
    1.Interoping with COM or other native code,
    2.Writing distributed applications
    3.Serializing objects into binary or SOAP.

System.Linq

Defines the IQueryable interface and related methods, that lets LINQ providers to be plugged in.

System.Net

  • Provides an interface for many of the protocols.

Ex: HTTP, FTP, and SMTP.

  • Secure communication is supported by protocols such as SSL.

System.Media

Provides you the ability to play system sounds and .wav files.

System.IO

  • Allows you to read from and write to different streams.
  • Provides a connection to the file system.

System.Globalization

  • Provides help for writing internationalized applications.
    1.Culture-related information.
    2.Language.
    3.Country/region.
    4.Calendars in use.
    5.Currency.
    6.Numbers.
    can be defined.

System.Diagnostics

  • Ability to diagnose your application.
  • It includes
    i) Event logging.
    ii) Performance counters.
    iii) Tracing.
    iv) Interaction with system processes.

System.Data

  • Represents the ADO.NET architecture.
  • Set of computer software components used to
  1. Access data.
  2. Data services.

System.ComponentModel

  • Implement the run-time and design-time behavior.
  • It contains the :

1.For implementing attributes.
2.Type converters.
3.Binding to data sources.
4.Licensing components.

System.Collections

Defines many common containers or collections used in programming, such as
1.Lists.
2.Queues.
3.Stacks.
4.Hashtables.
5.dictionaries.
6.It includes support for generics.

Monday, May 4, 2009

What is Model View Presenter?

Model View Presenter

MVP pattern is one of the major patterns used for extracting business logic outside of UI elements and by that, enabling unit testing the UI without the need for using specific UI based testing tool.
As we can see from this diagram:
  • View contains the Presenter instance (view "knows" presenter) .
  • Presenter is the only class knowing how to reach to model and retrieve the data needed for performing business logic.
  • Presenter talks to the View through the view.
  • View doesn't know anything about the Model.
  • View responsibility is to show the data provided by presenter.
  • Purpose of the presenter is to reach to model, retrieve the needed data, performs required processing and returns the UI prepared data to the view.

what is Really Simple Syndication?



  • Really Simple Syndication(RSS) is a family of Webfeed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format.

  • An RSS document (which is called a "feed", "web feed or "channel") includes full or summarized text, plus metadata such as publishing dates and authorship.

  • Web feeds benefit publishers by letting them syndicate content automatically.

  • They benefit readers who want to subscribe to timely updates from favored websites or to aggregate feeds from many sites into one place.

  • RSS feeds can be read using software called an "RSS reader", "feed reader", or "aggregator", which can be web-based, desktop-based, or mobile-device-based.

  • A standardized XML file format allows the information to be published once and viewed by many different programs.

  • The user subscribes to a feed by entering the feed's URI, often referred to informally as a "URL" (uniform resource locator), although technically the two terms are not exactly synonymous, into the reader, or by clicking an RSS icon in a browser that initiates the subscription process.

  • The RSS reader checks the user's subscribed feeds regularly for new work, downloads any updates that it finds, and provides a user interface to monitor and read the feeds.

  • RSS formats are specified using XML, a generic specification for the creation of data formats.

Model–view–controller (MVC)



  • Model–view–controller (MVC) is an architectural pattern used in software engineering.

  • Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other.

  • In MVC, the model represents the information (the data) of the application.

  • The view corresponds to elements of the user interface such as text, checkbox items, and so forth.

  • And the controller manages the communication of data and the business rules used to manipulate the data to and from the model.

Sunday, May 3, 2009

Digital rights management (DRM)



  • Digital rights management (DRM) is a generic term that refers to access control technologies that can be used by hardware manufacturers, publishers, copyright holders and individuals to impose limitations on the usage of digital content and devices.

  • The term is used to describe any technology which makes the unauthorized use of such digital content and devices technically formidable.

  • It can also refer to restrictions associated with specific instances of digital works or devices.

  • Digital rights management is being used by companies such as Sony, Apple Inc.,Microsoft and the BBC.

Atom Syndication Format



  • The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol is a simple HTTP-based protocol for creating and updating web resources.


  • Web feeds allow software programs to check for updates published on a web site.


  • To provide a web feed, a site owner may use specialized software that publishes a list of recent articles or content in a standardized, machine-readable format.


  • The feed can then be downloaded by web sites that syndicate content from the feed, or by feed reader programs that allow Internet users to subscribe to feeds and view their content.


  • A feed contains entries, which may be headlines, full-text articles, excerpts, summaries, and/or links to content on a web site, along with various metadata.

What is Reflection?

  • Reflection is the ability to examine the structure and components of a program at run time.
  • The APIs that implement reflection are extensions of the Type class.
  • These methods enable you to collect information about an object, such as what it inherits from, whether it implements a particular interface, and whether it is an instance of a particular class.

Base Class Library (BCL)



  • The Base Class Library (BCL) is a standard library available to all languages using the .NET Framework

  • .NET includes the BCL in order to encapsulate a large number of common functions, such as file reading and writing, graphic rendering, database interaction, and XML document manipulation.

  • It is much larger in scope than standard libraries for most other languages, including C++, and would be comparable in scope to the standard libraries of Java.

  • The BCL is sometimes incorrectly referred to as the Framework Class Library (FCL), which is a superset including the Microsoft.* namespaces.

  • The BCL is updated with each version of the .NET Framework.

Windows Presentation Foundation



The WPF is




Formerly code-named Avalon.


A graphical subsystem in .NET Framework 3.0.


Uses a markup language, known as XAML, for rich user interface development.

What is Singleton Pattern ?

  • A singleton is a class which only allows a single instance of itself to be created, and usually gives simple access to that instance.
  • The Singleton pattern ensures that a class only has one instance and provides a global point of access to it from a well-known access point.
  • The class implemented using this pattern is responsible for keeping track of its sole instance rather than relying on global variables to single instances of objects.
  • Most commonly, singletons don't allow any parameters to be specified when creating the instance.

C# Coding:

namespace DesignPatterns
{
public sealed class Singleton
{
private static readonly Singleton
instance = new Singleton();
private Singleton()
{
}
public static Singleton Instance
{
get
{
return instance;
}
}
}
}
// code to access the Singleton.
using System.Diagnostics;
using DesignPatterns;
Trace.WriteLine(Singleton.Instance.ToString());

Tuesday, April 28, 2009

What is JavaScript?

  • JavaScript is a scripting language used to enable programmatic access to objects within other applications.
  • It is primarily used in the form of client-side JavaScript for the development of dynamic websites.
  • JavaScript is a dialect of the ECMAScript standard and is characterized as a dynamic, weakly typed, prototype-based language with first-class functions.
  • JavaScript was influenced by many languages and was designed to look like Java, but be easier for non-programmers to work with.

Media features in Silverlight 2.0

  • WMA Professional support, including WMA 10 Pro low-bitrate modes.
  • However, multi-channel audio content is still down-converted to stereo output.
  • Content protection powered by Microsoft PlayReady DRM client.
  • Server-side playlists in Windows Media Services.
  • Media Stream Source API.

How to load XML from a file..?

C# Coding:

private void btnLoadXmlFromFile_Click (object sender, EventArgs e)
{
XElement bookStoreXml = XElement.Load (@"C:\Temp\Bookstore.xml"); MessageBox.Show(bookStoreXml.Xml);
}

How to Save in XML file?

You can save to a file, a TextWriter, or an XmlWriter.
For example, to save the XDocument contents to a file named Bookstore.xml,
you can write:


C# Coding:

private void btnSaveXML_Click(object sender, EventArgs e)
{
XDocument bookStoreXml = new XDocument(new XDeclaration("1.0", "utf-8","yes"), new XComment("Bookstore XMLExample"), new XElement("bookstore", ---- ---- ) ); bookStoreXml.Save(@"C:\Temp\Bookstore.xml");
MessageBox.Show("Successfully saved");
}

XElement class

XElement class is bottom-most in the class hierarchy in XLinq, it is the fundamental class.

As the name suggests, it represents an XML element and allows you to perform the following operations:

  • Create elements with a specified element name
  • Change the element's contents
  • Add, change, or delete child elements
  • Add attributes to the element
  • Save the element as an XML fragment
  • Extract the contents in text form.

Key Components of LINQ

At this early stage, the LINQ family consists of three technologies, although Microsoft or third-party developers may add more in the future:

  • LINQ is a general purpose API that provides the core foundation for a consistent query experience.
  • DLinq (also known as LINQ to SQL) is a LINQ extension geared mainly towards relational databases.
  • XLinq (also known as LINQ to XML) is a LINQ extension for querying XML documents, as well as creating or transforming XML.

Representational State Transfer (REST)



  • Representational State Transfer (REST) is an architectural style for building distributed systems.

  • The WWW is an example for such a system.

  • REST-style applications can be built using a wide variety of technologies.

  • REST's main principles are that of resource-oriented states and functionalities.

  • The idea of a unique way of identifying resources, and the idea of how operations on these resources are defined in terms of a single protocol for interacting with resources.

  • REST-oriented system design leads to systems which are open, scalable, extensible and easy to understand.

Sunday, April 19, 2009

Benefits of Rich Internet Applications

  • RIAs offer organizations a proven, cost-effective way to deliver modern applications with real business benefits.

  • Offer users a richer, more engaging experience.

  • Keep pace with users rising expectations.

  • Increase customer loyalty and generate higher profits.

  • Leverage existing personnel, processes, and infrastructure.

Interactive Page Elements in RIA


One way to add richness to your application is to allow users to directly interact with page elements:



  • Editing text inline.

  • Dragging.

  • Dropping graphic Elements.

  • Panning a map. A primary challenge is to communicate what can be done with page elements and how to use new controls.

  • People must be able to identify that a control exists and easily determine how to use it.

Key features of RIA Applications



  • The user interacts directly with page elements (inline editing, drag-and-drop, panning a map).

  • Part of a page is updated (instead of reloading).

  • More detailed information is available on the same page (instead of on a new page).

  • Feedback, confirmation and error messages are provided within the page.

What’s an Rich Internet Application?


RIAs are a cross between Web applications and traditional desktop applications, transferring some of the processing to the client end.

Difference between RIA and other applications


  • The key difference between RIAs and other Internet applications is the amount of interaction in the interface.

  • In a traditional page-based Internet application, interaction is limited to a small set of standard controls such as checkboxes, radio buttons, form fields and buttons.

  • An RIA can use a wider range of controls to improve users’ interaction with the interface, allowing efficient interactions, better error management, feedback and overall user experience.

Application programming interface


An application programming interface (API) is a set of routines, data structures, object classes and/or protocols provided by libraries and/or operating system services in order to support the building of applications.


An API may be:


Language-dependent



  • Available only in a particular programming language, using the particular syntax and elements of the programming language to make the API convenient to use in this particular context.

Language-independent



  • Written in a way that means it can be called from several programming languages .

  • This is a desired feature for a service-style API that is not bound to a particular process or system and is available as a remote procedure call.

Wednesday, April 15, 2009

What is WSDL?

WSDL is an XML-based language for describing Web services and how to access them.

  • WSDL stands for Web Services Description Language.
  • WSDL is based on XML.
  • WSDL is used to describe Web services.
  • WSDL is also used to locate Web services.
  • WSDL is a W3C standard.

What is UDDI?

UDDI is a directory service where businesses can register and search for Web services.

  • UDDI stands for Universal Description, Discovery and Integration.
  • UDDI is a directory for storing information about web services.
  • UDDI is a directory of web service interfaces described by WSDL.
  • UDDI communicates via SOAP.
  • UDDI is built into the Microsoft .NET platform.

What is SOAP?

SOAP is a simple XML-based protocol to let applications exchange information over HTTP.

Or more simple:

  • SOAP is a protocol for accessing a Web Service.
  • SOAP stands for Simple Object Access Protocol.
  • SOAP is a communication protocol.
  • SOAP is a format for sending messages .
  • SOAP is designed to communicate via Internet.
  • SOAP is platform independent.
  • SOAP is language independent.
  • SOAP is based on XML .
  • SOAP is simple and extensible .
  • SOAP allows you to get around firewalls .
  • SOAP is a W3C standard.

Tuesday, April 14, 2009

How Silverlight would change the Web:

  1. Highest Quality Video Experience : prepare to see some of the best quality videos you have seen in your life, all embedded in highly graphical websites. The same research and technology that was used for VC-1, the codec that powers BluRay and HD DVD, is used by Microsoft today with its streaming media technologies.
  2. Cross-Platform, Cross-Browser : Finally build web applications that work on any browser, and on any operating system. At release, Silverlight will work with Mac as well as Windows! The Mono project has also already promised support for Linux!.
  3. Developers and Graphic Designers can play together! : Developers familiar with Visual Studio, Microsoft.net will be able to develop amazing Silverlight applications very quickly, and they will work on Mac's and Windows. Developers will finally be able to strictly focus on the back end of the application core, while leaving the visuals to the Graphic Design team using the power of XAML.
  4. Cheaper : Silverlight is now the most inexpensive way to stream video files over the internet at the best quality possible. Licensing is dead simple, all you need is IIS in Windows Server, and you’re done.
  5. Support for 3rd Party Languages : Using the power of the new Dynamic Language Runtime, developers will now be able to use Ruby, Python, and EcmaScript! This means a Ruby developer can develop Silverlight applications, and leverage the .net Framework!
  6. Cross-Platform, Cross-Browser Remote Debugging : If you are in the need to debug an application running on a Mac, no problem! You can now set breakpoints, step into/over code, have immediate windows, and all that other good stuff that Visual Studio provides.
  7. The best development environment on the planet : Visual Studio is an award winning development platform! As it continues to constantly evolve, so will Silverlight!
  8. Silverlight offers copy protection : Have you noticed how easy it is to download YouTube videos to your computer, and save them for later viewing ? Silverlight will finally have the features enabling content providers complete control over their rich media content! Streaming television, new indie broadcast stations, all will now be possible!
  9. Extreme Speed :There is a dramatic improvement in speed for AJAX-enabled websites that begin to use Silverlight, leveraging the Microsoft .net framework.

Main features of Silverlight 2.0 :

  1. A built-in CLR engine that delivers a super high performance execution environment for the browser. Silverlight uses the same core CLR engine that we ship with the full .NET Framework.
  2. Silverlight includes a rich framework library of built-in classes that you can use to develop browser-based applications.
  3. Silverlight includes support for a WPF UI programming model. The Silverlight 1.1 Alpha enables you to program your UI with managed code/event handlers, and supports the ability to define and use encapsulated UI controls.
  4. Silverlight provides a managed HTML DOM API that enables you to program the HTML of a browser using any .NET language.
  5. Silverlight doesn't require ASP.NET to be used on the backend web-server (meaning you could use Silverlight with with PHP on Linux if you wanted to).
  6. Silverlight 2 includes Deep Zoom, a technology derived from Microsoft Live Labs Seadragon. It allows users to zoom into, or out of, an image (or a collage of images), with smooth transitions, using the mouse wheel. The images can scale from 2 or 3 megapixels in resolution into the gigapixel range, but the user need not wait for it to be downloaded entirely; rather, Silverlight downloads only the parts in view, optimized for the zoom level being viewed.
  7. Silverlight 2 also allows limited filesystem access to Silverlight applications. It can use the operating system's native file dialog box to browse to any file (to which the user has access).

Silverlight 2.0 :

  • Silverlight 2.0 includes a version of the .NET Framework, with the full Common Language Runtime as .NET Framework 3.0;
  • So it can execute any .NET language including VB.NET and C# code.
  • Unlike the CLR included with .NET Framework, multiple instances of the CoreCLR included in Silverlight can be hosted in one process.
  • With this, the XAML layout markup file (.xaml file) can be augmented by code-behind code, written in any .NET language, which contains the programming logic.
  • This version ships with more than 30 UI controls(including TextBox, CheckBox, Slider, ScrollViewer, and Calendar controls), for two-way databinding support, automated layout management (by means of StackPanel, Grid etc) as well as data-manipulation controls, such as DataGrid and ListBox.
  • UI controls are skinnable using a template-based approach.

Main features of Silverlight 1.0 :

1. Built-in codec support for playing VC-1 and WMV video, and MP3 and WMA audio within a browser.
2. Silverlight supports the ability to progressively download and play media content from any web-server.
3. Silverlight also optionally supports built-in media streaming.
4. Silverlight enables you to create rich UI and animations, and blend vector graphics with HTML to create compelling content experiences.
5. Silverlight makes it easy to build rich video player interactive experiences.

Silverlight 1.0 :

Silverlight 1.0 consists of the core presentation framework,which is responsible for

  • UI interactivity
  • user input
  • basic UI controls
  • graphics and animation
  • media playback
  • DRM support
  • DOM integration.

What is Silverlight?

  • Silverlight is a new 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.
  • It runs in all popular browsers, including Microsoft Internet Explorer, Mozilla Firefox, Apple Safari, Opera.
  • The plugin required to run Silverlight is very small in size hence gets installed very quickly.

Wednesday, April 8, 2009

Windows Presentation Foundation (WPF) and Silverlight

WPF:

  • WPF is Microsoft's new GUI framework that replaces all of the old"Windows Forms" and Win32 API.
  • It builds on a vector based and GPU-enabled drawing framework (DirectX), and adds the ability to create richer UIs than Windows Forms does.
  • The look and feel is also new.
  • WPF applications can be deployed to the desktop or run in Internet Explorer .
  • When WPF application run in Internet Explorer they run in a sandbox, so users simply point Internet Explorer at an URL and your application appears without any installation or confirmation need.
  • All development tools are the same (Visual Studio) when making desktop and browser-based WPF applications, and you can use the same widgets for both.


Silverlight:

  • Like WPF-applications can run in a browser, so do Silverlight applications.
  • But Silverlight applications can be deployed to more platforms (OS X and Linux) and more browsers.
  • This does however come with a cost.
  • Like browsers-based WPF applications lose access to some functions compared to desktop applications, Silverlight applications can build on even less infrastructure.
  • The GUI is one (of many) missing elements in Silverlight.

Difference between WPF and Silverlight2.0

1. WPF is programmed with your favorite .NET language, Silverlight is currently programmed with JavaScript only (there's was talk of cross-platform .NET support coming) .

2. Silverlight does not support some of the more advanced concepts of WPF such as controls, templating, 3D etc.,

3. Silverlight integrates right into an HTML page where as WPF XAML files have to be loaded via a frame if they want to mix with HTML content.

Monday, April 6, 2009

Web Services Working and its Platform elements

How Web Services Work?

The basic Web services platform is XML + HTTP.

The HTTP protocol is the most used Internet protocol.

XML provides a language which can be used between different platforms and programming languages and still express complex messages and functions.


Web Services platform elements:

SOAP (Simple Object Access Protocol)

UDDI (Universal Description, Discovery and Integration)

WSDL (Web Services Description Language)

What are Web Services?




  • Web services are application components.

  • Web services communicate using open protocols .

  • Web services are self-contained and self-describing.

  • Web services can be discovered using UDDI Web services can be used by other applications XML is the basis for Web services.