Feeds:
Posts
Comments

I am happy to announce that my SilverlightShow ECO Contest entry received the highest average community rate to my surprise and I am going to MIX10!  I wanted to add the MIX10 badge to my blog, once my event registration was complete, as I was still in some sort of astonishment.

There are very interesting contest entries; you definitely need to check out the app gallery. Congrats to the 1st prize winner Daniel James for his Carbon Counter app and the 2nd prize winner Levente Mihály for his EcoLight! app!

Now that there is only a week left to MIX10, I am very excited about the keynote, the sessions and all unexpected announcements. There will surely be surprises!

I have to thank SilverlightShow and Telerik for their awesome prizes and instant answers for all my questions. A special thanks to the International Year of BioDiversity (IYBD) Logo Review Board, whom I contacted to use their logo in my application. But most of all, a big THANK YOU to everyone who voted for me!

See you at MIX10!

The United Nations declared 2010 to be the International Year of Biodiversity. There will be worldwide celebrations throughout 2010 to increase the understanding of the importance of biodiversity in sustaining life on Earth. I have worked on an application, that is a little Silverlight guide to celebrate the International Year of Biodiversity and submitted it to the SilverlightShow Eco contest today!

The application includes various animations, accompanying music files and information about biodiversity and the actions you can take to protect the Earth’s diverse eco-systems. A WriteableBitmap was my best friend, when I tried to dissolve the Earth in space to show that “there is no other place to go“! A Silverlight Bing Map control proved to be very easy to integrate and customize, when I wanted to display the worldwide biodiversity events in 2010. There is also a counter like the one on the Countdown2010 site, which shows how many days are left to the end of 2010 to work towards the 2010 Biodiversity target.

Here is the link to my entry; please vote for my little biodiversity guide! Watch it in the “full screen option” to see the layout in its original size.

I hope you enjoy the application and get a few informational hints about biodiversity and what individual tasks we can undertake to value and safeguard it.

Let’s end this eco-geeky entry with an irrelevant message:

Happy Valentine’s day! ♥

Until now Kodu could only run on XBox; but now there’s a technical preview of Kodu for the PC. You can use your mouse and keyboard for interaction and don’t need a game controller any more. The technical preview also comes with a game export feature, so that you can save your games as documents. You can download your PC Kodu copy here: http://fuse.microsoft.com/kodu/

If you haven’t been able to try out Kodu yet; it is a visual programming language made specifically for creating games. It is accessible for children and a great medium to jump into programming through creating games.

There are a few websites, where you can get more info on Kodu, such as the official Kodu blog, Planet Kodu and KoduX forums.

I have also created a quick entry about the new download on the Digigirlz Spaces page to inform previous/future Digigirlz attendees.

Have fun with Kodu!

Resolution App Resolved

Just as promised, I am going to share some code details and all references for my Silverlight 2010 Resolutions App.


Text Placement/Movement/Database Operations:

My initial goal was to create an interface with dynamic/random text placement. Text should also move in the z-index to simulate some kind of 3D space. Last year I had seen a company web site, which displayed its portfolio with a similar design; looking pretty interesting and fun to me.

The random text placement and movement algorithm I used in my app is based on Terence Tsang’s – aka ShineDraw3D Text Space program. Shinedraw’s web site is a true source of inspiration; you can find various Flash vs Silverlight samples to try out and compare both technologies’ capabilities.

The resolutions submitted by a user are stored in a database; that’s how I track the count of each resolution. All database operations are executed through web service calls: retrieval of resolution records, update of resolution counts etc. It would have been a nice feature to enable new entries by users, but due to time limitations that feature was left out.

Once the resolutions are retrieved from the database at startup; the first thing I do is to place resolution text blocks randomly on the page. Then I set the MaxFrame rate and include a CompositionTarget.Rendering event handler.

Application.Current.Host.Settings.MaxFrameRate = 24;
CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);


After a user has submitted his resolution selection list or based on 2 minute intervals, rendering is stopped and the webservice retrieves the updated resolutions from the database. The entire process, random placement, event handler activation etc., is executed once again. Even though I don’t need the DispatcherTimer for the frame rendering event, since we use CompositionTarget.Rendering, I use the DispatcherTimer to decided when to refresh the screen based on a specific time interval.


