/// <summary> /// Shows the storage device selector. /// </summary> void SelectDevice() { Status = StorageProviderStatus.ShowSelector; if (Requirements.Player.HasValue == false) { if (Requirements.SizeInBytes == 0) { Guide.BeginShowStorageDeviceSelector( StorageDeviceDismissed, null); } else { Guide.BeginShowStorageDeviceSelector( Requirements.SizeInBytes, Requirements.DirectoryCount, StorageDeviceDismissed, null); } } else { if (Requirements.SizeInBytes == 0) { Guide.BeginShowStorageDeviceSelector( Requirements.Player.Value, StorageDeviceDismissed, null); } else { Guide.BeginShowStorageDeviceSelector( Requirements.Player.Value, Requirements.SizeInBytes, Requirements.DirectoryCount, StorageDeviceDismissed, null); } } }
/// <summary> /// Determines the providers status from the attached device. /// </summary> void UpdateStatusFromDevice() { if (device != null) { Status = device.IsConnected == true ? StorageProviderStatus.Connected : StorageProviderStatus.Disconnected; } else if (device == null) { Status = wasConnected == true ? StorageProviderStatus.Disconnected : StorageProviderStatus.Canceled; } }
/// <summary> /// Called when a message box has been dismissed. /// </summary> /// <param name="result">The result of the asynchronous operation.</param> void MessageBoxDismissed(IAsyncResult result) { int?button = Guide.EndShowMessageBox(result); if (button.HasValue == true && button.Value == 0) { // TODO: Delay to hide current message box Status = StorageProviderStatus.PendingSelector; //SelectDevice(context); } else { CancelSession(); } }
/// <summary> /// Updates the internal state of the provider. /// </summary> internal void Update() { if (Status == StorageProviderStatus.PendingSelector) { if (Guide.IsVisible == false) { SelectDevice(); } } else { bool isConnected = device != null && device.IsConnected; if (isConnected == false && wasConnected == true) { Status = StorageProviderStatus.Disconnected; } wasConnected = isConnected; } }