Showing posts with label Silverlight. Show all posts
Showing posts with label Silverlight. Show all posts

Friday, February 1, 2008

Looking for Silverlight News, Questions, Samples, Articles and Blogs?

Next time you want to find some information on Silverlight and want to search the web, you should check these sites instead and every Silverlight Developer / Designer should have it bookmarked.

For Questions:

Silverlight forums: Official web site and  forum for Microsoft Silverlight, Microsoft employees join the discussion sometimes but only so often.

For Samples:

Silverlight Gallery: Official web gallery to showcase Silverlight Applications.

For Tutorials

Silverlight Learn: Official quick start for developers getting started with Silverlight, with video tutorials, documentation, whitepapers and don't forget to Quickstarts.

Social Networking:

Get News and updates from Social Networking sites

Facebook: Silverlight

Tweeter: SilverlightNews

And for just about anything

 Silverlight Cream: All Blogs, Samples, Articles, News and almost everything about Silverlight, and and if you haven't subscribed to this feed yet then you should,  keep up the good work Dave. You are doing what Microsoft should be doing themselves, create user community, to share ideas or samples and Silverlight Gallery isn't enough.

Thursday, January 31, 2008

Feedback on HTML 5: Bury it!

W3C drafted new resolutions working draft for HTML 5, which may (I repeat "may") be available as a standard in couple of years, even if W3C convince all legacy browsers to be compatible to new drafted standards,  I for one don't see HTML 5 to be ever be accepted within developer community, I am actually surprised that W3C even bother drafting a new standards for HTML, there are not many developers who use HTML as their basic language, HTML is only used to render web pages at Client, no matter how far they stretch it HTML will still perform short with user interface,  scripting or managed code.

I am basing my judgement in accordance to the new and emerging technologies such as Silverlight, Flash, AIR, SVG, XUL, Java FX. HTML was thing of the past HTML was usable when Internet was accessed with a 56K dial up modem by the masses, that is just about a decade ago, we are still using HTML due to lack of proper browser standards but with new technologies especially Silverlight that is not going to last long.

Suggestion to W3C: Its about time we bury HTML deep where it actually belong and move ahead instead of going backwards.

Tuesday, January 22, 2008

Silverlight doesn't require .NET to run

In my previous post I have discussed about why Silverlight development in not traditional, and I talked about the biggest issue user and developers have with Mouse Button, I have made a list and I am trying to point and clarify all the misconceptions about Silverlight that are associate with traditional web development, where developers just expect thing to be like they were in ASP.NET or HTML.

When I first started with Silverlight I was a bit frustrated because nothing seem to work as it was meant to be I was expecting .NET libraries, resources and just about anything that I knew about traditional web development, the first day I started with Silverlight 1.1, I saw "Hello World" example and then decided to replace that text with a random number, I have used Cryptography quite a lot earlier and I like to use PRNG random number instead of Random, and so I wanted to import/include System.Security.Cryptography and I failed, I tried again and failed I tried System.Data failed, I tried System.Speech failed, this was too much for me and frustrated I gave up. Silverlight altogether.

And had it not been for a boring weekend few months later and that moment of curiosity of why I can't import those libraries in my Silverlight application, I would never have bothered with Silverlight. I think there are many developers out there who try what I did and who gave up the way I did, and the only reason is Silverlight is untraditional.

So what exactly am I bragging about? And what is so untraditional about Silverlight that I got wrong ? Why Microsoft restricted access to them libraries? Why was my misconception? Or did Microsoft really restricted libraries? The answer is simple and the impact is big.

Silverlight doesn't require .NET framework at Client/Server.

Huh? What? But Silverlight require .NET 3.5 isn't? Yes, of course it does! Is it confusing? Ok lets first talk about Silverlight Plug-in, do you know that "Silverlight is cross-platform"? And Silverlight plugin (1.0, 1.1, 2.0) is/will be in few MBs, So do you expect to installed all the framework in that few MBs? Or do you propose to install .NET framework on Mac/Linux? And do you also know that you can host Silverlight application on Linux servers (without .NET framework), just by setting MIME types for XAML?

So we don't need .NET framework on Client or Server?

That's what I said, didn't I?

But we need .NET framework 3.5 for Silverlight!

Yes, you need .NET framework 3.5 for Silverlight applications but not to host or render them in browsers, you need the framework to compile the Silverlight application. You need .NET Framework at compile time and not runtime.

So what does it mean to Silverlight applications? And what actually happen?

