Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think as <a href="https://stackoverflow.com/users/1849109/sa-ddam213">sa-ddam213</a> have suggested and I too believe that you are executing a code block in background <a href="http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx" rel="nofollow noreferrer">Thread</a> or <a href="http://msdn.microsoft.com/en-us/library/system.threading.tasks.task.aspx" rel="nofollow noreferrer">Task</a>.</p> <p><strong>I think problem is that</strong><br> - On button click, start execution in background.<br> - You have kept a flag for checking if background process is running for <code>CanExecute()</code> for the Button's <code>Command</code>.<br> - UI checks <code>CanExecute()</code> for the Button's <code>Command</code> for a while then does not as mentioned in another question here - <a href="https://stackoverflow.com/questions/2281566/is-josh-smiths-implementation-of-the-relaycommand-flawed">Is Josh Smith's implementation of the RelayCommand flawed?</a>.<br> - Process returns in background.<br> - UI does not knows the background process is completed and as it has stopped checking the <code>CanExecute()</code> for the Button's <code>Command</code>, UI will not come to know itself.. (you need to tell it)<br> - Therefore UI is not responding but when user will click somewhere in the application or do an in-out as you said, it will back again.</p> <p><strong>Solution</strong><br> - By using <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.commandmanager.invalidaterequerysuggested.aspx" rel="nofollow noreferrer">InvalidateRequerySuggested</a> method you can invoke the command requery on UI thread so UI will recheck the <code>CanExecute()</code> for each <code>Control</code> and/or <code>Button</code> <code>Command</code>.</p> <pre><code>// Forcing the CommandManager to raise the RequerySuggested event CommandManager.InvalidateRequerySuggested(); </code></pre> <blockquote> <p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.commandmanager.invalidaterequerysuggested.aspx" rel="nofollow noreferrer">InvalidateRequerySuggested</a> method forces the <a href="http://msdn.microsoft.com/en-us/library/ms616838(v=vs.100).aspx" rel="nofollow noreferrer">CommandManager</a> to raise the RequerySuggested event. The RequerySuggested event informs a command source to query the command it is associated with to determine whether or not the command can execute.</p> </blockquote> <p>For more refer:<br> - <a href="https://stackoverflow.com/a/2764022/468718">How does CommandManager.RequerySuggested work?</a><br> - <a href="http://msdn.microsoft.com/en-us/library/ms616838(v=vs.100).aspx" rel="nofollow noreferrer">MSDN - CommandManager</a><br> - <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.commandmanager.invalidaterequerysuggested.aspx" rel="nofollow noreferrer">MSDN - CommandManager.InvalidateRequerySuggested Method</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload