Dispose() public method

Must be called for each class instance. Must be called before Core.Library.Close().
public Dispose ( ) : void
return void
コード例 #1
0
ファイル: TestProxy.cs プロジェクト: simoncn/ohNet
 private void InvokeSync()
 {
     // trivial validation of the sync wrappers to all APIs
     // single sync call to whichever device happens to be first in our list
     if (iDeviceList.Count == 0)
     {
         Console.Write("No devices found, so nothing to test\n");
         return;
     }
     ControlPoint.ICpDevice device = iDeviceList[0];
     Console.Write("\n\nSync call to device " + device.Udn() + "\n");
     ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1 connMgr = new ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1(device);
     try
     {
         string source;
         string sink;
         connMgr.SyncGetProtocolInfo(out source, out sink);
         Console.Write("source is " + source + "\nsink is " + sink + "\n");
     }
     catch (ControlPoint.ProxyError)
     {
         Console.WriteLine("...failed.  (This may be expected but shouldn't be easily reproducible.)");
     }
     connMgr.Dispose();
 }
コード例 #2
0
ファイル: TestProxy.cs プロジェクト: simoncn/ohNet
 private void PollSubscribe()
 {
     iSubscriptionSem = new Semaphore(0, 1);
     for (int i = 0; i < iDeviceList.Count; i++)
     {
         ControlPoint.ICpDevice device = iDeviceList[i];
         string udn = device.Udn();
         if (udn == "896659847466-a4badbeaacbc-737837" ||
             udn == "541d0cb5-3b34-4264-8ff0-d8653acf6425")
         {
             continue;
         }
         uint countBefore = iSubscriptionCount;
         Console.Write("Device " + device.Udn());
         ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1 connMgr = new ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1(device);
         connMgr.SetPropertyChanged(PropertyChanged);
         DateTime startTime = DateTime.Now;
         while (true)
         {
             connMgr.Subscribe();
             iSubscriptionSem.WaitOne((int)(2 * kDevicePollMs));
             connMgr.Unsubscribe();
             DateTime now = DateTime.Now;
             if (now.Subtract(startTime).TotalSeconds > kDevicePollSecs)
             {
                 break;
             }
             iSubscriptionCount++;
         }
         Console.Write("    " + (iSubscriptionCount - countBefore) + "\n");
         connMgr.Dispose();
     }
 }
コード例 #3
0
ファイル: TestProxy.cs プロジェクト: simoncn/ohNet
 private void PollInvoke()
 {
     iActionPollStop = new Semaphore(0, 1);
     System.Timers.Timer timer = new System.Timers.Timer();
     timer.Elapsed  += TimerElapsed;
     timer.AutoReset = false;
     for (int i = 0; i < iDeviceList.Count; i++)
     {
         ControlPoint.ICpDevice device = iDeviceList[i];
         uint countBefore = iActionCount;
         Console.Write("Device " + device.Udn());
         iConnMgr = new ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1(device);
         uint version = iConnMgr.Version();
         if (version < 1 || version > 4) // arbitrarily chosen upper bound
         {
             Console.WriteLine("\n\tERROR: service version reported as " + version);
         }
         iActionPollStopTime = DateTime.Now.AddMilliseconds(kDevicePollMs);
         timer.Interval      = kDevicePollMs;
         timer.Enabled       = false;
         timer.Enabled       = true;
         for (int j = 0; j < 4; j++)
         {
             iConnMgr.BeginGetProtocolInfo(GetProtocolInfoComplete);
         }
         iActionPollStop.WaitOne();
         Console.Write("    " + (iActionCount - countBefore) + "\n");
         iConnMgr.Dispose();
         lock (this)
         {
             iExpectedSink = null;
         }
     }
 }
コード例 #4
0
ファイル: TestProxy.cs プロジェクト: sewood/ohNet
 private void InvokeSync()
 {
     // trivial validation of the sync wrappers to all APIs
     // single sync call to whichever device happens to be first in our list
     if (iDeviceList.Count == 0)
     {
         Console.Write("No devices found, so nothing to test\n");
         return;
     }
     ControlPoint.CpDevice device = iDeviceList[0];
     Console.Write("\n\nSync call to device " + device.Udn() + "\n");
     ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1 connMgr = new ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1(device);
     try
     {
         string source;
         string sink;
         connMgr.SyncGetProtocolInfo(out source, out sink);
         Console.Write("source is " + source + "\nsink is " + sink + "\n");
     }
     catch (ControlPoint.ProxyError)
     {
         Console.WriteLine("...failed.  (This may be expected but shouldn't be easily reproducible.)");
     }
     connMgr.Dispose();
 }
コード例 #5
0
ファイル: TestProxy.cs プロジェクト: sewood/ohNet
 private void PollSubscribe()
 {
     iSubscriptionSem = new Semaphore(0, 1);
     for (int i=0; i<iDeviceList.Count; i++)
     {
         ControlPoint.CpDevice device = iDeviceList[i];
         string udn = device.Udn();
         if (udn == "896659847466-a4badbeaacbc-737837" ||
             udn == "541d0cb5-3b34-4264-8ff0-d8653acf6425")
             continue;
         uint countBefore = iSubscriptionCount;
         Console.Write("Device " + device.Udn());
         ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1 connMgr = new ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1(device);
         connMgr.SetPropertyChanged(PropertyChanged);
         DateTime startTime = DateTime.Now;
         while(true)
         {
             connMgr.Subscribe();
             iSubscriptionSem.WaitOne((int)(2 * kDevicePollMs));
             connMgr.Unsubscribe();
             DateTime now = DateTime.Now;
             if (now.Subtract(startTime).TotalSeconds > kDevicePollSecs)
             {
                 break;
             }
             iSubscriptionCount++;
         }
         Console.Write("    " + (iSubscriptionCount - countBefore) + "\n");
         connMgr.Dispose();
     }
 }
コード例 #6
0
ファイル: TestProxy.cs プロジェクト: sewood/ohNet
 private void PollInvoke()
 {
     iActionPollStop = new Semaphore(0, 1);
     System.Timers.Timer timer = new System.Timers.Timer();
     timer.Elapsed += TimerElapsed;
     timer.AutoReset = false;
     for (int i=0; i<iDeviceList.Count; i++)
     {
         ControlPoint.CpDevice device = iDeviceList[i];
         uint countBefore = iActionCount;
         Console.Write("Device " + device.Udn());
         iConnMgr = new ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1(device);
         uint version = iConnMgr.Version();
         if (version < 1 || version > 4) // arbitrarily chosen upper bound
         {
             Console.WriteLine("\n\tERROR: service version reported as " + version);
         }
         iActionPollStopTime = DateTime.Now.AddMilliseconds(kDevicePollMs);
         timer.Interval = kDevicePollMs;
         timer.Enabled = false;
         timer.Enabled = true;
         for (int j=0; j<4; j++)
         {
             iConnMgr.BeginGetProtocolInfo(GetProtocolInfoComplete);
         }
         iActionPollStop.WaitOne();
         Console.Write("    " + (iActionCount - countBefore) + "\n");
         iConnMgr.Dispose();
         lock (this)
         {
             iExpectedSink = null;
         }
     }
 }