Silverlight when complied creates a DLL (Dynamic Link Library) which includes all embedded resources (if any) along with the complied managed code, Silverlight compiler uses .NET Framework 3.5  to compile this library, when a Silverlight application is initiated with Silverlight plug-in installed, the plug-in tell the browser to go and download the DLL or the downloader object and interprets the DLL to the browser to render or perform tasks.

So it means Silverlight can only include that libraries that Silverlight plug-in (running at the client) can interpret?

Yes and it is the reason you can't include any library reference in Silverlight.

Coming back to the examples for libraries that I have given earlier System.Security.Cryptography, System.Data and System.Speech. Since database is always present on the server, there is no point in using System.Data in Silverlight ever, Silverlight works in a browser sandbox and can't access generic hardware so System.Speech is out of question, but System.Security, well there is something that we can expect to use in Silverlight but can't because of choice, again System.Security uses .NET framework so the plug-in should be able to interpret it by itself, and if it is implemented then the plug-in size might increase by another 1MB, so the plug-in size will increase with every library they include, and while Microsoft is struggling with adoption of Silverlight, consider to include these libraries.

So what libraries will be included in Silverlight 2.0? And how big the plug-in will get?

That is Microsoft to answer, not me. And I am glad I don't have to make that decision to balance plugin size.

Microsoft pushes Silverlight Plug-in

From today, IT Administrators can bunch install Silverlight plug-in (1.0 of course), on all Windows machines on the network using Windows Server Update Services (WSUS). The plug-in is available from Microsoft Update, for more info check the Microsoft Update Team Blog.

The plug-in however is Optional (perhaps for  the legal battles with other browsers) and is available as "feature pack", and will require accepting EULA.

But within two weeks, February 12 to be precise, Microsoft will push the plug-in with automatic updates program, from the Microsoft Download Centre, and the install will be again Optional but Windows Genuine Advantage (WGA) free. This is made available with the Internet Explorer 7.0 update as WGA free, for more information check knowledge base

Friday, January 18, 2008

Silverlight Tutorials with VB.NET

I have been thinking about writing an e-book on Silverlight focusing on VB.NET, I had started to do Silverlight 1.1 Alpha tutorials on my personal blog but when I got busy, and because Silverlight 1.1 Alpha is very incomplete I laid it to rest waiting for the next version.

Well the next version as we all know is coming up in another month or two, so I might actually go ahead and make ebook on Silverlight 2.0 with VB.NET

My main reason to write a tutorial book is to give VB.NET developers a good start, I know I struggled with I first started with Silverlight.

The book I intend to write will have few tutorials and explain few other things and perhaps the architecture.

I would be very gratefully if other developers want to co-author the e-book and samples, and provide community the good head start, an e-book, completely free and will be released on Creative Commons license, to give developers the basic to start off the development process. I intend to publish this book by April/May 2008.

If you want to co-author the e-book then please get in contact with me, or if you are developers please atleast leave comments on what do you think about the idea and what topics you might expect to see.

Mouse Buttons - Why Silverlight web development is not traditional?

I have been active on Silverlight forums for a few months now and  most of the developers I see have problems with understanding that Silverlight is not like traditional web development environment. And the approach they have to take frightens them because it is not traditional.  They have fixed a  development mind frame with with HTML/Graphics and Server pages and sometimes it doesn't suit well with the Silverlight architecture. There are some areas of web development that with the introduction of Silverlight architecture get void, and I am set to make points of all of them and discuss the reason. Instead of doing all of them in one post I'll try to post multiple entry concentrating on a single method each time.

Mouse Buttons.

The most basic traditional method that developers gets wrong, Silverlight doesn't support Middle-Mouse button, Right-Mouse button or Double Click and developers have expressed this as crippled functionality or nonsense among other things, But the question they ask why only one mouse button is to an extend valid, and I'll try to shed some light on the reasons.

To answer why, we have to answer why Silverlight? Why not AJAX? What Silverlight brings to the application that AJAX doesn't besides easy of development? I say cross-platform compatibility, but they say AJAX is also cross platform compatible, I say with Right Mouse, or Middle Mouse button it isn't.

Let me explain in more detail, AJAX came into existence with writing clever JavaScript programs and pushing JavaScript to its limits, there are however different approaches for different browses, something that works in IE doesn't work on FireFox and something that works both in IE/FireFox doesn't work on Mac-Safari so the developer building AJAX application have to target particular browsers and write their application, one of the first reasons I was attracted to Silverlight was this cross platform compatibility. Write one application and run them on all.

