The Imaginative Universal

Studies in Virtual Phenomenology -- @jamesashley

How to Hotwire your WP7 Phone Battery

February 04
by James Ashley 4. February 2011 17:38

Steve-McQueen-Bullitt

My project manager was out last night and forgot to recharge her WP7 phone.  With the particular model she has, once the battery completely loses its charge, you can no longer recharge it simply by plugging in the phone charger. 

The problem seems to be that the phone always needs to boot up just a little when it is plugged in.  If there is no charge left, then that minimal necessary change is simply missing.

Since we have the same model, the first thing we did was to verify that the problem was with the battery by switching out her battery for mine.  It was definitely the battery.

The next thing we did was scour the Internet to find out if others were having this issue.  Indeed they were.  And not only people with Windows Phone but also some people with Android phones.  In the process, we also found a seemingly crazy solution that involves stripping up a USB cable and recharging the battery directly.  Of course, we couldn’t resist trying to hotwire a phone and it worked perfectly.  Here’s what you do.

WP_000081

First, find an old USB cable you don’t need anymore.  It doesn’t matter what’s on the other end of the wire as long as one end is USB.  Cut The Wire!

WP_000083

Next, strip the cut end to remove the plastic from the wire.  You’ll want to strip about 3/4 of an inch off.  This will expose a thin foil wrapper around the internal wires and filament.  Remove the foil.

WP_000094

Bend back the filament as well as the extra interior wires to expose just the red and the black wires.  These are the wires that actually carry the charge in a USB cable.

The interior wires are too thin to actually strip.  What you can do, however, is cut the red and the black wires at an angle.  This will expose enough of the copper to work with.

WP_000101

Pull your battery out of your Windows Phone device.  Your phone battery will indicate where the positive and the negative touch points are.  Plug your USB connector to your laptop.  Take the other cut end and touch the red wire to the positive and the black wire to the negative.

RED => Positive

BLACK => Negative

Hold the wire to the battery for about two minutes.  People will ask what you are doing if, like me, you do this in the office.  Try to be creative with your response.

After two minutes, put the battery back in your phone and plug your phone in to recharge it.  The battery is still at 0 per cent, but now has just enough charge so the phone is able to start up and begin charging normally.

It’s a bit MacGuyveresque, but makes for a great story.

Tags:

Recipe | Windows Phone

Creating an Application Bar in Blend

July 14
by James Ashley 14. July 2010 22:08

Ingredients: Windows Phone Dev Tools beta, Expression Blend for Windows Phone

The application bar in Windows Phone 7 is a core visual element in any Silverlight application built for the phone.  The development tools make it very easy to implement an application bar with just a few lines of code. 

xmlns:phoneNavigation="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
>
<phoneNavigation:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar>
        <shell:ApplicationBarIconButton Text="delete"  
                IconUri="/Icons/appbar.delete.rest.png"/>
    </shell:ApplicationBar>
</phoneNavigation:PhoneApplicationPage.ApplicationBar>

This code can also be moved to a page resource or an app resource in case the toolbar is reused.  The toolbar can also be created in code for greater control.

Along with other changes, the new beta of the Windows Phone dev tools now also allows Application Bars to be created in Blend for Windows Phone.

appbar

For those moving from the CTP to the Beta tools, you will find that there are some new improvements as well as some of the earlier limitations.

The Application Bar, as previously, has very slick transitions built-in.  It is a pleasure to work with.

As previously, the properties of an Application Bar cannot be bound (as far as I can tell), so the developer needs to go into code-behind, for the most part, to implement any complex visual logic (or even simple logic like hiding and showing Icon Buttons) as well as to handle click events. 

As previously, the Application Bar must be attached to a PhoneApplicationPage.  You cannot get different app bars to reveal themselves by attaching them to user controls.  If you have logic that requires this (for instance if you want different app bars to be used for different panels of a Hub) you will need to track the state of the hub and hide and show the appropriate Application Bar manually in the hosting PhoneApplicationPage’s code-behind.

