public Service(IVdsService vdsService) : base(vdsService) { this.refresh = true; this.queryProviderFlags = QueryProviderFlags.HardwareProviders | QueryProviderFlags.SoftwareProviders; this.service = vdsService; base.VdsService = this.service; try { this.serviceHba = (IVdsServiceHba)vdsService; } catch (InvalidCastException) { } try { this.vdsNotificationSink = new AdviseSink(this); this.service.Advise(this.vdsNotificationSink, out this.cookie); } catch (COMException exception) { throw new VdsException("The call to IVdsService::Advise failed.", exception); } catch (InvalidCastException exception2) { throw new VdsException("QueryInterface for IVdsService failed.", exception2); } }
public override void InitializeComInterfaces() { base.InitializeComInterfaces(); if (this.service == null) { this.service = InteropHelpers.QueryInterface <IVdsService>(base.ComUnknown); if (this.service == null) { throw new VdsException("QueryInterface for IVdsSerivce failed."); } } if (this.serviceHba == null) { this.serviceHba = InteropHelpers.QueryInterface <IVdsServiceHba>(base.ComUnknown); } if (this.serviceIscsi == null) { this.serviceIscsi = InteropHelpers.QueryInterface <IVdsServiceIscsi>(base.ComUnknown); } if (this.uninstallDisk == null) { this.uninstallDisk = InteropHelpers.QueryInterface <IVdsServiceUninstallDisk>(base.ComUnknown); } }