Ok, but what does this have to do with Mouse buttons? The reason is Mac with its tradition doesn't have more than one mouse button, and this button in Windows terminology is interpreted as Left Mouse button, however in the last few years user have adopted the Mac-Might Mouse which have more than one mouse button, but the traditional Mac have only a single mouse button, so if you create a web application that is cross platform you have be use that all the users irrespective of their platform Mac/ Windows, or browser IE/FF/Safari/Opera.

You would ask what about double click? I say how would you double click on Mobile device? Not all mobile devices that access Internet are touch screen, and even on touch screen its hard to double click, when working on Silverlight you have to think the big picture, not traditional windows method. Microsoft have showed interest for Silverlight on Mobile devices but as yet, no particular announcements have been made. But expect to change that with Silverlight 2.0 RTM (by summer 2008). 

If say Microsoft have incorporated Silverlight with extended mouse functionality, and the developers who doesn't understand this functionality and/or its limits went on to implement such behaviour with some serious business logic, the end user accessing the application who can't access such behaviour due to hardware limitations can't access  such business logic, rendering the application useless.

To wrap it all up, Silverlight doesn't have extended mouse functionality for the same reasons as Adobe Flash doesn't.

Wednesday, January 16, 2008

Future of XBAP

Back at Mix'07 when I first heard about XBAP I thought it could prove very handy in coming years and I was expecting to see many applications in coming months build on XBAP, but the last time I had a healthy discussion about XBAP developers was in Nov'07, well that was about 2 months ago, as it happens I had that discussion just before we heard about Silverlight 2.0, so why is no one interested in XBAP anymore?

XBAP only came to existence because Silverlight (at the time 1.1 Alpha)  didn't provide the basic user controls, binding options, and many restrictions on Silverlight usage with assets and/or web services, Silverlight applications mostly lack the infrastructure to use .NET framework so the only option was XBAP.

XBAP was simple and neat idea build on WPF but when it come to universality, it lacked cross platform compatibility over Mac/Linux. But when Silverlight 2.0 was announced with user controls, binding, grids and to lift many restrictions like cross domain calls, and providing support for web services methods like SOAP/REST, the idea of developing XBAP applications just began to fade away.

So with Silverlight 2.0 Beta 1 to be released in next 6 weeks what is the future of XBAP? Its not a simple question and personally I am a bit optimist and would love to say good byes to XBAP but ever since Mix 07 Microsoft has disappointed me again and again with Silverlight, I am hoping the Mix 08 will change all that, but I am sure that after a few months after Silverlight 2.0 is released developers might again start to talk about XBAP but this time for some other features that Silverlight might lack mostly with 3D or networking supports like sockets or VOIP.

After Mix08 and Silverlight 2.0 Beta 1 is released I'll try to post the features that Silverlight 2.0 lacks and in what situations would XBAP could be used, if at all. Please stay tuned.

Sunday, January 6, 2008

Silverlight News at CES 2008

Bill Gates presented his last keynote at CES 2008 today at Las Vegas, and since Microsoft have announced many products at CES in the last few years including XBOX 360 and Microsoft Vista I was hoping against hope that we might get few announcements for Silverlight.

But disappointedly no, I had asked Scott Guthrie earlier this week about the Silverlight 2.0 tutorials he had promised back in Nov 2007, he seems to be excited about it and said that he might start it in next couple of weeks. It got my hopes up that we  might see early release the Beta before Mix 08 (which was very unlikely).

Anyway, there were actually no major announcements from Microsoft just a preview of what we might expect at Mix '08 later in March. But Microsoft have announced NBC's plan to host video coverage for Beijing Olympics starting 08-08-2008, and NBC will be using Microsoft Silverlight for the video coverage.

This is not such a big news but by August, the user adoptability of Silverlight will be much higher and Microsoft will be pushing to release Silverlight 2.0 Final by then.

 

Thursday, December 27, 2007

Microsoft's New Year Resolution for Silverlight

This is my list of what what Microsoft's new years resolutions for Silverlight should be, they are however very unlikely but I think its about time Microsoft take initiative and this about this.

Silverlight 2.0 Alpha in January 2008: Now wouldn't that be cool? Developers/Designers could get their hands dirty with new features in Silverlight 2.0 (grid, controls) and start building meaningful applications that would have compatibility with Silverlight 2.0 plug-in.

Microsoft openly sharing Silverlight information: Am I really asking too much with this? I really don't understand why Microsoft have to be so secretive of their projects, weather it be Silverlight (compared to Adobe) or IE8 (compared to Mozilla). Why can't Microsoft be open and share information or be supportive of early adopters or developers?

