Trying to confuse us?

Posted on

You get through the first 5 chapters, no problem.  Very basic stuff and then you get to hop into chapter 6 of the book and you are writing c#, creating custom buttons that actually do stuff, and having interactive media players.

I can recall  – maybe a year and a half ago? – a time when I spent hours searching for a media player which I can use for a few videos to play on a website.  Now I’m here, creating a media playing application – not quite web based, but still.  If you’re one who is able to get through design or basic coding tutorials, no problem – then I don’t see why you wouldn’t be able to get through this. 

Up through this point, I’ve created and wired up the buttons, “Play” “Stop” and “Pause” with the pause button having a boolean toggle applied to allow it to resume play if you click on the pause – while its paused.  Now we’re wiring up the “next” button. 

Though this is seriously tiny – in every other portion of the book, Victor has been fairly consistant, even to the point of having all but the first screenshot of “where are we saving this?” in a c:/Projects/WPFBookProjects/revised folder *cough*  – but he is now changing things on us!

We’ve been setting up this media player for the entire chapter, and compared to the other chapters gone through so far, this is the longest.  Up until now, he’s been using a video named, “tlc.wmv”.  Now all of a sudden, he’s too cool and needs to up the anny on it and use the infamous baby using an iPhone video.  Maybe its his own, and he’s naming it similar to the one on the web, maybe not – but come on!  What’d tlc.wmv do to warrant being replaced?!

Ok – I’m being a bit dramatic – I am, however, having a bit of fun with the creation of this application.  Once I’m done w/ this app, I’ll be sure to camtasia it like I did the basic keyframe animation from the end of chapter 3.

Discovery of the source for my video issues

Posted on

So I officially got stuck.

My XAML code was good and the tiny amount of c# was correct.  I tried a different video, tried a different format (wmv and then avi), I recreated the project, and hit a dead-end.  It would load the application, but there was no video to speak of and no runtime issues either.

So I took Victor up on his offer – I emailed him asking for assistance.  His response?  Call me – here’s the number.

If it weren’t for the fact that I have done the same when someone was going through a tutorial or guide that I’d created, I probably would have been stunned – possibly to the point of not calling, who knows.  But I’m used to telling others to do the very same, so I did just that – I called him.

So we went through the project together, but instead of coding the xaml by hand, we let Blend do it, and instead of setting it to manual, just to make sure that it would work at its default settings, to play on load, we tested it – to find the same result.  The program rendered – however – the video wasn’t present.

However, he was doing the project himself and his worked fine.  So I started to question my setup.  I’m actually doing all of this on a MacBook Pro – that’s right, a mac.  I run Parallels and up until now, I’ve had no issues with this setup.  Its been a pretty sweet setup, actually.

So I took my project, popped it onto my new shiny 8gig pen-pop sony thumb drive, and brought it to my PC which has Blend 2.5 on it.  Loaded up the project and… it ran perfectly.  Video was in tact.

So we did it again, this time starting it in Visual Studios, porting over to Blend and let the interface to the work for me – brought in the video, F5 and… nope.  No video.

Victor’s verdict as to “why”?  Perhaps its a discovered limitation of WPF – as of yet located until now.  For something as new as WPF – its quite likely that there are more.  When discovered, they get fixed fairly quickly, but at the moment, using virtualization, Windows likely does not have access to the GPU when virtualizing windows XP.

I wonder if the issue is present in Vista?

Creation of Media Element – Application runs, Video does not

Posted on

I’ll take a few other routes first before I start getting frustrated, but at the moment, I’m going through the first lab which is in Chapter 6 which has you working more closely in XAML and codebehind than the book has done up until this point, and its pretty darn simple, but I’m wondering if there’s something that I should be doing that I am not – perhaps its because my version of blend is 2.5 not 2.0.

In any event, I’m going through the steps, he has you hand-code the xaml to have the MediaElement, give it a name, set the LoadedBehavior to Manual, bring in a video source and modify its properties, then set in the codebehind for your element to play … and then F5 to debug.

Mine has no errors reported, but all I’m getting is the gradient which I set my Window background to.

:/

The MediaElement – Quick comment

Posted on

The very beginning of chapter 6 in Victor Gaudioso’s book on Blend 2 discusses the MediaElement and goes into details regarding Independent mode.  Towards the end of this, he explains why one might decide to have the URI called in C# instead of XAML, using what essentially is an example of a typical media player – such as Winamp or Windows Media Player, where the application is programmed to look for the information after the user has given it input.  In his example, it was by dragging a video from the user’s My Documents, into the player, and the player interacts in such a way where it not only plays this content, knows its location, but also displays data which is stored within this media file.

