Thursday, February 19, 2009
Auto Update for Vista Gadget
I got this question from a Gadget developer!
"We have an auto-upgrade mechanism in place which gets notified if a new version is available thanks to a Web service.
Clearly this will alert users to the presence of a new version, and allow them to download it. However, once downloaded we’d like the old version to be replaced by the new one. Right now we are finding that the new one appears side-by-side with the old one, and the user has to remove it manually.
Do you have any ideas about how to prevent this?"
If you have a similar concern, here is a detail on what needs to be in the new version and what happens when the user download a new version of your existing Gadget.
To replace the existing gadget with a new version the following needs to be there:
"We have an auto-upgrade mechanism in place which gets notified if a new version is available thanks to a Web service.
Clearly this will alert users to the presence of a new version, and allow them to download it. However, once downloaded we’d like the old version to be replaced by the new one. Right now we are finding that the new one appears side-by-side with the old one, and the user has to remove it manually.
Do you have any ideas about how to prevent this?"
If you have a similar concern, here is a detail on what needs to be in the new version and what happens when the user download a new version of your existing Gadget.
To replace the existing gadget with a new version the following needs to be there:
- Name of the Gadget should be same.
- Gadget configuration file need to be same except for the version number which needs to be greater.
- The current gadget must be closed from the sidebar.
- When an upgrade is available. Give an Alert message that: a> User need to download the gadget in there desktop
- Instead of giving your user a URL of the gadget, redirect them to the upgrade page where you can put step-by-step instructions.
- The best way of course is to Avoid an Upgrade all together, in my experience very few people go for an upgrade if existing gadget is working.
b> They need to close the existing gadget. before installing the new version
Labels: gadget, gadgetbook, user query, vista
Monday, February 2, 2009
ComicStrip Vista Sidebar Gadget
Download
One of the most popular demo Gadget in the book is ComicStrip Gadget. I keep getting emails from users all over the world about how to customize it. Note that this gadget is meant for education purpose only. Here is one of the conversation.

