Exemplo n.º 1
0
 private void LoadBackground()
 {
     if (File.Exists(Session.LoginStaticPath) && BackStatic.Source == null)
     {
         var image = new BitmapImage();
         image.BeginInit();
         image.CacheOption = BitmapCacheOption.OnLoad;
         image.UriSource   = new Uri(Session.LoginStaticPath);
         image.EndInit();
         BackStatic.Source = image;
     }
     if (File.Exists(Session.LoginVideoPath) && BackAnim.Source == null)
     {
         BackAnim.Source = new Uri(Session.LoginVideoPath);
     }
     BackAnim.Play();
 }
Exemplo n.º 2
0
 private void VideoLoop()
 {
     try {
         while (true)
         {
             var duration = Dispatcher.Invoke(() => {
                 int diff = (int)(BackAnim.NaturalDuration.TimeSpan.TotalMilliseconds - BackAnim.Position.TotalMilliseconds);
                 if (diff < 100)
                 {
                     BackAnim.Position = TimeSpan.FromSeconds(0);
                     BackAnim.Play();
                 }
                 else if (diff < 2000)
                 {
                     return(diff - 50);
                 }
                 return(2000);
             });
             Thread.Sleep(duration);
         }
     } catch { }
 }