Well towards the end, he explains that this cannot be done via XAML because the XAML is only rendered upon loading the application once, by default. 

At the very end of the section is a line:

“Technically XAML can be changed on a XAML EventTrigger, but that is beyond the scope of this book.”

I find this comment to be interesting.  Many – too many in fact – books that I’ve read start out with the obtuse beginning proclamation which has been used far longer than my own existance, “This book will tell you everything you need to know… ”  *twitch*

That statement immediately reminds me of one which I have in my memory from childhood.  We were purchasing the family’s first computer.  It was an Acer Intel Inside Pentium.  The salesman’s comment (I’m sure many of you may already know where I’m going with this) was that the computer was so advanced that we won’t need another.  Ever.  The hard drive will never run out of space.  The memory is so advanced that nobody’s computer will be as fast as our’s.

*twitch*

Back to Victor’s comment in his book.  The fact that this comment is even here, is a sign of the times.  People of the current times are more often than not aware that the possibility of the infinite where something has an end is nill.  There will always be more after something has “an end”.  If there is an end, one must conclude that there is more outside of the scope of the said object.

It truly wasn’t that long ago that many would be ashamed to even mention that something exists outside of their creation.  Its nice to see the changing times.

Handyman Toolkit

Posted on

By the end of Chapter 5 of the book, I’ve discovered that yes, you can learn how to use this software without the assistance of a book, but had I been able to obtain this book a year ago when I started tinkering with Blend during my spare time, I would have greatly benefited from having this “in my back pocket” sort to speak.

The biggest confusion factor which I had when cutting myself off of Adobe products, cold turkey, to force myself to learn how to use Design and Blend, was the “when do I use the stackpanel over wrap panel?” or “Should I make this a canvas or a grid?”. Plus there was the creation of something primarily vector instead of part raster and part vector – that bit is something that illustrator gurus will likely not have any problems with, but most who design for the web tend to take preference to Photoshop – and only on occasion delve into primarily vector bases.

Now, the intent of this chapter was to get you familiar with the Layout elements and the unique attributes each layout element presents, however, there are underlying instructions which would assist a raster-based designer into being more comfortable with the ideas and ease when using vector shapes. They’re not that different to create and have the added scalability that raster(bitmap based) images just cannot do due to their innate nature.

In any event, the entire chapter is essentially “This is what X is, how about we apply this to give you hands-on experience with X”. We went over the following: Border, Canvas, DockPanel, Grid, Scroll Viewer, StackPanel, UniformGrid, ViewBox, and WrapPanel layout elements.

By the end of the chapter, the application is like a circus of vendors in graphical format. Victor is sure to mention in his book that he’s well aware of the lack of space towards the end.

Without further ado, I present my circus:

Click to view full sized image
Click to view full sized image

Inheritance – classes

Posted on

Chapter 4 of Victor’s book talks about XAML, C# and scratches at the surfave of both of these, including general information to make sure that the reader is able to follow further in the book regarding OOP(Object Oriented Programming) and in the subject regarding inheritance, he’s talking about superclasses and how the parent and children classes inherit the superclass in which they reside. He goes further into the analogies of how these work, and asks one to contemplate the pain of an inverse situation. He uses the example of fruit.

A superclass of “Fruit” as he describes, being that fruit is an edible container with the seeds of a plant inside. Oranges, Apples, etc. being children of the “Fruit” parent. In the case of inheritance, if Oranges and Apples are under the superclass of “Fruit” then both Apples and Oranges “know” that they are edible containers with seeds of their own plant. There is no need to “program” that individually when they are set as child-classes. If they were not set up as child classes, then one would have to individually tell each one, programatically, the properties of a fruit.

The inverse of this situation is one which I have encountered far too often – with much frustration, at that.

Many applications used – and still in very heavy use today, were often built reactionarily (… is that even a word?). What I mean by this is – there was a demand, and so came the birthing of some application or another. Every addition to this application was created as a reaction to a need.

Now, that doesn’t really sound bad on the surface. However, the reality of this is … not always good.
My day-after-new years-eve mind is having a difficult time coming up with a good example which would be easy to use, but the only things that I’m coming up with are so convoluted that most would get lost without diagrams.

Cleaning something of that nature up is much like many things – it might often just be easier to not even try to fix it and instead to start from scratch. This type of thing… I put up there with having a complex multi-page web-based application which has its styling willy nilly across the span of 200 aspx pages, 18 stylesheets and let’s not even talk about the markup styling done directly in the structure.