Microsoft Expression Exchange: In reality this could only exist in my wish list, Microsoft has never been supportive of its developers, but that was thing of the past Microsoft are not dealing with developers alone anymore, after .NET 3.0 /WPF and Silverlight they are dealing with designers community, Okay, I agree there is not much you can share or exchange as a developer but a designer could share almost anything from simple assets to complex codes, they can share vector graphics for Expression Design, video skins for Expression Encoder, and XAML for Expression Blend. Since announcement of grids/controls in Silverlight applications the need for this kind of exchange program could only result in high productivity

Viewing XAML at Runtime: To me and many other like me this is one feature we would really love to see in the next version of Silverlight , it is easy to create dynamic content in Silverlight but its a real problem to check that XAML for any errors or tweaking. As far as implementation is concerned I don't think its really a problem for Microsoft to allow this but the problem is the shortcut to view XAML as there is no right click available in Silverlight due to compatibility issues with other platforms, and view source will show the HTML file holding XAML.

Microsoft accepting OpenGL and implementing it in Silverlight and the only reason they wouldn't is DirectX, they are simply not going to desert their most prized windows feature they are working on for years on end. I have only one suggestion just in case Microsoft is listening, being stubborn when you are developing next generation cross-platform applications would only restrict progress, there is a first time for everything and Silverlight could be the first time you adopt OpenGL because clearly other platforms are never going to adopt DirectX.

Rich Text Box / integrated HTML object: Probabily the only item in my wish list that is most important and something that can actually come true. This is  very important for RIA web page development, Please check my previous post on Rich Text Box makes rich RIA

Monday, December 17, 2007

Silverlight - as desktop application.

Silverlight, the Microsoft's weapon in RIA wars, it is the revolutionary technology determined to change the web trend. Microsoft coins the term "for the web" when referring to Silverlight applications,

"Deliver media experiences and rich interactive applications for the Web that incorporate video, animation, interactivity, and stunning user interfaces."

- Microsoft Silverlight

It is clear every since the announcement of Silverlight at MIX'07. Opening the key note at MIX07 Ray Ozzie Chief Software Architect at Microsoft emphases the need for creating web application that provide the power of desktop computing on the Internet, and Silverlight is clearly the best approach.

Microsoft already had the .NET infrastructure in place for ASP.NET applications and Windows Forms and the introduction of .NET 3.0/WinFX (WPF/WCF/WF)  was the final nail in bring the best of the Internet services to the desktop computing.

With Silverlight, Microsoft is clearly targeting the best of desktop experience with Internet services. Many developers have been asking about running Silverlight applications standalone, from a drive or folder,as platform independent desktop application. This however beats the idea of Silverlight,  Silverlight is developed to provide desktop applications on the web. But because of  its architecture, Silverlight can also be run from a local location, (in Silverlight 2.0 can also access any web services). Microsoft have market leadership in desktop platform about 85% - 90%, and its only fair on developers to expect cross platform compatibility for the tools they develop, but Microsoft ignored them - till now.

Microsoft have always had monopoly when it came to platform, they would go out of their way to make sure that Microsoft desktop application are platform dependent (i.e., Windows) but rapid expansion of web applications is making "the web" another platform which is totally independent, and Silverlight is the solution for this scenario and as Ray Ozzie said "Silverlight bring the best of desktop applications and the best of web services - together".  It is be true the other way around.

Microsoft is penetrating deep in Adobe's territory, and Adobe is trying to gets its share from Microsoft's territory with Adobe AIR, Adobe hopes that it would gain a share of the market from Microsoft, I am not being critical of Adobe, I genuinely think Adobe AIR is a brilliant idea, but Adobe had this brain wave at the very wrong time, if you happens to know history being in the right time and right place is very important, you won't disagree with me if you have a look at Java and its history.

Adobe AIR can't compete with WPF applications, but if cross-platform compatibility is concerned, watch out Silverlight 2.0 is coming and Mozilla got a trick up its sleeve to help Silverlight archive it.

Mozilla the makers of FireFox, who already have cross platform browsers, came up with an idea, split web applications out if their browser and run them as desktop. They call it Prism, its a very simple idea provide a software that ideally is a web browser (FireFox), modify registry to save shortcuts on desktop/start menu/quick launch to launch the Prism instance and point to one web page/local html file.

"Unlike Adobe AIR and Microsoft Silverlight, we’re not building a proprietary platform to replace the web. We think the web is a powerful and open platform for this sort of innovation, so our goal is to identify and facilitate the development of enhancements that bring the advantages of desktop apps to the web platform."

Whatever be their intentions for creating Prism, to me it is nail in Adobe's coffin, and Microsoft is going to cash on it big time,  this provides development of one application in Silverlight host it on the web or tweak the same application to install and  run as a desktop application.