If you are also interested to customize the Gadget Read On.
The Problem from Gadget developer
First of all let me thank you the very useful ComicStrip gadget. I really enjoy using it, However I have slight problems with it.These are:
Could you please at least give me hints how to resolve this problem or could you please fix it? I really enjoy using your superb gadget and I definitely do not want to switch to an other feed reader sw because the Sidebar is the most comfortable solution AND simply there is no alternative for your gadget, it is one of a kind...
- When I restart the PC, the gadget reverts all settings to default, in my case, I only need Dilbert, Garfield and Calvin & Hobbes strips but when my PC restarts the gadget always displays all the default strips like Maxine, Chicken and so on. I cannot figure out what is the problem, I am admin on my PC and I also have full control rights for the Sidebar directory. I also checked the settings.ini for gadgets, it has the right settings for ComicStrip. This also happens sometimes when I just hibernate the PC.
- The other thing: on the settings page Calvin and Chicken are mixed up, so when I select Calvin, I get Chicken strips and vice versa.
Could you please at least give me hints how to resolve this problem or could you please fix it? I really enjoy using your superb gadget and I definitely do not want to switch to an other feed reader sw because the Sidebar is the most comfortable solution AND simply there is no alternative for your gadget, it is one of a kind...
The Solution
The session in sidebar vista gadget is not saved when the computer restarts, so the only way to make the settings persist is set the defaults in the code. ComicStrip gadget is based on MyBlog Gadget which is the core focus of Chapter 4 to Chapter 8 of Creating Vista Gadgets .If you have the book, check the portion where we initialize and set the defaults for the Gadget.
Here are the steps to change the defaults:
1. Open the following location in Windows Explorer %userprofile%\AppData\Local\Microsoft\Windows Sidebar\Gadgets\ComicStrip.gadget\code
2. Open the Gadget.js file in notepad.
3. Look for the function SetDefaults()
you will see the following code
function SetDefaults()
{
System.Gadget.Settings.write("Dilbert",true );
URLFeedsActive[0] = 1;
System.Gadget.Settings.write("Garfield",true );
URLFeedsActive[1] = 1;
System.Gadget.Settings.write("Chicken",true );
URLFeedsActive[2] = 1;
URLFeedsActive[3] = 0;
URLFeedsActive[4] = 0;
URLFeedsActive[5] = 0;
System.Gadget.Settings.write("Calvin",true );
URLFeedsActive[6] = 1;
System.Gadget.Settings.write("Maxine",true );
URLFeedsActive[7] = 1;
URLFeedsActive[8] = 0;
URLFeedsActive[9] = 0;
System.Gadget.Settings.write("Peanuts",true );
URLFeedsActive[10] = 1;
System.Gadget.Settings.write("BobBetty",true );
URLFeedsActive[11] = 1;
}
SO FOR 11 COMIC STRIPS YOU HAVE 11 SETTINGS
if you want only dilbert , garfield and calvin your function code should look like the following
function SetDefaults()
{
System.Gadget.Settings.write("Dilbert",true );
URLFeedsActive[0] = 1;
System.Gadget.Settings.write("Garfield",true );
URLFeedsActive[1] = 1;
URLFeedsActive[2] = 0;
URLFeedsActive[3] = 0;
URLFeedsActive[4] = 0;
URLFeedsActive[5] = 0;
System.Gadget.Settings.write("Calvin",true );
URLFeedsActive[6] = 1;
URLFeedsActive[7] = 0;
URLFeedsActive[8] = 0;
URLFeedsActive[9] = 0;
URLFeedsActive[10] = 0;
URLFeedsActive[11] = 0;
}
4. Make the change in SetDefault function and save Gadget.js file.
5. Close the gadget from sidebar.
6. Go to gadget picker window and add the gadget again.
Hope this helps.
Here are the steps to change the defaults:
1. Open the following location in Windows Explorer %userprofile%\AppData\Local\Microsoft\Windows Sidebar\Gadgets\ComicStrip.gadget\code
2. Open the Gadget.js file in notepad.
3. Look for the function SetDefaults()
you will see the following code
function SetDefaults()
{
System.Gadget.Settings.write("Dilbert",true );
URLFeedsActive[0] = 1;
System.Gadget.Settings.write("Garfield",true );
URLFeedsActive[1] = 1;
System.Gadget.Settings.write("Chicken",true );
URLFeedsActive[2] = 1;
URLFeedsActive[3] = 0;
URLFeedsActive[4] = 0;
URLFeedsActive[5] = 0;
System.Gadget.Settings.write("Calvin",true );
URLFeedsActive[6] = 1;
System.Gadget.Settings.write("Maxine",true );
URLFeedsActive[7] = 1;
URLFeedsActive[8] = 0;
URLFeedsActive[9] = 0;
System.Gadget.Settings.write("Peanuts",true );
URLFeedsActive[10] = 1;
System.Gadget.Settings.write("BobBetty",true );
URLFeedsActive[11] = 1;
}
SO FOR 11 COMIC STRIPS YOU HAVE 11 SETTINGS
if you want only dilbert , garfield and calvin your function code should look like the following
function SetDefaults()
{
System.Gadget.Settings.write("Dilbert",true );
URLFeedsActive[0] = 1;
System.Gadget.Settings.write("Garfield",true );
URLFeedsActive[1] = 1;
URLFeedsActive[2] = 0;
URLFeedsActive[3] = 0;
URLFeedsActive[4] = 0;
URLFeedsActive[5] = 0;
System.Gadget.Settings.write("Calvin",true );
URLFeedsActive[6] = 1;
URLFeedsActive[7] = 0;
URLFeedsActive[8] = 0;
URLFeedsActive[9] = 0;
URLFeedsActive[10] = 0;
URLFeedsActive[11] = 0;
}
4. Make the change in SetDefault function and save Gadget.js file.
5. Close the gadget from sidebar.
6. Go to gadget picker window and add the gadget again.
Hope this helps.
Labels: Book, gadget, gadgetbook, user query, vista