As for the new, ApplicationBarIconButtons now take a Text property (and in fact are required to have non-empty Text).  When a user selects the ellipses at the upper right of the application bar, the text will appear (in the picture above, taken from the One Note application, the text is “email”).

And, as I mentioned, the Windows Phone app bar is now Blendable.

if you open up a new project in Blend for Windows Phone and select a page, you’ll notice a new element representing the ApplicationBar in the Objects panel.

oandt

This is a property that takes an IApplicationBar object (that it takes an interface suggests that we can extend the base implementation of the ApplicationBar – though I have yet to find a good case for doing so).

In order to add an application bar to our page, select the PhoneApplicationPage element in Objects and Timeline.  Now go to the Properties panel at the upper left of the Blend IDE and look for the Common Properties tab (alternatively, search for “ApplicationBar”).

commonproperties 

A new ApplicationBar can be created for the page by selecting “New”.

appbartab

Here things get a little funky.  I assume the features are still being added for the app bar – though there’s always the possibility that I have something wrong with my install.  The BackgroundColor and ForegroundColor never seem to change in the display of the Properties panel (though they do change in the XAML).  Also, if you select either the Buttons or MenuItems collection, you are thrown into a bit of confusion.  The following images show the steps for adding an icon button.

The screen after this shows a standard dialog box for a list.  You can select “add another item” from this dialog.

The “add another item” dialog, however, is messy. 

selecticonbutton 

Lots of classes besides ApplicationBarIconButton or ApplicationBarMenuItem show up even though these are the only two types you can actually add to an ApplicationBar.  This will undoubtedly get fixed within the next few months.  Search for ApplicationBarIconButton and select it to add an icon button to the app bar.

You will be returned to the buttons collection editor where you must now set two properties of an ApplicationBarIconButton: Text and IconUri.  (IsEnabled defaults to “true” if you leave it alone.)

iconbutton

One of the very cool features here is that the dropdown box next to IconUri allows you to select from a list of standard Icons used in WP7.  When you select one of these, the IDE automatically goes out and copies the selected icon into a newly created “icons” folder under your project.

Not to belabor my war stories, but back in the day (I’m talking about last week) we used to have to download all the images from the web and then add them to our projects manually.  That may seem like no big deal, but there were actually two different sets of icons – one for the dark theme, which were white on black, and one for the light them, which were black on white.  Worse, there was no obvious way to find the theme currently being used, so we would check the background color of the app, in code, to determine whether it looked like the dark or the light them was being used.  Then we would programmatically switch out the icons based on what the background color happened to be.  But at least we had character back then and understood the value of a hard day’s work.

So now not only is all of that easier with the beta SDK, but you also get a designer preview of what your app bar looks like.

appbarpreview

But wait … there’s more.  If you go to the upper right docking panel in the standard layout, there is now a “Device” tab that allows you to preview how your app will look under different themes.

devicepanel

If you select the Light device, the app bar shown above will now look like this.

lighttheme

Your project, however, still only has the original image you added when you selected a value for the IconUri property of the app bar icon button.

oneicon

We no longer have to manage multiple images for the same icon button.  WP7 is apparently manipulating the one physical image in order to accommodate the current theme on the device.

This technique for image management allows for an interesting additional feature.  You will recall from above that the application bar has a foreground property.  If I set this to red, Blend actually freaks out and doesn’t show the app bar anymore.  If I run the app in the emulator, however, I get this and this:

rediconbutton redongray

Setting the background property, in turn, only affects the “clicked on” image.  When you click on an icon button, the foreground color becomes the background color for the image and the specified background color becomes the foreground color.  When the icon is not clicked, it still looks as it does above.  It’s a little confusing, but still a very cool effect.

Like most controls in Blend, once you finish defining your ApplicationBar, you can convert it into a resource.  Select the difficult-to-see little white square next to the “New” button to open up a dialog that will walk you through making the app bar a page or an application resource.

resourceit

createIApplicationBar

This will change the XAML in your page to this:

    <phone:PhoneApplicationPage.ApplicationBar>
        <StaticResource ResourceKey="MyApplicationBar"/>
    </phone:PhoneApplicationPage.ApplicationBar>

