Exemple #1
0
        /// <summary>
        /// Asynchronous callback to the guide's BeginShowStorageDeviceSelector call.
        /// </summary>
        /// <param name="aResult"></param>
        private static void GetStorageDeviceResult(IAsyncResult aResult)
        {
            if ((aResult == null) || !aResult.IsCompleted)
            {
                return;
            }

            //Retrieve and store the storage device
            mStorageDevice = StorageDevice.EndShowSelector(aResult);

            //Check the new storage device
            if ((mStorageDevice != null) && mStorageDevice.IsConnected)
            {
                //it passes; call the stored delegate
                StorageDeviceDelegate lFunc = aResult.AsyncState as StorageDeviceDelegate;
                if (lFunc != null)
                {
                    lFunc(mStorageDevice);
                }
            }
        }
Exemple #2
0
        public static void GetStorageDevice(StorageDeviceDelegate aRetrievalDelegate)
        {
            if (aRetrievalDelegate == null)
            {
                throw new ArgumentNullException("retrievalDelegate");
            }

            //Check the storage storage device
            if ((mStorageDevice != null) && mStorageDevice.IsConnected)
            {
                aRetrievalDelegate(mStorageDevice);
                return;
            }

            //The storage device must be retrieved
            if (!Guide.IsVisible)
            {
                //Reset the device
                mStorageDevice = null;
                StorageDevice.BeginShowSelector(GetStorageDeviceResult, aRetrievalDelegate);
            }
        }
Exemple #3
0
        /// <summary>
        /// Asynchronous callback to the guide's BeginShowStorageDeviceSelector call.
        /// </summary>
        /// <param name="result">The IAsyncResult object with the device.</param>
        private static void GetStorageDeviceResult(IAsyncResult result)
        {
            // check the parameter
            if ((result == null) || !result.IsCompleted)
            {
                return;
            }

            // retrieve and store the storage device
            SharedResources.StorageDevice = StorageDevice.EndShowSelector(result);

            // check the new storage device
            if ((SharedResources.StorageDevice != null) && SharedResources.StorageDevice.IsConnected)
            {
                // it passes; call the stored delegate
                StorageDeviceDelegate func = result.AsyncState as StorageDeviceDelegate;
                if (func != null)
                {
                    func(SharedResources.StorageDevice);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Asynchronously retrieve a storage device.
        /// </summary>
        /// <param name="retrievalDelegate">
        /// The delegate called when the device is available.
        /// </param>
        /// <remarks>
        /// If there is a suitable cached storage device,
        /// the delegate may be called directly by this function.
        /// </remarks>
        public static void GetStorageDevice(StorageDeviceDelegate retrievalDelegate)
        {
            if (retrievalDelegate == null)
            {
                throw new ArgumentNullException("retrievalDelegate");
            }

            // If the storage device is ready, we can just retrieve the file:
            if ((SharedResources.StorageDevice != null) && SharedResources.StorageDevice.IsConnected)
            {
                retrievalDelegate(SharedResources.StorageDevice);
                return;
            }

            // The storage device must be refreshed
            if (!Guide.IsVisible)
            {
                // Reset the device
                SharedResources.StorageDevice = null;
                StorageDevice.BeginShowSelector(GetStorageDeviceResult, retrievalDelegate);
            }
        }
Exemple #5
0
        /// <summary>
        /// Asynchronously retrieve a storage device.
        /// </summary>
        /// <param name="retrievalDelegate">
        /// The delegate called when the device is available.
        /// </param>
        /// <remarks>
        /// If there is a suitable cached storage device, 
        /// the delegate may be called directly by this function.
        /// </remarks>
        public static void GetStorageDevice(StorageDeviceDelegate retrievalDelegate)
        {
            // check the parameter
            if (retrievalDelegate == null)
            {
                throw new ArgumentNullException("retrievalDelegate");
            }

            // check the stored storage device
            if ((storageDevice != null) && storageDevice.IsConnected)
            {
                retrievalDelegate(storageDevice);
                return;
            }

            // the storage device must be retrieved
            storageDevice = null;
            Guide.BeginShowStorageDeviceSelector(GetStorageDeviceResult,
                retrievalDelegate);
        }
        /// <summary>
        /// Asynchronously retrieve a storage device.
        /// </summary>
        /// <param name="retrievalDelegate">
        /// The delegate called when the device is available.
        /// </param>
        /// <remarks>
        /// If there is a suitable cached storage device, 
        /// the delegate may be called directly by this function.
        /// </remarks>
        public static void GetStorageDevice(StorageDeviceDelegate retrievalDelegate)
        {
            if (retrievalDelegate == null)
                throw new ArgumentNullException("retrievalDelegate");

            // If the storage device is ready, we can just retrieve the file:
            if ((SharedResources.StorageDevice != null) && SharedResources.StorageDevice.IsConnected)
            {
                retrievalDelegate(SharedResources.StorageDevice);
                return;
            }

            // The storage device must be refreshed
            if (!Guide.IsVisible)
            {
                // Reset the device
                SharedResources.StorageDevice = null;
                StorageDevice.BeginShowSelector(GetStorageDeviceResult, retrievalDelegate);
            }
        }
Exemple #7
0
 /// <summary>
 /// Asynchronously retrieve a storage device.
 /// </summary>
 /// <param name="retrievalDelegate">
 /// The delegate called when the device is available.
 /// </param>
 /// <remarks>
 /// If there is a suitable cached storage device, 
 /// the delegate may be called directly by this function.
 /// </remarks>
 public static void GetStorageDevice(StorageDeviceDelegate retrievalDelegate)
 {
     // check the parameter
     if (retrievalDelegate == null)
     {
         throw new ArgumentNullException("retrievalDelegate");
     }
     retrievalDelegate();
 }