How to display busy message on wpf screen

Hey, I have a Prism4 based WPF application. When doing slow operations, I want to show a busy screen. I will have a large number of screens, so I'm trying to create a single solution in the structure, and not add an indicator of employment on each screen.

These lengthy operations are performed in the background thread. This allows the user interface to be updated (good), but does not stop the user from using the user interface (bad). What I would like to do is to impose a control using a rotating set, and this control covers the whole screen (old HTML trick with DIV). When the application is busy, the control will display, thus blocking any further interaction, and also show the spinning thing.

To set this up, I thought I could just use the application screen on the canvas along with the spinning thing (with a large ZIndex), and then just make the spinning thing visible as needed.

This, however, is becoming more complicated. Canvases don't seem well tuned for this, and I think I could bark the wrong tree.

I would appreciate any help. Thank.

+5
source share
2 answers

I have done this with several programs. Here it is in a nutshell:

(This is easiest with MVVM. I havenโ€™t used the code for such things for so long, I canโ€™t say if there is a good way to do this.)

Edit:

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MainWindow"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480">

<Grid>

    <Border BorderBrush="Black" BorderThickness="1" Background="#80000000" Visibility="Collapsed">
        <Grid>
            <TextBlock Margin="0" TextWrapping="Wrap" Text="Busy...Please Wait" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="26.667" FontWeight="Bold" Foreground="#7EFFFFFF"/>
        </Grid>
    </Border>

    <DockPanel x:Name="LayoutRoot">
        <CheckBox Content="CheckBox" VerticalAlignment="Top"/>
        <TextBlock TextWrapping="Wrap"><Run Text="TextBlock"/></TextBlock>
        <UserControl x:Name="ViewViewView"/>
    </DockPanel>
</Grid>

+13

All Articles