/// <summary>
/// Toggle on and off subscription to
/// automatic cloud updates.
/// </summary>
public static ExternalEvent ToggleSubscription(
// EventHandler<IdlingEventArgs> handler
IExternalEventHandler handler)
{
if (Subscribed)
{
Debug.Print("Unsubscribing...");
//_uiapp.Idling -= _handler;
//_handler = null;
_event.Dispose();
_event = null;
_buttons[_subscribeButtonIndex].ItemText
= _subscribe;
_timer.Stop();
_timer.Report("Subscription timing");
_timer = null;
Debug.Print("Unsubscribed.");
}
else
{
Debug.Print("Subscribing...");
//_uiapp.Idling += handler;
//_handler = handler;
_event = ExternalEvent.Create(handler);
_buttons[_subscribeButtonIndex].ItemText
= _unsubscribe;
_timer = new JtTimer("Subscription");
Debug.Print("Subscribed.");
}
return(_event);
}