Пример #1
0
 async void CommandResultCallback(Command command)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         lock (commandsObservable)
         {
             foreach (Command cmd in CommandsObservable)
             {
                 if (command.Id == command.Id)
                 {
                     // Command class doesn't implement INotifyPropertyChanded to update its result,
                     // so old command is replaced by command with result:
                     var index = commandsObservable.IndexOf(cmd);
                     commandsObservable.RemoveAt(index);
                     commandsObservable.Insert(index, command);
                     break;
                 }
             }
         }
     });
 }