mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Fix crash in GIF window when a GIF isn't set
This commit is contained in:
@@ -19,25 +19,25 @@ namespace Squirrel.Update
|
||||
{
|
||||
public AnimatedGifWindow()
|
||||
{
|
||||
var src = new BitmapImage();
|
||||
src.BeginInit();
|
||||
var img = new Image();
|
||||
var src = default(BitmapImage);
|
||||
|
||||
var source = Path.Combine(
|
||||
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
|
||||
"background.gif");
|
||||
|
||||
if (File.Exists(source)) {
|
||||
src = new BitmapImage();
|
||||
src.BeginInit();
|
||||
src.StreamSource = File.OpenRead(source);
|
||||
src.EndInit();
|
||||
|
||||
ImageBehavior.SetAnimatedSource(img, src);
|
||||
this.Content = img;
|
||||
this.Width = src.Width;
|
||||
this.Height = src.Height;
|
||||
}
|
||||
|
||||
src.EndInit();
|
||||
|
||||
var img = new Image();
|
||||
ImageBehavior.SetAnimatedSource(img, src);
|
||||
|
||||
this.Content = img;
|
||||
this.Width = src.Width;
|
||||
this.Height = src.Height;
|
||||
this.AllowsTransparency = true;
|
||||
this.WindowStyle = WindowStyle.None;
|
||||
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
|
||||
Reference in New Issue
Block a user