Skip to content

Commit

Permalink
添加:全屏提示窗口图片控件支持gif格式动图
Browse files Browse the repository at this point in the history
  • Loading branch information
abadgirlnoa committed Jan 22, 2021
1 parent 4254037 commit 7a09227
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Local/Project1.UI/Themes/Project1UIDesignItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
Visibility="{TemplateBinding ImageInputVisibility}"/>
<controls:Project1UIInput
Type="FileSelect"
ExtNames="jpg|*.jpg|png|*.png"
ExtNames="jpg|*.jpg|png|*.png|gif|*.gif"
x:Name="a123"
Width="auto"
Height="25"
Expand Down
3 changes: 3 additions & 0 deletions src/Local/ProjectEye/ProjectEye.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@
<PackageReference Include="System.Data.SQLite.Linq">
<Version>1.0.112.1</Version>
</PackageReference>
<PackageReference Include="WpfAnimatedGif">
<Version>2.0.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Resource Include="FodyWeavers.xml" />
Expand Down
2 changes: 1 addition & 1 deletion src/Local/ProjectEye/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.5")]
[assembly: AssemblyVersion("1.3.6")]
[assembly: AssemblyFileVersion("1.0.0.1")]
34 changes: 30 additions & 4 deletions src/Local/ProjectEye/ViewModels/TipViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using WpfAnimatedGif;

namespace ProjectEye.ViewModels
{
Expand Down Expand Up @@ -183,17 +185,41 @@ private void CreateUI()
imageElement.Height = element.Height;
imageElement.Opacity = element.Opacity;
imageElement.Stretch = Stretch.Fill;


try
{
//imageElement.Source = new BitmapImage(new Uri(element.Image, UriKind.RelativeOrAbsolute));
imageElement.Source = BitmapImager.Load(element.Image);

var image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(element.Image, UriKind.RelativeOrAbsolute);
image.EndInit();
ImageBehavior.SetAnimatedSource(imageElement, image);
}
catch
{
imageElement.Source = BitmapImager.Load("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png");
//imageElement.Source = new BitmapImage(new Uri("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png", UriKind.RelativeOrAbsolute));

}

//var imageElement = new Image();
//imageElement.HorizontalAlignment = HorizontalAlignment.Left;
//imageElement.VerticalAlignment = VerticalAlignment.Top;
//imageElement.RenderTransform = ttf;
//imageElement.Width = element.Width;
//imageElement.Height = element.Height;
//imageElement.Opacity = element.Opacity;
//imageElement.Stretch = Stretch.Fill;
//try
//{
// //imageElement.Source = new BitmapImage(new Uri(element.Image, UriKind.RelativeOrAbsolute));
// imageElement.Source = BitmapImager.Load(element.Image);

//}
//catch
//{
// imageElement.Source = BitmapImager.Load("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png");
// //imageElement.Source = new BitmapImage(new Uri("pack://application:,,,/Project1.UI;component/Assets/Images/sunglasses.png", UriKind.RelativeOrAbsolute));
//}
container.Children.Add(imageElement);
break;
}
Expand Down

0 comments on commit 7a09227

Please sign in to comment.