Esempio n. 1
0
 private static IAsyncResult ShowSelector(PlayerIndex?player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state)
 {
     try {
         ShowSelectorAsynchronousShow AsynchronousShow = new ShowSelectorAsynchronousShow(Show);
         return(AsynchronousShow.BeginInvoke(player, sizeInBytes, directoryCount, callback, state));
     } finally {
     }
 }
Esempio n. 2
0
        //
        // Summary:
        //     Begins the process for displaying the storage device selector user interface,
        //     for specifying the player who requested the save operation, for setting the
        //     size of data to be written to the storage device, and for naming the callback
        //     implemented when the player chooses a device. Reference page contains links
        //     to related code samples.
        //
        // Parameters:
        //   player:
        //     The PlayerIndex that represents the player who requested the save operation.
        //     On Windows, the only valid option is PlayerIndex.One.
        //
        //   sizeInBytes:
        //     The size, in bytes, of the 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(PlayerIndex player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state)
        {
            var del = new ShowSelectorAsynchronousShow(Show);

#if WINRT
            showDelegate = del;
#endif
            return(del.BeginInvoke(player, sizeInBytes, directoryCount, callback, state));
        }
Esempio n. 3
0
        //
        // Summary:
        //     Begins the process for displaying the storage device selector user interface,
        //     for specifying the player who requested the save operation, for setting the
        //     size of data to be written to the storage device, and for naming the callback
        //     implemented when the player chooses a device. Reference page contains links
        //     to related code samples.
        //
        // Parameters:
        //   player:
        //     The PlayerIndex that represents the player who requested the save operation.
        //     On Windows, the only valid option is PlayerIndex.One.
        //
        //   sizeInBytes:
        //     The size, in bytes, of the 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(PlayerIndex player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state)
        {
#if !WINDOWS_PHONE81 && !ANDROID && !IOS && !NETFX_CORE && !WINDOWS_PHONE
            var del = new ShowSelectorAsynchronousShow(Show);
#if WINRT
            showDelegate = del;
#endif
            return(del.BeginInvoke(player, sizeInBytes, directoryCount, callback, state));
#else
            var tcs  = new TaskCompletionSource <StorageDevice>(state);
            var task = Task.Run <StorageDevice>(() => Show(player, 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
        }
Esempio n. 4
0
		//
		// Summary:
		//     Begins the process for displaying the storage device selector user interface,
		//     for specifying the player who requested the save operation, for setting the
		//     size of data to be written to the storage device, and for naming the callback
		//     implemented when the player chooses a device. Reference page contains links
		//     to related code samples.
		//
		// Parameters:
		//   player:
		//     The PlayerIndex that represents the player who requested the save operation.
		//     On Windows, the only valid option is PlayerIndex.One.
		//
		//   sizeInBytes:
		//     The size, in bytes, of the 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 (PlayerIndex player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state)
		{
			var del = new ShowSelectorAsynchronousShow (Show);
#if WINRT
            showDelegate = del;
#endif
            return del.BeginInvoke(player, sizeInBytes, directoryCount, callback, state);
        }
Esempio n. 5
0
 private static IAsyncResult ShowSelector(PlayerIndex? player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state)
 {
     try {
         ShowSelectorAsynchronousShow AsynchronousShow = new ShowSelectorAsynchronousShow (Show);
         return AsynchronousShow.BeginInvoke (player, sizeInBytes, directoryCount, callback, state);
     } finally {
     }
 }
Esempio n. 6
0
		//
		// Summary:
		//     Begins the process for displaying the storage device selector user interface,
		//     for specifying the player who requested the save operation, for setting the
		//     size of data to be written to the storage device, and for naming the callback
		//     implemented when the player chooses a device. Reference page contains links
		//     to related code samples.
		//
		// Parameters:
		//   player:
		//     The PlayerIndex that represents the player who requested the save operation.
		//     On Windows, the only valid option is PlayerIndex.One.
		//
		//   sizeInBytes:
		//     The size, in bytes, of the 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 (PlayerIndex player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state)
		{
#if !WINDOWS_PHONE81 && !ANDROID && !IOS && !NETFX_CORE && !WINDOWS_PHONE
            var del = new ShowSelectorAsynchronousShow (Show);
#if WINRT
            showDelegate = del;
#endif
            return del.BeginInvoke(player, sizeInBytes, directoryCount, callback, state);
#else
            var tcs = new TaskCompletionSource<StorageDevice>(state);
            var task = Task.Run<StorageDevice>(() => Show(player, 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
        }