This is by far my favorite addition to the library.

The GuideHelper class makes it easier to use the Guide and not have to worry about the GuideAlreadyVisibleException.

I'll explain how it works then Ill tell you how to use it or you can just scroll down to how to use it and ignore how it works.

Basically there is a base class that all of the GuideObjects have so they are all derived from that base class and in the GuideHelper class there is a queue of them.
So basically it just goes through the queue checking to see if the guide is done and if it should try to show the next guide in the queue. If it throws an exception it catches it and basically throws it in the garbage and tries to show the guide again in 0.5 seconds.

Using the GuideHelper
There are 2 ways to use this class, the easy way and the harderish way.
In the GuideHelper class there are a bunch of functions, one of them is Add
You again technically can but shouldn't use it. Basically what your doing is manually creating the GuideControl item and passing it to the queue of GuideControl's. While there's nothing wrong with doing that it is far easier to just call something like...
GuideHelper.ShowGamerCard(PlayerIndex, Gamer)
So which one you use is up to you, personally I use the functions since it is easier.

So say I wanted to show the storage device selection screen to the user.
NOTE
If you have it show the storage device selector and it does NOT appear but the storage device has been selected that is normal
If there is only 1 storage device on the xbox then it automatically selects that, you need a second storage device, e.g. a Memory Unite or a specially formatted USB stick.

Back to business.
To show the device selection screen and assuming you have 2 memory unites you would call...
GuideHelper.ShowStorageDeviceSelector(Action<StorageDevice> Complete)
Another note, you call this in a place that gets executed one time, if you call it in your update method your probably going to crash the game due to a stack overflow exception because it's just going to be adding the same thing to a queue every frame. and I'm sure the user doesn't want to be tormented by a infinite stream of storage device selectors.

So basically how these work is you tell it what you want to show, and then you pass it a method to send the value to. So for our storage device selector we would write a method that looks like...
Our call to the GuideHelper
GuideHelper.ShowStorageDeviceSelector(CompleteFunction);
Our method
public void CompleteFunction(StorageDevice deviceArg)
{
     //code
}
Then in the body of the method you have any finalization such as check to make sure its valid data and so forth. Note that you can use whatever method name you want but the arguments will be different for each type of Guide your calling. For example if we were showing a message box we would do something like...
public void messageBoxValue(int? value)
{
     //code
}
NOTE: the ? after the data type means that it is nullable. normally integers cannot be set to null but since the user can just press the B button and not select any messagebox option it will be null

Last edited Jul 27, 2010 at 8:48 PM by Destroyer229, version 2

Comments

No comments yet.