I have a basic dialog box that allows users to enter some information. When they click the AddButton button, the application checks the user information and displays a message if the operation failed. Next to the button, which is initially hidden, there is a static label. When the button is pressed, the mark becomes visible before , the confirmation operation begins and again becomes invisible after . Please note that this verification operation is performed on a remote machine, so the user interface freezes during this time (by design).
Here is the XAML code:
<Label Name="lblStatus" Content="Verifying connection..." Visibility="Hidden" Grid.Column="0" /> <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> <Button Content="Add" Width="80" Margin="0,0,5,0" Click="AddButton_Click"/> <Button Content="Cancel" Width="80" IsCancel="True"/> </StackPanel>
And the code:
private void AddButton_Click(object sender, RoutedEventArgs e) { lblStatus.Visibility = Visibility.Visible;
The problem is that when you click the button, the shortcut becomes invisible before the user interface freezes. When the operation fails, a pop-up dialog box appears. At this point, you see a shortcut, but this happens when the user interface wakes up. This makes me think that the user interface does not have enough time for reprocessing labile by the time foo.Validate() called. I was wondering if my theory is right or wrong, and what would be the “right” way to do this?
source share