Browser Window – Placement and Resizing:

My app is using a canvas (LayoutRoot) as its main Layout Container. To enable the canvas to fill the entire browser window, I made sure that it wasn’t assigned any height and width in the MainPage.xaml. Once the Main Page Loaded event handler is in action, I use the browser width and height to assign them to my canvas.

this.Width = App.Current.Host.Content.ActualWidth;
this.Height = App.Current.Host.Content.ActualHeight;


I also wanted to put the app info button ( displayed as a “?”) and blog link in the left and right page corners respectively. Therefore I had to assign their Canvas.Left and Canvas.Top dependency properties after the LayoutRoot canvas was assigned its width and height. Just as an example, here’s what I did:

LogoCanvas.SetValue(Canvas.LeftProperty, this.Width - 60);
LogoCanvas.SetValue(Canvas.TopProperty, this.Height - 60);


This seems to work out pretty well, until the browser window is resized. So I also added an event handler for browser window size changes. The MainPage configuration method resets the LayoutRoot canvas width/height and the dependency properties as I mentioned earlier. The following is a simplified version of the actual code:

...
App.Current.Host.Content.Resized += new EventHandler(Content_Resized);
...
void Content_Resized(object sender, EventArgs e)
{

MainPage_Configuration();
}


User Interaction:

Users can interact with the app through the clouds (sounds funny I agree), which are custom created buttons. One button displays the first 10 resolutions with the highest count values, the other button gives the user the option to select/submit resolutions. The Top10 and Resolution selection pages are ChildWindows. If a user clicks on any resolution on the main page, text movement direction does also change.

Additional info is provided on the main page and on the selection page through a “?” sign placed in the left corner of the pages. When a user clicks on the “?”, an animation displays a stackpanel with some text details; another mouse click hides the stackpanel.


Style:

The cloud images and notebook background have all been created with Photoshop brushes. The buttons were created in Expression Blend.

Resolutions displayed on the notebook make use of a font named Marka to give the feel of handwriting. Isn’t this how we take notes; scribbling it on some piece of paper, which we then find whenever we are looking for something else?  The main font used is Century Gothic; clean and simple.

The Splashscreen text/colors/gradients were all designed in Expression Blend.



If you didn’t have a chance to the test the app; just check it out and join the action!

2010 Resolutions

As the end of the year approaches, numerous lists of new year’s resolutions are everywhere. So I had the brilliant idea to come up with a resolution popularity tracker. Click the image to check the app out!

 

The main screen lists the most popular 50 choices; you have the option to make your own selections and increase the resolution counts. Please join the action!

I’ll write a blog entry about the app’s development very soon and provide all links/references; but I had to share it today – before 2010 has arrived!

HAPPY new year! This year – dare to dream big.

 

In case you didn’t have time to prep for the Holidays, here’s a little Silverlight app to lift your spirits.

The app gives you a chance to do some tree decorating in the last-minute. You can click on the image to test it out. I hope you enjoy it!

HOW TO decorate the tree?

Clicking on an ornament will create a copy of the ornament, which can be moved over to the tree. If the moving ornament is dropped onto the tree, it will be placed on the tree. If dropped anywhere else than the tree, the moving ornament will disappear.

Ornaments on the tree have drag/drop functionality. So there’s some redecoration options for you. If an ornament on a tree is dropped out of the tree, it will be removed from your selected decorations.

Basic Info about the Silverlight app:

Most ornaments, the red/blue background images and the christmas tree itself,  have all been created with free Photoshop brushes and then have been imported to Expression Blend. Since they were not ready to use vector images, I had to color all their details individually, which is a fun but rather time-consuming task.

The drag and drop functionality of the moving ornament is based on the MouseDragElementBehavior. It has been used for dynamically created images, so the behavior has also been created programmatically. But the C# coding is as straightforward as adding it in Expression Blend right out of the box.