This people, is history in the making and I am glad to witness it and be part of it.

Sunday, December 16, 2007

XAML World Map

A friend of mine send me this world map in Adobe Illustrator format and I converted it to XAML using Microsoft Design and I have giving few finishing touches in Blend, the paths are there but I wanted to convert the paths into canvas and give country names so there is a little work to be done, but instead of just publishing the XAML I decided to make a sample application on Silverlight 1.1 alpha.

I'll post the source code of the world map application typically showing you how to use the world map, along with the XAML. There is some work to be done and I'll try to finish it as soon as possible.

So please stay tuned but here is a sneak preview of the world map for you. Hope you enjoy.

Saturday, December 15, 2007

CSS in Silverlight? Oh Yeah! Even Better? Hell Yeah!

CSS existence is quite ancient but the true potential of CSS was realised only for parsing XML elements. Ok we already know that and also that XAML is XML based or atleast the inspiration/syntax is, does it mean we can expect CSS type styling in XAML, if it can be used in XAML does it mean we can use it in Silverlight 2.0 applications?

Too many questions but a simple answer, CSS is thing of the past  with many issues like incompatible browsers, hard to retrofit, hard to learn, time consuming, pain staking need I say more? Next generation technology requires next generation style sheet format,  so please welcome XAML Resources.

XAML What?

You heard - XAML resources, providing style sheets in XAML format as simple as that. Wait a minute, does it mean we can design our own custom buttons or controls from a graphic designer in one XAML and use is across the applications?

Yes, how about an example?

<Page.Resources>
<SolidColorBrush x:Key="MyBrush" Color="Gold"/>
<Style TargetType="Border" x:Key="PageBackground">
<Setter Property="Background" Value="Blue"/>
</Style>

...

</Page.Resources>
<StackPanel>
<Border Style="{StaticResource PageBackground}">

...
</Border>

</StackPanel>


Is that it? What? How? When?



Yes that is it, want to learn How? Already in use in WPF applications. Silverlight 2.0 Beta supports it? Not sure ask Microsoft. Can we expect it? Yes we can, I give 4.7/5 for expectancy. 



Please leave your comments.






Friday, December 14, 2007

Issues - Silverlight 2.0 Backward compatibility with Silverlight 1.1 Applications.

I wonder how many times Microsoft is going to disappoint the developers community or early adopters of Silverlight.

When Microsoft first announced the technology I had mixed feelings about Silverlight, and I went on to even say "Silverlight, Why should I bother?" my problem was with Silverlight 1.1 Alpha, this is what I had to say then.

"The point is, yes, ideally Silverlight is a great concept, and it would revolutionise the way web looks, feels and works and it can even compete with Adobe Flash and put Adobe out of business even if you compromise Microsoft's poor graphic designers .If and only if Microsoft can actually finish what they started...

Don't take me wrong, I am totally happy with the work folks at Microsoft are doing and the concept of Silverlight, I just don't see the point of launching alpha version of a software that have a very long way to go and every one know what is missing. In days to come you will see Silverlight applications here and there, mostly in video streaming and few other games but the total power of Silverlight can only come to surface when Silverlight can support import of vector graphics from other formats, full security features (especially SSL), user controls (the basic controls will do), and finally database objects. "

And after seven months, nothing has changed, so I was right, they wanted MIX'07 to be a success and it pushed them to announce Silverlight 1.1. And they left early adopters waiting in anticipation for months on end then came the announcement by ScoutGu about renaming Silverlight 1.1 to Silverlight 2.0 and Beta version in MIX'08, now don't get me wrong but that is almost a year. Microsoft is never supportive of the developers, they tend to keep big secrets many suspected (including myself) that Silverlight 1.1 might take a long time to develop, but I could never have imagined that you will go to MIX'08 to announce Beta. I think Microsoft should atleast release Silverlight 2.0 Alpha by Christmas, they own these early adaptors something. I was hoping they might release Silverlight 2.0 Alpha December Preview, but it shattered with Mono's Moonlight announcement, the latest Moonlight release (1.2.6) supports Silverlight 1.1 applications, if we were getting December preview of Silverlight 2.0 then Moonlight won't have went to the trouble of release a version to support Silverlight 1.1. So that is it, we can't get to see Silverlight 2.0 till after MIX'08.

If you thought that was enough, the worst was yet to come, Silverlight 2.0's backward compatibility with Silverlight 1.1 applications was nagging me ever since Silverlight 2.0 announcement, when Tim Sneath posted Why Can't I "Go Live" with Silverlight 1.1 Alpha? on his blog and mentioned,

