Partager via


StorageManager.ConnectAsync Method ()

 

Asynchronously connects the Storage Manager with the Storage Provider.

Namespace:   Microsoft.WindowsServerSolutions.Storage
Assembly:  StorageOM (in StorageOM.dll)

Syntax

public void ConnectAsync()
public:
void ConnectAsync()
Public Sub ConnectAsync

Examples

The following code example shows how to asynchronously connect the Storage Manager with the Storage Provider.

try
{
   StorageManager storageManager = new StorageManager();
   storageManager.PropertyChanged += StorageManager_PropertyChanged;
   storageManager.ConnectAsync();
}
catch (StorageObjectModelException stoEx)
{
   //Handle exception
}

The following code example shows the delegate method.

static void StorageManager_PropertyChanged(
   object o, PropertyChangedEventArgs args)
{
   StorageManager manager = (StorageManager)o;
   if (args.PropertyName.Equals(
      StorageObjectModelPropertyNames.ConnectedPropertyName))
   {
      Console.WriteLine("The Connected property changed to {0}", 
         manager.Connected);
   }
   else if (args.PropertyName.Equals(
      StorageObjectModelPropertyNames.DefaultDiskSetPropertyName))
   {
      Console.WriteLine("Default diskset changed");
   }
}

See Also

StorageManager Class
Microsoft.WindowsServerSolutions.Storage Namespace

Return to top