Adding/Removing AppBar Buttons on the fly

I am now back to working on an app that will be brand-new for the Marketplace, namely a Ham Radio practice exam app that I have mentioned on my product page, though not here, apparently.   I temporarily abandoned it to address problems in my Fraction Calculator, as well as adding support for Trial Mode and tightening up its execution speed.  But having submitted the improved F/C to the marketplace today (and I hope to be able to publish it in a few days), it time to get back to the Ham Practice Exam app.

For Trial Mode with the Fraction Calculator I needed to be able to modify the AppBar buttons on the fly, adding and/or taking away a button as needed, and as it turned out I had a similar need in the Ham Practice Exam a couple of months ago, and figured out how work dynamically with the AppBar.  In the case of Fraction Calculator, I needed for a Buy button to show when the app was in Trial Mode, but not otherwise.  In the case of the Ham Practice Exam, I needed to be able to use the button bar to both navigate forward and backward to sequential questions, and if a question was associated with a diagram that needed to be displayed, then a diagram display button needed to be added and then taken away.

The AppBar is defined in the page Xaml.  Once it is there, it can be modified.  In the main page of the app, the Normal Mode has one AppBar button, a Help button which takes the user to the Help page.  In Trial Mode, it must be joined by a Buy button that will cause the user to be directed to the Marketplace to purchase the app.  Here’s the Normal AppBar Xaml.

<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton x:Name="AppBarHelpButton" 
             IconUri="/Images/QuestionMark.png" 
             Text="Help" Click="AppBarHelpButton_Click" />
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>


Now, you might think that you could put a second ApplicationBarIconButton in there, with some kind of property set to true that would make it invisible.  But there isn’t, not at the ApplicationBarIconButton level.  You can make the entire AppBar visible or invisible on the fly by changing the IsVisible property, but not individual buttons.  

To start with, before you add the Buy button, you should make sure it isn’t already there.  Two of them might serve to emphasize to the Trial user that you’re really serious about getting paid for your app, but three might be overkill.  So, use this to see if you already have one:

private bool BuyMeButtonPresent()
{
    bool result = false;
    string bt = string.Empty;

    for (int x = 0; x < ApplicationBar.Buttons.Count; x++)
        {
            bt = (ApplicationBarIconButton)ApplicationBar.Buttons[x]).Text;
            if ((bt == "Buy")
           {
                result = true;
           }
    }
    return result;
}

As you can see, the method loops through each of the buttons, checking them to see if any of them has “Buy” in its Text property, and if so then it returns True.

Now, if you have an existing button that you need to get rid of, simply use the same strategy, and loop through the AppBar’s buttons, removing the one(s) you need to remove.

private void RemoveBuyMeButton()
{
    string bt = string.Empty;
    for (int x = 0; x < ApplicationBar.Buttons.Count; x++)
    {
        bt = (ApplicationBarIconButton)ApplicationBar.Buttons[x]).Text;
        if ((bt == "Buy")
        {
            ApplicationBar.Buttons.RemoveAt(x);
        }
    }
}

And once you’ve satisfied yourself that you don’t have any such button, and you want to add one, well, here’s how you do that:

private void AddBuyMeButton()
{
    ApplicationBarIconButton b = new ApplicationBarIconButton();
    b.IconUri = new Uri("/Images/BuyMe.png", UriKind.Relative);
    b.Text = "Buy";
    b.Click += BuyMe_Click;

    ApplicationBar.Buttons.Add(b);
}

Note that the BuyMe_Click event method included above already exists in the app’s code; you just need to add it to the new button’s Click event as shown above.

Note carefully, that I did not check to see if it is a good idea to remove the reference to the Click event if you are removing the button from the AppBar — in my case, this removal would happen exactly once during the app’s lifetime in any event, so if it were a loose end remaining, it wouldn’t be particularly loose. If you have a need to remove and re-add a button time after time while the same app instance is running, then perhaps you better make sure this isn’t going to be a problem. I can’t do everything for you, you know!

Posted in Windows Phone 7 Development | 3 Comments

RIP Zune

Word has come that Microsoft isn’t going to produce any more Zune devices, due to lackluster demand.  Well, though this is no surprise, I am saddened.