Silverlight 1.1 (now known as 2.0) is not ready for "Go Live" usage at this stage, and the EULA explicitly prohibits deployment in production sites.

I took the opportunity to ask him about Silverlight 2.0 backward compatibility with Silverlight 1.1  I wasn't really expecting Tim to answer as they are always secretive about future releases, but when Tim replied, the answer wasn't to my liking,

Imran, there are substantial breaking changes between the 1.1 alpha and what will become the final 2.0 release - we don't claim to be backward compatible with 1.1 alpha. However, 2.0 _is_ fully backward-compatible with 1.0 applications.

Now that is devastating, not for Microsoft but for the early adopters of the technology, Microsoft still benefited by the buzz and hype surrounding the Flash Vs Silverlight argument which only early adopters made possible, now if Silverlight 2.0 is going to be so different to Silverlight 1.1 to the extend that they can't even be compatible, then the question is what have the early adaptors of Silverlight 1.1 Alpha archived since Silverlight 1.1 was announced?

It was not about poor implementation or planning for Silverlight on Microsoft's part, every one knew what was missing, everyone know what was required, but still Microsoft went on to announce Silverlight 1.1 in MIX'07 just to create the hype in the developer community and provide the exclusive marketing with the developers.

If it was not for the early adopters of Silverlight 1.1, Silverlight 1.0 community won't have been where it is now and now we .NET developers have to start again in March after MIX'08.

I hope history doesn't repeat itself.

Thursday, December 13, 2007

Moonlight is lit.

Novell and Microsoft have been working on Moonlight project  with interoperability collaboration between Novell and Microsoft and today Mono team announced the final release of Moonlight 1.2.6.

This release will let browsers on Linux platform, FireFox, Opera etc.,  to run Silverlight applications. Moonlight will also include SDK to develop Silverlight 1.1 applications  in GTK#/native Quartz backend.

Moonlight 1.2.6 is available for download

Forward/Rewind in Silverlight

