title: Executing a command from another command
body: <p>I have a 'hello world' form (Xamarin forms) with some fields and a submit button. There's an observable (CanSave) which controls when the SaveChangesCommand can execute. If the save button is pressed when the CanSave is false, I want to a display a message to the user. </p>
  
  <p>With the code below, if I</p>
  
  <ol>
  <li>enter incorrect data</li>
  <li>click save (the error message shows) </li>
  <li>then correct the data.</li>
  </ol>
  
  <p>CanSave becomes true and SaveChangesCommand is executed - before the button is hit again. It's as though the previously blocked button press was queued until canExecute became true. </p>
  
  <p>What am I missing?</p>
  
  <p>Thanks :-)</p>
  
  <pre><code> public PersonalProfileModel()
      {
          this.SaveChangesCommand = ReactiveCommand.CreateAsyncTask(this.CanSave(),  message =&gt; this.doAllThings(message as string));
          this.ButtonClickedCommand = ReactiveCommand.Create(Observable.Return(true));
          this.ButtonClickedCommand.InvokeCommand(this.SaveChangesCommand);
          // ButtonClickedCommand.Subscribe(x =&gt; this.SaveChangesCommand.Execute("hello")); // tried this too
      }
  
      public ReactiveCommand&lt;object&gt; ButtonClickedCommand { get; set; }
      public ReactiveCommand&lt;string&gt; SaveChangesCommand;
  
      public IObservable&lt;bool&gt; CanSave()
      {
          var fieldsValid = this.WhenAnyValue(
              x =&gt; x.Name,
              x =&gt; x.Country,
              (f1, f2) =&gt;
                  f1 == "a"
                  &amp;&amp; f2 == "b");
          return fieldsValid;
      }
  
      public Task&lt;string&gt; doAllThings(string message)
      {
          var result = Task.Run(() =&gt;{return "hello " + message;});
          return result;
      }
  </code></pre>