I have a Zune HD, and I really like it.  I bought my wife an iPod for her birthday a few months ago, because I thought she would find it easier to work with than a Zune, but it didn’t matter.  Her interest in electronic gizmos is pretty close to nil, and the iPod didn’t overcome that barrier.  So now it is currently being enjoyed by our son, Daniel, who lives in another town.  It’s in good hands, I guess.

I bought my Zune HD as a way to find out how the Metro user interface worked as part of prep for building Windows Phone apps, and it served admirably in the role.  I was looking forward to the next version of the device, but apparently it isn’t going to happen.  Oh, well.

This word comes to us, not officially so far, but it seems reliable:

http://www.bloomberg.com/news/2011-03-14/microsoft-said-to-stop-releasing-new-zune-models-as-demand-ebbs.html

Posted in Miscellaneous | Leave a comment

Superior Tools, Superior Platform

It was quite interesting reading about Jamie Murai’s struggle to install the Blackberry Playbook development tools, here, and after his story went viral, his update here.  It reminds me for all the world of what happened with Palm’s swan song with the Palm WebOS operating system for their Pre.  I wrote very briefly about that back in May of last year, in response to something Mary Jo Foley wrote about Microsoft being too slow (to her) in making information about WP7 available.  What I wrote about Palm, in light of Jamie’s experiences, may in fact bear on RIM’s efforts with the Playbook:

Microsoft has been doing exactly what poor Palm did not do with WebOS last year, and that is provide massive amounts of information on WP7 development, releasing all of it just as soon as they announced the platform.  Palm was very parsimonious on who got to look at and use their development tools, and as a result there were only 30 or so applications ready when the Palm Pre launched.  That has got to be one of the top reasons why Palm tanked.  Microsoft isn’t making that mistake.

Actually, I don’t bear any ill will towards RIM, and I hope that they succeed in their efforts to stay a viable company (because the more competition the better, IMHO).  But if they don’t improve their third-party developer experience then it won’t bode well for them in the App department.  And that appears to be critical to success in this space — the Smartphone and Tablet space.

The Joys of Visual Studio

And this brings me to Microsoft’s Visual Studio.  I have been working with VS in the .NET space since the first version back in 2002, and from the beginning it was simple to install, unbelievably powerful compared to every other tool I’ve ever used, and it has only gotten better over time.  I can’t imagine trying to develop without it. 

And the platform we are targetting with Visual Studio Express for Windows Phone is wonderful as well.  No doubt there are things that can be improved, and should be improved, but compared to my initial efforts to build my first app on Android (which I gave up on as soon as I heard about Windows Phone), the platform is likewise superior to develop for.  Others have written about this in depth, so I will not contribute my poor two cents, but will say that I echo their words.

Still coding after all these years, and loving it even more than before!

Posted in Miscellaneous | Leave a comment

The Marketplace May Bite You!

In a previous episode of Marketplace Woes, we discovered that the otherwise unexplained negative download bug/feature was in fact the result of a customer having his carrier apply a chargeback for the amount paid for the product.  Fair enough!  One would hope that if a customer didn’t like what she paid for that she could get her money back.

In response to this it seemed to be a good idea to provide a trial version for Fraction Calculator, so if a customer didn’t like the thing after a free trial, well, then he wouldn’t need to buy it.  One thing a trial period would help out on is getting more customers trying the product, right?  Good deal all the way around.  So I decided to make a revision to the product so it had a trial version — and along with that double the price to $1.99.   I put together the appropriate revision and submitted it.

As I indicated in an earlier post, the Fraction Calculator failed certification, due to a particular test that they hadn’t applied originally to it.  OK, fair enough, I better fix it.  So I’m in the process of it right now.  It’s a little complicated, but it will make the app better and that’s pretty much the most important thing.  But there’s a problem here!

Halfway to Paradise

Well, so the new version (v1.1) didn’t make it to the marketplace, but guess what did?  The new price ($1.99) and the Free Trial feature!  So what, you ask?  Well, let me tell you!

I submitted the new version on February 19.  It wasn’t tested (or I didn’t get the results of the testing) until February 25, but guess what?  The new price and the free trial took place immediately!  How do I know this?  Because my app report for Fraction Calculator shows I got 2 downloads on February 20, and one on February 21 — all three of them as free trial!

For the free trial it is possible for the developer to impose limitations on the app while in the trial, and only provide full functionality after the user has paid.  You can also make it entirely “sharewarey”, by not making the app crippled at all, and hope against hope that the user will pay for it.  Eventually.  Maybe put in a nag feature, that reminds the user that they haven’t paid yet, but otherwise allow full function.  Up to the developer, sure.