Silverlight provides a great platform to for Video playback but Expression Media Encoder does not provide any Forward/Rewind options in Silverlight and many developers were asking about it. I thought how hard it could be so I decided to do this, I wanted to do this in VB.NET for about a month now but just kept delaying it, but when I started I finished it in about 15 minutes and I was surprised how easy it is (Now I know why Microsoft didn't bother to invest in it). I think that 15 minutes is a accomplishment so I decided not to change the  XAML or the Code. Well I had to do something to make you understand the code so spend another 10 to write comments.

Here is the XAML (Just to give you an idea, you can design your own.)

<Canvas x:Name="parentCanvas"
xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="Page_Loaded"
x:Class="VideoRewindForward.Page;assembly=ClientBin/VideoRewindForward.dll"
Width="320"
Height="205"
Background="White">
<Canvas.Resources>
<Storyboard x:Name="dummyStoryboard" Duration="0:0:0.5"/>
<Storyboard x:Name="HideMessageCanvas">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetName="MessageCanvas"
Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00.7000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Canvas.Resources>

<MediaElement x:Name="VideoPlayer" Souce="..." .... />
<Canvas x:Name="RewindButton" ... />
<Canvas x:Name="ForwadButton"..../>
<Canvas x:Name="PlayButton".../>
<Canvas x:Name="MessageCanvas" Opacity="0.5" Width="50" Height="18">
<Rectangle Width="50" Height="19" Fill="#FFEAEAEA"/>
<TextBlock x:Name="RewindForwardSpeed" Width="53" Height="18" TextWrapping="Wrap" Foreground="#FF000000"/>
</Canvas>
</Canvas>


And now the VB.NET Code.



Partial Public Class Page
Inherits Canvas

Private videoSpeed As Integer = 1 'Play

Public Sub Page_Loaded(ByVal o As Object, ByVal e As EventArgs)
' Required to initialize variables
InitializeComponent()
MessageCanvas.Opacity = 0
End Sub
''' <summary>
''' Play the Video
''' </summary>
''' <param name="o"></param>
''' <param name="e"></param>
''' <remarks>Calls PlayVideoAtSpeed with Speed Normal (1)</remarks>
Public Sub PlayButtonPressed(ByVal o As Object, ByVal e As EventArgs) _
Handles PlayButton.MouseLeftButtonUp
videoSpeed = 1
playVideoAtSpeed(1)
End Sub

''' <summary>
''' Handles the Event when RewindButton is pressed
''' </summary>
''' <param name="o"></param>
''' <param name="e"></param>
''' <remarks>Calls PlayThisVideo with Direction Rewind (-1)</remarks>
Private Sub RewindButtonPressed(ByVal o As Object, ByVal e As EventArgs) _
Handles RewindButton.MouseLeftButtonUp
If VideoPlayer.DownloadProgress = 1 Then
PlayThisVideo(-1)
End If
End Sub

''' <summary>
''' Handles the Event when ForwardButton is pressed
''' </summary>
''' <param name="o"></param>
''' <param name="e"></param>
''' <remarks>Calls PlayThisVideo with Direction Forward (+1)</remarks>
Private Sub ForwardButtonPressed(ByVal o As Object, ByVal e As EventArgs) _
Handles ForwadButton.MouseLeftButtonUp
If VideoPlayer.DownloadProgress = 1 Then
PlayThisVideo(1)
End If
End Sub

''' <summary>
''' Changes the direction of Forward/Rewind, Calculates new speed Check if the
''' forward/Rewind Position is Valid
''' </summary>
''' <param name="direction">-1 for Rewind, 1 for Forward</param>
''' <remarks></remarks>
Private Sub PlayThisVideo(ByVal direction As Integer)
'Change the direction, Forward/Rewind
If Math.Sign(videoSpeed) <> direction Then
videoSpeed = direction
End If
'Calculates the speed
If videoSpeed < 32 And videoSpeed > -32 Then
videoSpeed *= 2
Else
videoSpeed = 1
End If
'Calculate actual length of the video and current position.
Dim videoLength As Double = VideoPlayer.NaturalDuration.TimeSpan.TotalSeconds
Dim VideoCurrentPosition As Double = VideoPlayer.Position.TotalSeconds
'Show the speed on the canvas
ShowVideoSpeed()
'Check if the current position is not at the end(can't forward) or at the Start (can't rewind)
If VideoCurrentPosition >= 0 And VideoCurrentPosition < videoLength Then
'Play the video at speed.
playVideoAtSpeed(videoSpeed)
End If
End Sub

''' <summary>
''' This function Plays or rewinds or forwards the video, the reason this is a
''' different module and not intregrated in PlayThisVideo(direction) is that,
''' this module is also consumed when Play Button is pressed
''' </summary>
''' <param name="speed">The speed at which to play the video</param>
''' <remarks>When video is played at higher speed than 1 then the funtion pauses the video and begins
''' a dummy animation, which will iterate the forward progress until Play button is pressed.</remarks>
Private Sub playVideoAtSpeed(ByVal speed As Integer)
If speed = 1 Then
videoSpeed = speed
ShowVideoSpeed()
Else
VideoPlayer.Position = TimeSpan.FromSeconds( _
VideoPlayer.Position.TotalSeconds + speed)
VideoPlayer.Pause()
MessageCanvas.Opacity = 0.5
dummyStoryboard.Begin()
End If
End Sub

''' <summary>
''' This Module is use to iterate the froward/Rewind function.
''' </summary>
''' <param name="o"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub dummyTimeline(ByVal o As Object, ByVal e As EventArgs) Handles dummyStoryboard.Completed
playVideoAtSpeed(videoSpeed)
End Sub

''' <summary>
''' ShowVideoSpeed Modules checks and shows the Rewind/Forward Speed,
''' this Module is only to show.
''' </summary>
''' <remarks>When the mode is Play, it will start the animation to hide the bar.
''' The text in this module can be replaced with </remarks>
Private Sub ShowVideoSpeed()
Dim returnString As String = ""
If videoSpeed = 1 OrElse videoSpeed = -1 Then
returnString = "Play"
VideoPlayer.Play()
HideMessageCanvas.Begin()
Else
If videoSpeed < 0 Then
returnString &= "<<" 'Can be changed with XAML or image
Else
returnString &= ">>" 'Can be changed with XAML or image
End If
returnString &= (videoSpeed * Math.Sign(videoSpeed)).ToString
End If
MessageCanvas.Opacity = 0.5
RewindForwardSpeed.Text = returnString
End Sub
End Class



Hope you enjoy. Please leave your comments.







Tuesday, December 11, 2007

Silverlight Deployment - Easy or Fussy?

Structure of Silverlight allows designers and developers to work in different environments and synchronise their work simultaneously, but the same features come back to hound the deployment process.

Deployment of Silverlight applications could have been made easy, Silverlight uses .NET Framework 3.5 for development and System.IO.Packaging Namespace already available in .NET 3.0 could have been used to help deploy Silverlight applications. 

Microsoft uses this same package architecture in XPS document specification, if Silverlight uses the same method not just the deployment will be easy but also the downloading of the Silverlight application inside a browser will be easy using Downloader Object. The application will download faster, firstly because of the compression, and because there will only be a single file to download reducing multiple server requests.  And you can have centralised control of Silverlight objects.

I am really struggling to find the reasons why Silverlight shouldn't implement this option for Silverlight.

I would rate this feature 3.5/5

Saturday, December 8, 2007

Expression Blend 2.0 December Preview disappointment

Today Microsoft released the December Preview for Expression Blend the basic tool for designing Silverlight XAML.

This came after Scott Guthrie's announcement that Silverlight 2.0 and that he will be starting a new Silverlight 2.0 features tutorial series in his blogs.

I was eagerly anticipating the release for December Preview, hoping that we might get a sneak preview of the Silverlight 2.0 features. Instead, I am very disappointed with the preview version. After reviewing the preview version the only feature updated from September Preview is personalising the Blend 2.0 with the features to Silverlight.

Blend 2.0 September Preview has many issues with Silverlight as you can expect from a preview version of undeveloped technology, basic issues like image brush was not included in September preview but could have coded in Visual Studio, December preview didn't even touch these basic issues.

I am disappointed with this release, but with Scott Guthrie's announcement about Silverlight 2.0. We might see another Preview version either January/February.

Wednesday, December 5, 2007

Is Silverlight truly WPF/E (WPF Everywhere)?

Silverlight 2.0 scheduled to be released after Q1 of 2008 has raised the bar for the functionality and to resemble closely to WPF (Windows Presentation Foundation) during its early days it was code named WPF/E for WPF Everywhere but now that a stable version is announced its worth looking does it resemble WPF and possible ubiquity of Silverlight plug-in.

Silverlight Adoption

We already know that Silverlight 2.0 will support Internet Explorer, Safari, FireFox, Opera, Konqueror, SeaMonkey on Windows, Mac and Linux (Moonlight Project),  these three OS constitutes of 99.8% of the total market share for OS accessing Internet applications (Source: Market Share). 

As this date Silverlight doesn't support all web browsers and we don't know anything about Mobile browsers/OS. Statistics show that these non supporting browsers constitutes  of about 1% of the browser market share (source: Market Share). This figure is impressive for possible deployment or adoption of Silverlight applications. But many might argue about these figure, especially who what to implement advertisements using Silverlight. If same figure is put in perspective with the number of web browsers with JavaScript disabled 6% (Source: W3Schools), in this context the possible ubiquity of Silverlight compared to AJAX (required JavaScript) is very wide.

Having said that Silverlight possible ubiquity is about 99%, it is interesting to note that this figure doesn't constitute Mobile browsers/OS. Microsoft showed interest in Mobile market but they haven't made any of their plans for Mobile browsers public. I'll write a follow up blog when Microsoft announce their intentions.

But how good if 99% possible ubiquity? Flash who have ruled this RIA area for more than a decade have Flash ubiquity of 99.1% (Source Adobe), including Flash, and Flash Lite for mobile.

Silverlight, Flash and JavaFX could well wipe the horrible HTML based web pages for good and replace with rich, interactive applications, now that Flash doesn't have a monopoly in RIA development, we could well see a change rich web sites in near future. Flash is already well established share in mobile market, and JavaFX seems to be focusing more in mobile market, its a shame Microsoft hasn't announced anything for Mobile market as yet.

In next part "Is Silverlight truly WPF/E" we will look at how large subset of WPF can we expect in Silverlight 2.0

del.icio.us Tags: ,,,

Monday, December 3, 2007

Silverlight 2.0 What can we expect?

Ok its official Silverlight 1.1 will be Silverlight 2.0, we also know Silverlight 2.0 will have user controls, and WPF UI Framework, WPF Layout management controls and network protocols REST, POX, RSS.

But there is more to it than meets the eye, In the coming weeks I would be assessing with designer/developer point of view what can we expect. I will try to asses some major/minor properties or behaviour that we might expect from Silverlight 2.0.

I will asses one method at a time and would consider the limitations and/or of most basic properties that we should get from Silverlight 2.0

del.icio.us Tags: ,

Saturday, December 1, 2007

Whats in the name anyways?

On Nov. 29 ScuttGu announced Silverlight 1.1 will be changed as Silverlight 2.0.

This came after months of working on Silverlight for .NET and CLR Platform.

I am starting this blog to for the Silverlight Community to blog their ideas about Silverlight 2.0 here, If you are intreasted please contact me and I'll make you an author, so you can start posting Silverlight 2.0 blogs here.