The tree’s click boundaries have been defined through creating a path and using a WriteableBitmap, for collision detection. This was an easy and interesting task! You can find cool examples and detailed information on Andy Beaulieu’s web site.

HAPPY HOLIDAYS!

Quick 2010 Update: You can get my source code from SkyDrive!

The Inland Empire .NET User’s Group is starting a free class on Microsoft’s ASP.NET MVC Framework this Saturday, December 5. I’m going to be one of the co-instructors; hoping that my Java MVC pattern experience will provide additional insight.

No specific book is required, however, Pro ASP.NET MVC by Steven Sanderson is highly recommended. The class is a beginner’s class scheduled for 10 weeks and will be held at the Colton campus of DeVry University. While this is an introductory class, basic knowledge of HTML and Basic SQL will be helpful.

You can find detailed information and the signup page here: http://iedotnetug.cloudapp.net/.

IEDOTNETUG membership is not required, but space is limited to 25; so hurry up with your registration if you’re interested in our class!

 

Yesterday at PDC09 Scott Guthrie announced that Silverlight 4 Beta is available for download; which is pretty exciting news! Silverlight 3 just shipped in July; so the Silverlight team must have been crazy busy at work to come up with new features in such a short time.

 

There have been numerous blog posts since yesterday about Silverlight 4 and I decided to just post info about a few interesting pointers; instead of rewriting the same story. Here are my pointers:

Silverlight 4 Beta Release Whitepaper

Silverlight 4 Training Course on Channel9

What’s new in Silverlight 4 Beta on Channel9

Silverlight 4 Beta videos on Silverlight.Net

Silverlight Cream #735 - with links to all the cool articles/blogs about SL4 Beta

 

I am especially happy about the Microphone support coming with Silverlight 4!  I was working on an app, which required client voice recording and I had postponed that feature for a while, since I didn’t wanted to do it in Flash. There is already a video on Silverlight.Net about Microphone and Webcam support by Tim Heuer. No more excuses not to finish my app!

You can also find many tweets about blog articles tagged with #SL4; there have been zillions of tweets as of yesterday. In the meantime, I discovered a website called sl4.org; SL4 meaning “Shock Level Four” … Well, I guess, having a SL4 Beta release in such a short time could be considered as some sort of shock.

The Grid container is sometimes compared to the HTML Table; but  I’d rather consider the Grid as a matrix and with this in mind, I decided to add some matrix magic to it. You can check out the demo by clicking on the image. The action starts, once you move over the “?“.

 

squarejungle

 

My initial plan was to create dynamic squares in each grid cell by moving along the edges of the grid until I would reach the center. The movement’s direction is clockwise and each directional movement is as follows:

RIGHT: Move through columns until you have reached the right edge; increment columns, row=top-edge

DOWN: Move through rows until you have reached the bottom edge; increment rows, column=right-edge

LEFT: Move through columns until you have reached the left edge; decrement columns; row=bottom-edge

UP: Move through rows until you have reached the top edge; decrement rows; column = right-edge

 

So basically without any optimiziations and no recursion, this is a pretty straightforward algorithm. There are 4 for-loops that race through the matrix in 4 different directions. The boundaries narrow once a round has been completed. But no wonder,  when I ran the application, the operation was too fast to actually see anything else than a solid color grid. So as to delay the event, I had to add some kind of timer to delay the event. For the UI thread I figured out I needed to use the Dispatcher class and DispatcherTimer to fire the dynamic creation/placement of the rectangles. This is the timer definition:

DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 0, 0, 1);

timer.Tick += new EventHandler(timer_Tick);
timer.Start();

 

Since the timer is processed at a specified interval of time, the actual flow of the app had to change too. Therefore I based each movement and iteration on a conditional statement, which the timer’s event handler (timer_Tick) would evaluate.

 

Once the timer started working, I modified the code to add a reverse the movement from the center to the edges and vice-versa. This made my app run as long as the browser window is open. In case of any form of web-dizzyness, I also included a stylized toggle button to stop/start the action! The little controller button is inspired by a sample rotating button I had seen in the “Adding a Rotating Button to the Swivel Behavior Demo” article by John Papa.

 

