Skip to content

Commit

Permalink
add loading animation
Browse files Browse the repository at this point in the history
  • Loading branch information
yysun committed Sep 11, 2011
1 parent 1509ecf commit 6786d50
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 4 deletions.
8 changes: 8 additions & 0 deletions BasicSccProvider.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
<Compile Include="UI\HistoryGraph.xaml.cs">
<DependentUpon>HistoryGraph.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Loading.xaml.cs">
<DependentUpon>Loading.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="HistoryToolWindow.resx">
Expand All @@ -170,6 +173,7 @@
</Content>
<Content Include="Resources\Images_24bit.bmp" />
<Content Include="Resources\Images_32bit.bmp" />
<Resource Include="Resources\Loading.png" />
<Content Include="Resources\SccGlyphs.bmp" />
<Content Include="solution explorer.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down Expand Up @@ -226,6 +230,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Loading.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="DiffClassifier\DiffClassifier.csproj">
Expand Down
Binary file added Resources/Loading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions UI/HistoryGraph.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<UserControl x:Class="GitScc.UI.HistoryGraph"
<UserControl xmlns:my1="clr-namespace:GitScc.UI" xmlns:my="clr-namespace:GitScc" x:Class="GitScc.UI.HistoryGraph"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="600">

<ScrollViewer x:Name="scrollRoot"
<Grid>
<ScrollViewer x:Name="scrollRoot"
VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible"
PreviewMouseWheel="scrollRoot_PreviewMouseWheel">
<Canvas x:Name="canvasRoot" Background="White">
Expand All @@ -20,6 +20,9 @@
</TransformGroup>
</Canvas.RenderTransform>
</Canvas>

</Canvas>
</ScrollViewer>
<my1:Loading x:Name="loading" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed" />
</Grid>
</UserControl>
5 changes: 4 additions & 1 deletion UI/HistoryGraph.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ internal void Show(GitFileStatusTracker tracker)
this.tracker = tracker;
if (tracker == null) return;

loading.Visibility = Visibility.Visible;
var dispatcher = Dispatcher.CurrentDispatcher;

Action act = () =>
{
this.tracker.RepositoryGraph.IsSimplified = showSimplifiedGraph;
Expand Down Expand Up @@ -270,8 +272,9 @@ internal void Show(GitFileStatusTracker tracker)
AdjustCanvasSize();

this.scrollRoot.ScrollToRightEnd();
};

loading.Visibility = Visibility.Collapsed;
};
dispatcher.BeginInvoke(act, DispatcherPriority.ApplicationIdle);
}

Expand Down
31 changes: 31 additions & 0 deletions UI/Loading.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<UserControl x:Class="GitScc.UI.Loading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="80" d:DesignWidth="280">
<Border Background="#84000000" CornerRadius="10" Height="80" Width="260">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
<Canvas Width="32" Height="32" Margin="10">
<Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="360" RepeatBehavior="Forever"
Storyboard.TargetName="spin" Storyboard.TargetProperty="(RotateTransform.Angle)" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
<Canvas.RenderTransform>
<RotateTransform x:Name="spin" Angle="0" CenterX="16" CenterY="16" />
</Canvas.RenderTransform>
<Image Source="/GitSccProvider;component/Resources/Loading.png" Width="32" Height="32" />
</Canvas>

<TextBlock Text="Analyzing Git repository ..." FontSize="12" Foreground="White" VerticalAlignment="Center" />

</StackPanel>
</Border>
</UserControl>
27 changes: 27 additions & 0 deletions UI/Loading.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GitScc.UI
{
/// <summary>
/// Interaction logic for Loading.xaml
/// </summary>
public partial class Loading : UserControl
{
public Loading()
{
InitializeComponent();
}
}
}

0 comments on commit 6786d50

Please sign in to comment.