コード例 #1
0
 /// <summary>
 /// Registers the app to the bridge, if API key already exists in datastore will pull
 /// </summary>
 public void Register()
 {
     try
     {
         HueBridge.SetupDataStore();
         string tempapi;
         tempapi = HueBridge.GetDataStore();
         if (HueBridge.LocalKey == true)
         {
             HueBridge.BridgeApi  = tempapi;
             HueBridge.Authorized = true;
             Authorized           = (ushort)(HueBridge.Authorized ? 1 : 0);
         }
         else
         {
             HueBridge.Register();
             Authorized = (ushort)(HueBridge.Authorized ? 1 : 0);
         }
         APIKey = HueBridge.BridgeApi;
         HueBridge.HueBulbs.Clear();
         HueBridge.HueGroups.Clear();
         HueBridge.HueSensors.Clear();
         getData();
     }
     catch (Exception e)
     {
         CrestronConsole.PrintLine("Exception is {0}", e);
     }
 }
コード例 #2
0
 /// <summary>
 /// Registers the app to the bridge, if API key already exists in datastore will pull
 /// </summary>
 public void Register()
 {
     try
     {
         HueBridge.SetupDataStore();
         string tempapi;
         tempapi = HueBridge.GetDataStore();
         if (tempapi != null)
         {
             HueBridge.BridgeApi  = tempapi;
             HueBridge.Authorized = true;
             Authorized           = (ushort)(HueBridge.Authorized ? 1 : 0);
         }
         else
         {
             HueBridge.register();
             Authorized = (ushort)(HueBridge.Authorized ? 1 : 0);
         }
         APIKey = HueBridge.BridgeApi;
     }
     catch (Exception e)
     {
         CrestronConsole.PrintLine("Exception is {0}", e);
     }
 }