while the actual implementation of the ApplicationBar will be in your App Resources.

Summary

The improvements to the ApplicationBar have been incremental but are very much welcome.  Once all the bugs have been worked out, Blend’s support for the ApplicationBar will be useful.  I still wish we could bind the ApplicationBar properties.  Considering how much we get for free, however – standard icon images, snazy transitions – there’s really not much to complain about and lots to be grateful for.  The Windows Phone implementation of the ApplicationBar makes it easy to implement and attractive and common user interface for performing simple tasks.

Tags: , ,

Windows Phone | Silverlight | Recipe

How to become a Silverlight Expert

June 11
by James Ashley 11. June 2010 13:30

steven

I am a Silverlight Expert (And So Can You!).

You may have come across this con before.  You find a short ad in a magazine or a newspaper or a flyer that offers you a secret recipe for making lots and lots of money from your home.  All you have to do is send in $10.

A friend of a friend of a friend of mine actually did this.  The secret recipe is that you create an ad in a magazine or a newspaper or a flyer offering a secret recipe for making lots and lots of money and all people have to do is send you $10.

If you google (or google on Bing) for a Silverlight Expert you are likely to come across this blog entry by Caleb Jenkins: 5 Steps to becoming a Silverlight Expert in which Caleb pretty much explains the secret recipe.  You write a blog post with the words “Silverlight” and “Expert” in it and, wham, bam, there you go.  Instantaneous SEO success.  Put Silverlight Expert in your meta tags (go ahead and check mine now, if you like; I’ll wait) and there you go.  More SEO magic.  Link anchors to other sites that score high for this particular set of keywords is also very effective.

In addition to Caleb, a Silverlight Expert search on the web will likely bring up Erik Mork, Corey Schuman and Shawn Wildermuth.  For the record, they all really are Silverlight experts just as Caleb really is.  Erik and Corey are recognized by Microsoft as Silverlight MVPs and Caleb is an ASP.NET MVP.  Shawn has been an institution in the MVP program for a decade.

Besides saying you are a Silverlight expert, you can also, of course, pay to be a Silverlight expert.  A google search today will lead with three paid spots for Northridge Interactive, Implicit Web and Axmor.  Are they Silverlight experts?  I don’t really know.  All I can say is that paying to be recognized as Silverlight experts doesn’t mean you are not Silverlight experts.

You may have come across this joke before:

Socrates: “To be is to do."

Sartre: "To do is to be."

Sinatra: "Do Be Do Be Do."

I first came across it in a 1985 Luc Besson film called Subway starring Christopher Lambert (of Highlander fame).  It exemplifies, trivializes and then revitalizes an ancient philosophical debate between the man of action and the man of words about what is the best life – that is, a debate between the politician and the philosopher/scientist.

For the politician, words and public speaking are a form of doing – it has a goal, to convince the polis on a course of action.  For the philosopher, action is a form of being.  What we do reveals the sort of person we are – and so we must choose our actions carefully.  Socrates drinks the hemlock because that is the sort of man he is.

Only in modern times have we thrown up a third option for the best life – a life achieved through marketing.  We should give a nod to the German transcendentalists for laying the groundwork for this third way, since they developed and expanded on the concept of “appearing.”

In the world of marketing, “to appear” to be something is “to be” it.  The world is nothing more than a representation, after all -- a collective agreement on what we value and what we believe.  Both the speeches of Pericles and the final moments of Socrates in the Apology can now be seen as great marketing moments that were memorable as well as influential.  If we could only go back in time and get a product placement in there somehow.

In a virtual world dominated by marketing, the secret recipe to success seems to be a recognition that “to say” is “to do”.  If you don’t believe me, just check Wikipedia.

If you want to “really” be a Silverlight expert, however, then there just are no shortcuts.  You’ll have to just do it*.

[* “Just do it” was coined by marketing guru Dan Wieden for an extremely successful Nike campaign and is probably copyrighted. According to the film Art & Copy it was inspired by the last words of a death row inmate as he was waiting to be executed.]

Tags: ,

Silverlight | Recipe | Omphaloskepsis

BlogRoll

Download OPML file OPML