在Windows Phone RT / 10中运行任务时如何阻止屏幕?

时间:2015-08-20 20:08:00

标签: windows windows-phone windows-10

我正在为Windows 10创建一个应用程序,我想知道,在点击按钮后如何在执行任务时锁定屏幕?

  private void UxBtnProximo_Click(object sender, RoutedEventArgs e)
    {
        if (dia > 0)
        {
            dia -= 1;
            DefinePapelParede();
        }

        if(dia == 0)
        {
            UxBtnProximo.Visibility = Visibility.Collapsed;
        }
        else
        {
            UxBtnProximo.Visibility = Visibility.Visible;
        }
    }

Datail,按钮位于一个框架中而不在屏幕中

<SplitView.Content>

        <Frame x:Name="UxFrmPrincipal">
            <Frame.ContentTransitions>
                <TransitionCollection>
                    <NavigationThemeTransition>
                        <NavigationThemeTransition.DefaultNavigationTransitionInfo>
                            <EntranceNavigationTransitionInfo/>
                        </NavigationThemeTransition.DefaultNavigationTransitionInfo>
                    </NavigationThemeTransition>
                </TransitionCollection>
            </Frame.ContentTransitions>
        </Frame>

    </SplitView.Content>

这里是这个框架的页面

<Grid x:Name="PrincipalGrid">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="250"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="100"></RowDefinition>

            </Grid.RowDefinitions>


            <StackPanel Grid.Row="0">
            </StackPanel>
            <StackPanel Grid.Row="1">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="100"></RowDefinition>
                    </Grid.RowDefinitions>

                    <StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0">
                        <Button x:Name="UxBtnAnterior" FontSize="60" FontFamily="Segoe MDL2 Assets" Content="&#xE96F;" Foreground="White" Background="Transparent"></Button>
                    </StackPanel>

                    <StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="0" Grid.Column="2">
                        <Button x:Name="UxBtnProximo" FontFamily="Segoe MDL2 Assets" FontSize="60" Content="&#xE970;" Foreground="White" Background="Transparent"></Button>
                    </StackPanel>
                </Grid>

            </StackPanel>

            <StackPanel Grid.Row="2" Background="#66000000" VerticalAlignment="Center" HorizontalAlignment="Center">
                <Button x:Name="UxBtnSetWallPaper" FontSize="50" Foreground="#FFFFFF" Content="Aplicar"></Button>
            </StackPanel>

            <Popup IsOpen="True" x:Name="UxPopCarregando">
                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" UseLayoutRounding="True">
                    <StackPanel  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" UseLayoutRounding="True">
                        <ProgressRing Height="200" Width="200" UseLayoutRounding="True" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gray">
                    </ProgressRing>
                </StackPanel>
                </Grid>
            </Popup>


        </Grid>

我试过弹出窗口,但不行,我可能用错了。帮助!

1 个答案:

答案 0 :(得分:0)

这可以通过页面上的简单叠加轻松完成

<Page>
    <Grid>
        <!-- regular content here -->
    <Grid x:Name="BlockIt" Visibility="Collapsed" Background="#55ffffff"/>
</Page>

如果要停止用户互动,请更改BlockIt网格

的可见性
BlockIt.Visibility = Visibility.Visible;