public void Run(IBackgroundTaskInstance taskInstance) { Adapter adapter = null; deferral = taskInstance.GetDeferral(); try { adapter = new Adapter(); dsbBridge = new DsbBridge(adapter); var initResult = dsbBridge.Initialize(); if (initResult != 0) { throw new Exception("DSB Bridge initialization failed!"); } } catch (Exception ex) { if (dsbBridge != null) { dsbBridge.Shutdown(); } if (adapter != null) { adapter.Shutdown(); } throw; } }
protected void InitAllJoyn() { try { adapter = new Adapter(); dsbBridge = new DsbBridge(adapter); var initResult = dsbBridge.Initialize(); if (initResult != 0) { throw new Exception("DSB Bridge initialization failed!"); } } catch (Exception ex) { if (dsbBridge != null) { dsbBridge.Shutdown(); } if (adapter != null) { adapter.Shutdown(); } throw; } }