But Oh My Gosh!  I failed to read the fine print.  Well, it wasn’t all that fine, and it wasn’t on the bottom, and it was in red!

All changes made on this page are reflected for all published and unpublished instances of this application.

For those of you who can’t read it in the image above, this is what it says:

All changes made on this page are reflected for all published and unpublished instances of this application.

This means that if you submit a change on the pricing page for the new version of your app, and you select Trial Supported, unfortunately the new pricing AND the free trial will take place immediately on the current version!  And if the old (i.e. current) version doesn’t know what a free trial is, a user that downloads the not-free-trial-supporting version under the free trial will be able to use it without restriction until the cows come home.  And for most people, who don’t live on farms, the cows never come home.

So, remember kids, don’t change the pricing terms for your new version until it has passed certification or the Marketplace will bite you!

This is an important Safety Tip.

Of course, I have gone in and changed the pricing for v1.0 back to what it was.  And from now on I will remember to actually read and comprehend the text shown in red.

Posted in FractionCalc, Marketplace | 3 Comments

Negative Download Mystery Solved

Earlier (in this post) I reported that the reporting feature of the App Hub was telling me that on Feb 2, 2011, two of my apps, Fraction Calculator and Decimal2Fraction Converter, had minus 2 downloads.  How does one have negative downloads, I wondered?  I put in a problem report to Microsoft, since there was no explanation for it anywhere I could find in the documentation.  A couple of days ago I finally got the word on what this all meant.

So it wasn’t a bug, it was a feature.  I guess you could say it was an “undocumented” feature.  But it means that I had a “chargeback” on the two apps.  Here’s the report:

Hello Mike,
 
Thank you once again for your patience. I have confirmed that the negative downloads are due to application chargebacks, which occur when a customer contacts their mobile operator to refund the purchase. Please let me know if you have any questions.
 
Best Regards,
Ben
The Windows Phone Marketplace Support Team

So, a customer who bought the apps decided that he or she didn’t like them or want them, and decided to get a refund.  That’s fine!  I surmise that both chargebacks were from the same customer, since it occurred on the same day for related products.  But no matter. 

One part of me is a little surprised that someone would request a refund for an item that only cost 99 cents (I wouldn’t have, for example), but the other part is glad to hear that someone was vehement enough to want a refund for such a small amount!  I only wish I could have gotten some feedback on why, so that I could make relevant improvements.  So far, my customers have only given one of my apps a rating in the Marketplace, and that rating was on Fraction Calculator: four out of five stars.  And no written commentary.  I’ll take 4/5.

It’s all good.

Posted in Decimal2Fraction, FractionCalc, Marketing | Leave a comment

Bad News from the Certification Guys

I put together a minor upgrade to all my apps — correcting a couple of things I didn’t like in them, and adding a way for users to see all my apps — and they’ve been coming back from the certification folks just fine, except for my most ambitious app!  It got rejected, O, woe is me!

Hey, my rejects thus far have pretty much been for goofing up on the background thing — you know, when the user changes the background to the light instead of the dark background, and suddenly the white words on the screen can’t be seen!  The solution of course is to change the background color of the Grid control containing the words from the default of “Transparent” to something contrasty.  But not this time.

Keep in mind that the Fraction Calculator does not cut corners when it comes to calculating, and some fraction arithmetic, especially with large fractions containing denominators that don’t have many common factors, takes a LOOOOONNNNNGGGG time, even for a computer.  Fine, the app warns the user that the calculation is going to take awhile and confirms that the user wants to go ahead anyway.  But what happens if the user suddenly gets a phone call, or has to leave the Fraction Calculator in the middle of the operation?  Well, the tester found out and told me.  And this is the problem: Fraction Calculator does NOT tombstone properly.  Try to come back to the app after leaving it and it just doesn’t come back.  Yuck.

This particular problem wasn’t discovered in the initial testing, which the tester acknowledged, but I am glad it came up now.  This is because the calculation process is quite amenable to going on break while in the midst of working.  I just have to figure out how to save state on the process so I can resume it upon coming back online.

There’s fortunately a tutorial on the subject of tombstoning in the education section of the App Hub.  It’s in the QuickStarts, HERE.

