How To Program With The Shared Dictionary Directly

<< Back to the SharedPhidgets 3 page

You can get a reference to the shared dictionary that is used by all the SharedPhidgets components and skins. This lets you read and modify entries in the shared dictionary directly.

Note: this is only recommended for advanced developers! Be aware that by changing wrong entries in the dictionary, the complete SharedPhidgets infrastructure might become instable.

Note: you need the GroupLab .Networking toolkit to work with a shared dictionary and subscriptions

GroupLab.SharedPhidgets.ConnectionManager connectionManager
  = new GroupLab.SharedPhidgets.ConnectionManager();

GroupLab.Networking.SharedDictionary sharedDictionary =

// Or use the Connection Singleton to get the common connection instance
GroupLab.Networking.SharedDictionary sharedDictionary =

Then you can setup a new subscription object that receives all the entries in the shared dictionary:

GroupLab.Networking.Subscription subscription
  = new GroupLab.Networking.Subscription();

subscription.Dictionary = sharedDictionary;
subscription.Pattern = "/*";
  +=new GroupLab.Networking.SubscriptionEventHandler(subscription_Notified);
subscription.Enabled = true;

You also need this callback method of the notification event handler:

private void subscription_Notified(object sender, GroupLab.Networking.SubscriptionEventArgs e)
  string path = e.Path;
  object receivedValue = e.Value;

  // Your code here