In a previous post on adding a version checker to media center, I gave an example of how to write a popup dialog box for media center. There is also a simpler version of the Dialog if you don’t need to know anything about the response, e.g. if you are simply showing an information message. This simpler version doesn’t require a callback to be defined, or any complex button definitions. It just needs a title, some text, a button name, a timeout and whether or not it is modal. Here’s an example;
<Condition Source="[Preferences.TwitDialog]" SourceValue="true" ConditionOp="ChangedTo"> <Actions> <Set Target="[Preferences.TwitDialog]" Value="false"/> <Invoke Target="[AddInHost.MediaCenterEnvironment.Dialog]" caption="Authorize Twitter" text="Please authorize twitter." buttons="Ok" timeout="15" isModal="true"/> </Actions> </Condition>
The buttons can only be ones from the list described in the documentation. A modal window requires either the user or a timeout to close it before any other actions can be done, whereas a modeless window allows the user to continue with other things in the meanwhile.
The dialog is fired in this example by a property which is set in the code to true, and then set back to false when it is read. The condition only fires when the value is set to true in the first place by using the ConditionOp.