|
14 | 14 | using System.Windows.Documents; |
15 | 15 | using System.Windows.Input; |
16 | 16 | using System.Windows.Media; |
| 17 | +using System.Windows.Media.Imaging; |
| 18 | +using WpfAnimatedGif; |
17 | 19 |
|
18 | 20 | namespace ProjectEye.ViewModels |
19 | 21 | { |
@@ -183,17 +185,41 @@ private void CreateUI() |
183 | 185 | imageElement.Height = element.Height; |
184 | 186 | imageElement.Opacity = element.Opacity; |
185 | 187 | imageElement.Stretch = Stretch.Fill; |
| 188 | + |
| 189 | + |
186 | 190 | try |
187 | 191 | { |
188 | | - //imageElement.Source = new BitmapImage(new Uri(element.Image, UriKind.RelativeOrAbsolute)); |
189 | | - imageElement.Source = BitmapImager.Load(element.Image); |
190 | | - |
| 192 | + var image = new BitmapImage(); |
| 193 | + image.BeginInit(); |
| 194 | + image.UriSource = new Uri(element.Image, UriKind.RelativeOrAbsolute); |
| 195 | + image.EndInit(); |
| 196 | + ImageBehavior.SetAnimatedSource(imageElement, image); |
191 | 197 | } |
192 | 198 | catch |
193 | 199 | { |
194 | 200 | imageElement.Source = BitmapImager.Load("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png"); |
195 | | - //imageElement.Source = new BitmapImage(new Uri("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png", UriKind.RelativeOrAbsolute)); |
| 201 | + |
196 | 202 | } |
| 203 | + |
| 204 | + //var imageElement = new Image(); |
| 205 | + //imageElement.HorizontalAlignment = HorizontalAlignment.Left; |
| 206 | + //imageElement.VerticalAlignment = VerticalAlignment.Top; |
| 207 | + //imageElement.RenderTransform = ttf; |
| 208 | + //imageElement.Width = element.Width; |
| 209 | + //imageElement.Height = element.Height; |
| 210 | + //imageElement.Opacity = element.Opacity; |
| 211 | + //imageElement.Stretch = Stretch.Fill; |
| 212 | + //try |
| 213 | + //{ |
| 214 | + // //imageElement.Source = new BitmapImage(new Uri(element.Image, UriKind.RelativeOrAbsolute)); |
| 215 | + // imageElement.Source = BitmapImager.Load(element.Image); |
| 216 | + |
| 217 | + //} |
| 218 | + //catch |
| 219 | + //{ |
| 220 | + // imageElement.Source = BitmapImager.Load("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png"); |
| 221 | + // //imageElement.Source = new BitmapImage(new Uri("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png", UriKind.RelativeOrAbsolute)); |
| 222 | + //} |
197 | 223 | container.Children.Add(imageElement); |
198 | 224 | break; |
199 | 225 | } |
|
0 commit comments