Quantcast
Channel: psappdeploytoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1769

New Post: Progress bar rather than spinning icon?

$
0
0
PowerSheller wrote:
I understand what is being requested here. Actually we had a progress bar originally, but the built-in WPF indeterminate (marquee) progress bar doesn't let you control the speed of the animation and we weren't quite happy with it - it goes at different speeds depending on the OS or .NET version (can't remember which).

Here is a mock-up so you can test it for yourself - I think you'll agree it's not quite as elegant or as smooth as the one you'd be familiar with from Windows forms - that was the reason we went with the ellipse instead. The ellipse is almost the standard for indeterminate progress indicators these days.

If you can code or source the code for a smoother animation than this (preferably in pure XAML), we can look to integrate it.
#Build the GUI
[xml]$xaml = @"
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Name="Window" Title="Initial Window" WindowStartupLocation = "CenterScreen" 
    Width = "400" Height = "200" ShowInTaskbar = "True">
    <ProgressBar x:Name="progressBar1" IsIndeterminate="True" Maximum="100" Height="20" Width="300" /> 
</Window>
"@ 

$reader=(New-Object System.Xml.XmlNodeReader $xaml)
$Window=[Windows.Markup.XamlReader]::Load( $reader )

$Window.ShowDialog()

With a little finagling I finally got it to work.
<Window

      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

      Name="Window" Title="" Background="WhiteSmoke"

      MaxHeight="224" MinHeight="224" Height="224"

      MaxWidth="449" MinWidth="449" Width="449" Padding="0,0,0,0" Margin="0,0,0,0"

      WindowStartupLocation = "Manual"

      Top=""

      Left=""

      TopMost=""

      ResizeMode="NoResize"

      Icon=""

      ShowInTaskbar="True" >

    <Window.Resources>

    <Storyboard x:Key="Storyboard1" RepeatBehavior="Forever"/>

    </Window.Resources>

    <Window.Triggers>

    <EventTrigger RoutedEvent="FrameworkElement.Loaded">

        <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>

    </EventTrigger>

    </Window.Triggers>

    <Grid >

    <Grid.RowDefinitions>

        <RowDefinition Height="Auto" />

        <RowDefinition Height="*" />

        <RowDefinition Height="Auto" />

    </Grid.RowDefinitions>

    <Label Padding="0" Grid.Row="0">

        <Label.Background>

        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

            <GradientStop Color="#FF33CCFF" Offset="0" />

            <GradientStop Color="#FF333DFF" Offset="1" />

        </LinearGradientBrush>

        </Label.Background>

    </Label>

    <Image x:Name = "ProgressBanner" Grid.ColumnSpan="2" Margin="0,0,0,0" Source=""></Image>

    <TextBlock x:Name = "ProgressText" Grid.Row="1" Grid.Column="1" Margin="0,5,45,10" Text="" FontSize="15" FontFamily="Microsoft Sans Serif" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Padding="15" TextWrapping="Wrap"></TextBlock>

    <Grid Grid.Row="2" Margin="0,0,0,5">

        <Grid.ColumnDefinitions>

        <ColumnDefinition Width="1*" />

        <ColumnDefinition Width="2*" />

        <ColumnDefinition Width="1*" />

        </Grid.ColumnDefinitions>

        <ProgressBar Grid.Column="1" x:Name="progressBar1" IsIndeterminate="True" Margin="0,10,0,5" Maximum="100" Height="25" RenderTransformOrigin="0.493,3.8"/>

    </Grid>

    </Grid>

</Window>
I end up with the "Function Show-InstallationProgress {}" with a marquee progress bar instead of the Ellipse (below) After my modifications to the xaml code above.

Marquee Progress

Viewing all articles
Browse latest Browse all 1769

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>