diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 20:33:05 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 20:33:05 -0500 |
| commit | 767cdc1f6f6a63ce997fc9476911e2c361f9d402 (patch) | |
| tree | 49add55976f895441167c66cfa95e5c7688d18ce /MediaBrowser.Installer/Code/DownloadAnimation.xaml.cs | |
| parent | 845554722efaed872948a9e0f7202e3ef52f1b6e (diff) | |
Pushing missing changes
Diffstat (limited to 'MediaBrowser.Installer/Code/DownloadAnimation.xaml.cs')
| -rw-r--r-- | MediaBrowser.Installer/Code/DownloadAnimation.xaml.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/MediaBrowser.Installer/Code/DownloadAnimation.xaml.cs b/MediaBrowser.Installer/Code/DownloadAnimation.xaml.cs new file mode 100644 index 000000000..8fa890816 --- /dev/null +++ b/MediaBrowser.Installer/Code/DownloadAnimation.xaml.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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; +using System.Windows.Threading; + +namespace MediaBrowser.Installer.Code +{ + /// <summary> + /// Interaction logic for DownloadAnimation.xaml + /// </summary> + public partial class DownloadAnimation : UserControl + { + private int _i; + private readonly double _startPos; + private readonly DispatcherTimer _timer; + + public DownloadAnimation() + { + _i = 0; + InitializeComponent(); + + // Store start position of sliding canvas + _startPos = Canvas.GetLeft(SlidingCanvas); + + // Create animation timer + _timer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(100)}; + _timer.Tick += TimerTick; + } + + public void StartAnimation() + { + _timer.Start(); + } + + public void StopAnimation() + { + _timer.Stop(); + } + + private void TimerTick(object sender, EventArgs e) + { + _i++; + + if (_i < 16) + { + // Move SlidingCanvas containing the three colored dots 14 units to the right + Canvas.SetLeft(SlidingCanvas, Canvas.GetLeft(SlidingCanvas) + 14); + } + else + { + // Move SlidingCanvas back to its starting position and reset counter + _i = 0; + Canvas.SetLeft(SlidingCanvas, _startPos); + } + } + } +} |