When all inward/outward movements seemed to cooperate, it was time to add a stylish touch to the dynamic squares. With a modern fashion sense of less is more, the squares only have rounded corners and are assigned random colors. You can pick random colors with the following method that I used (random is an instance of the Random class):

private Color pickRandomColor(){

byte redChannel = Byte.Parse(random.Next(256).ToString());
byte greenChannel = Byte.Parse(random.Next(256).ToString());
byte blueChannel = Byte.Parse(random.Next(256).ToString());
byte transparent = Byte.Parse(“255″);
Color randomColor = Color.FromArgb(transparent,redChannel,greenChannel,blueChannel);
return randomColor;
}

 

For the reverse and forward movement I didn’t recreate the squares; they just get a new random color. That’s why the movements also seem to speed up after the first round. Each rectangle has a unique name, based on the grid cell they are placed at, which makes it very easy to locate each square when needed. Another fine detail to mention is probably the HandVetica font, I used in each TextBlock.

 

The final addition to the app was to flip squares randomly based on a second timer; which starts when all squares have been created. The flip action uses a Storyboard and adds a PlaneProjection to the selected square. It flips the square 180 degrees on its RotationYProperty and back, so that each square is neatly back at its original place when the animation is completed.  The  “PlaneProjection and Perspective 3D” article on SwitchOnTheCode was very helpful when I lost perspective trying to rotate/reverse/flip the squares!

 

So after all, what’s the functionality of  a Jungle of Squares, you might ask? Well;  what is the Matrix – any way?

I had my daily dose of brainy exercise and a few extra colors to light up my day. Hope you have a colorful time with the demo too!

 

I wanted to test the Adobe Photoshop (PSD) File import feature in Expression Blend3 for a while now and it  just worked flawlessly.  So I decided to take my plan one step further and create a sample Splash screen with my illustration files. You can find the final result by clicking on the image:

 

blinkingbelle

 

In order to observe the loading experience and get a chance to test a simple animation, I included two sample video files in the project. Therefore the initial loading is incredibly slow. The animation has no complicated tricks; it only manipulates the opacity property and runs forever in autoreverse mode. Actually it runs until you are hypnotized by all the blinking!

 

As for the progress bar, I basically used the same idea explained in the “Splash Screen in Silverlight 3“  article by  Diptimaya Patra. I track the download progress with a “onSourceDownloadProgressChanged” Javascript function and increase the size of the colored content based on the progress percentage.

 

A few tips+tricks

Splash Screen – Design

Your Splashscreen Xaml will be placed in your Web project folder, which will make it  available for display while your Silverlight app is downloading (loading). But once you try to open that file in Blend to do some fixes, you will discover that you don’t have the option to display it in design mode. In fact, while playing around with the animation, I copied my Splash screen Xaml file back and forth between the Web and Silverlight project folders. Not very practial, yet it works.

File Paths

The blinking belle is made up of several illustrations. When I placed the splash screen Xaml in my Web project folder, I had to reset the images’ source info and point the file path to the Web project folder.

Browser Cache

Despite enlarging the project file to test the splash screen,  it is sometimes necessary to clear the browser cache. In fact, once the content is cached by the browser, the slow loading experience might completely disappear.

Event Triggers

When you create an animation Storyboard through the Objects and Timeline panel in Expression Blend 3, the Storyboard will be placed as a resource in your Container (Grid/Canvas etc.). Since there is no option to start the Storyboard explicitly (except with Javascript), the Storyboard has to be attached to an object  with an event trigger. In this particular example, once the Grid is loaded the event trigger starts the animation:

<Grid.Triggers>
<EventTrigger RoutedEvent="Grid.Loaded">
    <BeginStoryboard>
      <Storyboard x:Name="Storyboard1" RepeatBehavior="Forever" AutoReverse="True">
        ........
        ........
        {ANIMATION Definitions}
        .......
        ........
      </Storyboard>
    </BeginStoryboard>
</EventTrigger>
</Grid.Triggers>

For further information on Silverlight Splash Screen scenarios and displaying animations, check out the Splash screen articles in the MSDN library.

Older Posts »