// // Summary: // Begins the process for displaying the storage device selector user interface, // and for specifying the size of the data to be written to the storage device // and the callback implemented when the player chooses a device. Reference // page contains links to related code samples. // // Parameters: // sizeInBytes: // The size, in bytes, of data to write to the storage device. // // directoryCount: // The number of directories to write to the storage device. // // callback: // An AsyncCallback that represents the method called when the player chooses // a device. // // state: // A user-created object used to uniquely identify the request, or null. public static IAsyncResult BeginShowSelector(int sizeInBytes, int directoryCount, AsyncCallback callback, object state) { var del = new ShowSelectorAsynchronousShowNoPlayer(Show); #if WINRT showDelegate = del; #endif return(del.BeginInvoke(sizeInBytes, directoryCount, callback, state)); }
// // Summary: // Begins the process for displaying the storage device selector user interface, // and for specifying the size of the data to be written to the storage device // and the callback implemented when the player chooses a device. Reference // page contains links to related code samples. // // Parameters: // sizeInBytes: // The size, in bytes, of data to write to the storage device. // // directoryCount: // The number of directories to write to the storage device. // // callback: // An AsyncCallback that represents the method called when the player chooses // a device. // // state: // A user-created object used to uniquely identify the request, or null. public static IAsyncResult BeginShowSelector(int sizeInBytes, int directoryCount, AsyncCallback callback, object state) { #if !WINDOWS_PHONE81 && !ANDROID && !IOS && !NETFX_CORE && !WINDOWS_PHONE var del = new ShowSelectorAsynchronousShowNoPlayer(Show); #if WINRT showDelegate = del; #endif return(del.BeginInvoke(sizeInBytes, directoryCount, callback, state)); #else var tcs = new TaskCompletionSource <StorageDevice>(state); var task = Task.Run <StorageDevice>(() => Show(sizeInBytes, directoryCount)); task.ContinueWith(t => { // Copy the task result into the returned task. if (t.IsFaulted) { tcs.TrySetException(t.Exception.InnerExceptions); } else if (t.IsCanceled) { tcs.TrySetCanceled(); } else { tcs.TrySetResult(t.Result); } // Invoke the user callback if necessary. if (callback != null) { callback(tcs.Task); } }); return(tcs.Task); #endif }
// // Summary: // Begins the process for displaying the storage device selector user interface, // and for specifying the size of the data to be written to the storage device // and the callback implemented when the player chooses a device. Reference // page contains links to related code samples. // // Parameters: // sizeInBytes: // The size, in bytes, of data to write to the storage device. // // directoryCount: // The number of directories to write to the storage device. // // callback: // An AsyncCallback that represents the method called when the player chooses // a device. // // state: // A user-created object used to uniquely identify the request, or null. public static IAsyncResult BeginShowSelector (int sizeInBytes, int directoryCount, AsyncCallback callback, object state) { var del = new ShowSelectorAsynchronousShowNoPlayer (Show); #if WINRT showDelegate = del; #endif return del.BeginInvoke(sizeInBytes, directoryCount, callback, state); }
// // Summary: // Begins the process for displaying the storage device selector user interface, // and for specifying the size of the data to be written to the storage device // and the callback implemented when the player chooses a device. Reference // page contains links to related code samples. // // Parameters: // sizeInBytes: // The size, in bytes, of data to write to the storage device. // // directoryCount: // The number of directories to write to the storage device. // // callback: // An AsyncCallback that represents the method called when the player chooses // a device. // // state: // A user-created object used to uniquely identify the request, or null. public static IAsyncResult BeginShowSelector (int sizeInBytes, int directoryCount, AsyncCallback callback, object state) { #if !WINDOWS_PHONE81 && !ANDROID && !IOS && !NETFX_CORE && !WINDOWS_PHONE var del = new ShowSelectorAsynchronousShowNoPlayer (Show); #if WINRT showDelegate = del; #endif return del.BeginInvoke(sizeInBytes, directoryCount, callback, state); #else var tcs = new TaskCompletionSource<StorageDevice>(state); var task = Task.Run<StorageDevice>(() => Show (sizeInBytes, directoryCount)); task.ContinueWith(t => { // Copy the task result into the returned task. if (t.IsFaulted) tcs.TrySetException(t.Exception.InnerExceptions); else if (t.IsCanceled) tcs.TrySetCanceled(); else tcs.TrySetResult(t.Result); // Invoke the user callback if necessary. if (callback != null) callback(tcs.Task); }); return tcs.Task; #endif }