IStorage |
public interface IStorageManager : IDeviceManager
The IStorageManager type exposes the following members.
| Name | Description | |
|---|---|---|
| GetConnectionState |
Gets the ConnectionState of a device.
(Inherited from IDeviceManager) | |
| GetDeviceById |
Retrieves device handle by ID.
(Inherited from IDeviceManager) | |
| GetDeviceByName |
Retrieves device handle by name.
(Inherited from IDeviceManager) | |
| GetDeviceInfoList |
Gets information about all devices.
(Inherited from IDeviceManager) | |
| GetInitialStates |
Triggers submission of current device state events to registered event receivers.
(Inherited from IDeviceManager) | |
| GetName |
Retrieves device name.
(Inherited from IDeviceManager) | |
| GetStorageById | Retrieves storage handle by id. | |
| GetStorageByName | Retrieves storage handle by name. | |
| GetStorageInfoList | Gets information about all storages. |
internal class TestEventReceiver : EventReceiver { public override void OnEvent(EventData eventData) { if (eventData.State.IsValid && eventData.Type.Equals("ConnectionState")) { if (eventData.State.New.Equals("Connected")) { Console.WriteLine("Storage is connected"); } if (eventData.State.New.Equals("Disconnected")) { Console.WriteLine("Storage is disconnected"); } if (eventData.State.New.Equals("NotAuthorized")) { Console.WriteLine("Storage authorization failed."); } if (eventData.State.New.Equals("Unknown")) { Console.WriteLine("Storage state is unknown."); } } } }
Get Storage (e.g. using GetStorageByName(String)) and register the event receiver for device (using Register(EventReceiver, Device)). Event receiver will receive events only for selected Storage.
Storage storage = remoteServerApi.StorageManager.GetStorageByName("Storage 1"); TestEventReceiver eventReceiver = new TestEventReceiver(); remoteServerApi.EventManager.Register(eventReceiver, storage); ...
remoteServerApi.EventManager.Unregister(eventReceiver);