サイズ:http://amazedsaint.blogspot.com/2010/10/asynchronous-delegate-command-for-your.htmlを試してみてください。あなたのメソッドのどれも非同期である必要がないので、あなたはAsync Commandを実行するだけです。
私はそう、私は以下のようにRaiseCanExecuteChanged()メソッド、呼び出すことができDelegateCommandを拡張するために、わずかにそれを編集した:
public class AsyncDelegateCommand : DelegateCommand, ICommand
{
BackgroundWorker _worker = new BackgroundWorker();
Func<bool> _canExecute;
/// <summary>
/// The constructor
/// </summary>
/// <param name="action">The action to be executed</param>
/// <param name="canExecute">Will be used to determine if the action can be executed</param>
/// <param name="completed">Will be invoked when the action is completed</param>
/// <param name="error">Will be invoked if the action throws an error</param>
public AsyncDelegateCommand(Action action,
Func<bool> canExecute = null,
Action<object> completed = null,
Action<Exception> error = null
) : base(action, canExecute)
{
...
}
}
希望助けます。
出典
2011-01-21 22:38:40
Ian
デレク、答えのおかげで、私が質問したとき、私はちょっとした瞬間を見せていました。今すぐ適切な場所に物を持っています。 – Rupert