segunda-feira, 2 de maio de 2016

Wpf.BusyIndicatorEasy - Sample



Source-code https://github.com/leonardomelosantos/Wpf.BusyIndicatorEasy
Nuget package https://www.nuget.org/packages/Wpf.BusyIndicatorEasy/


XAML code

<Window x:Class="MyApplication.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:busyIndicatorEasy="clr-namespace:Wpf.BusyIndicatorEasy;assembly=Wpf.BusyIndicatorEasy"
        Title="MainWindow" Height="424.403" Width="710.97">
    
    <busyIndicatorEasy:BusyIndicator x:Name="MyBusyIndicator" 
        BusyContent="Loading" MinValue="0" MaxValue="100" 
        MouseDoubleClick="MyBusyIndicator_OnMouseDoubleClick">
    <StackPanel HorizontalAlignment="Center" Height="Auto" 
        VerticalAlignment="Top" Width="Auto" Orientation="Vertical">
        <TabControl Height="378" Margin="0,10,0,0" Width="682">
            <TabItem Header="My screen">
                <StackPanel Orientation="Vertical">
                    <Canvas Height="160"></Canvas>
                    <TabControl Height="167" Margin="10,10,10,0"
                    Width="Auto">
                        <TabItem Header="TabItem">
                            <Canvas>
                                <Button Content="Indeterminate"
                                    Canvas.Left="534"
                                    Canvas.Top="94" Width="100" 
                                    Click="Button_Click_1"/>
                                <Button Content="Progress"
                                    Canvas.Left="534" 
                                    Canvas.Top="67" Width="100" 
                                    Click="Button_Click"/>
                                </Canvas>
                        </TabItem>
                        <TabItem Header="TabItem">
                            <Canvas></Canvas>
                        </TabItem>
                    </TabControl>
                </StackPanel>
            </TabItem>
        </TabControl>
    </StackPanel>
    </busyIndicatorEasy:BusyIndicator>
</Window>


Backend code (C#)

private void Button_Click(object sender, RoutedEventArgs e)
{
    // With progress
    MyBusyIndicator.BusyContent="My text progress... (double click to close me)";
    MyBusyIndicator.IsIndeterminate = false;
    MyBusyIndicator.CurrentProgressValue = (DateTime.Now.Second/60.00)*100;
    MyBusyIndicator.IsBusy = true;
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
    // Indeterminate
    MyBusyIndicator.BusyContent="Indeterminate... (double click to close me)";
    MyBusyIndicator.IsIndeterminate = true;
    MyBusyIndicator.IsBusy = true;
}

private void MyBusyIndicator_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
    // How to hide BusyIndicator
    MyBusyIndicator.IsBusy = false;
}





Você sabe o que é Lottie no que diz respeito ao mundo das aplicações para Windows?

Lottie-Windows is a library for rendering Adobe AfterEffects animations natively in your applications. This project adds Windows to the Lot...