Posted in FractionCalc, Windows Phone 7 Development | 3 Comments

Kudos to @Glowpuff!

The Windows Phone 7 developer community is truly a wondrous thing!  My earlier post complaining about the WP7 Marketplace, and wondering what I could do about navigating to my apps from inside the phone (something which I was told by someone else couldn’t be done), actually got a supremely useful comment from @Glowpuff (aka David) that was accurate (it CAN be done), and immediately useful (I tried it and it WORKS)! 

Here’s the screenshot — have a look:

My Zune Marketplace Apps via WP7

My Apps

That was a search using my publisher name, “Mike Clark”.  The same search can be used to search for the app itself, and this means that if you’re not careful you’ll do a search that brings back apps that don’t belong to you.  I did a search based on the word “Fraction”, and besides my own “Fraction Calculator” it also brings back 7 other apps that apparently have the search term somewhere in their descriptions.
I followed up on one of those other apps and inadvertantly discovered that one can put a link to one’s other Marketplace offerings inside the Marketplace description itself!  Next I will have to find out how this is done.  I made a pathetic attempt to do so in one of my apps’ descriptions, and it didn’t work. 
Learning is Eternal.  And that’s good.
Posted in Marketing, My Apps, Windows Phone 7 Development | Leave a comment

Marketplace Woes

The Windows Phone 7 Marketplace is getting to be frustrating. 

Marketing one’s apps, especially when they don’t automatically lend themselves to particular vertical markets where one might have a notion of whom to talk to in order to popularize them, is such a pain.  The Marketplace doesn’t seem to help, either.  Not that one should depend upon it, of course, as I’ve mentioned in an earlier post, but you’d think that the place would work better.  You can find my apps, if you use the Search feature, but how many people are going to be explicitly looking for something to do with fractions?  Search in the Zune Marketplace using the term “fraction” and you’ll find both Fraction Calculator and Decimal 2 Fraction Converter.  That’s fine, but if you use the word “calculator” the Fraction Calculator isn’t in the (lengthy) list.  Maybe I need to adjust my Marketplace entry, but you’d think that the name of the app would get indexed, right?  Apparently not.

And there’s another thing.  I can’t figure out how to give the user of one of my apps the ability to go directly to the marketplace through the app they currently own in order to browse and perhaps purchase another of my apps.  I can direct them to my product web page, but then I have to depend upon them taking a separate step to open up the Zune Marketplace on their computer workstation to find the app.  That puts a roadblock or two into fulfillment, something that one would like to see able to be bypassed.

And that’s not all!  In the App Hub, where the developer has the ability to see how many people are downloading his/her apps, the reporting feature is now giving me negative numbers on some downloads!  Technically, I’m told, this is not possible.  But there we are.

“Yikes, that’s quite a dip in sales, yessiree!  We had -2 sales yesterday!”

Does this mean that someone got a refund?  You might think that, but I understand that this is not something that is possible.

I reported this to Microsoft, and to their credit they are looking into it.  I hope they figure it out soon.  For one thing, I happen to wonder if the sales figures they are providing are at all reliable, in light of this oddity.

I hope so.

Posted in Marketing | 6 Comments

Nokia-Microsoft Deal: Nice!

I am encouraged that Nokia has made a deal with Microsoft to put Windows Phone 7 on their upcoming smartphones!  Nokia has a large (though shrinking) share of the cellphone market, and is well known worldwide, so this has the potential of making WP7 even better known than it already is.

Not everyone was happy about this, however.  I see that quite a few Nokia workers walked out in protest.  This is decidedly odd, given that Nokia has been losing market share steadily and has to do something to reverse it.  What do these people think, anyway, that Microsoft has cooties?

Posted in Windows Phone 7 Development | Leave a comment

I’ve updated my Windows Phone 7 product site

I’ve added new detail pages on the product site for each of my apps, including embedded videos on how to use each one of them.  I still seem to be avoiding continuing work on the Ham Radio Practice Exam app.  It only seems that way, though.  The reality is, or so I’ve found, that I am a serial being living in a parallel world!  In other words, I seem to be able to do only one thing at a time — whereas the world itself seems to be doing a hundred million things simultaneously!  I’m outnumbered, outgunned, and usually outmaneuvered.

But I refuse to give up!

My product site’s web address can be found in the links section of this blog.

Posted in MikeClark.co | Leave a comment