跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

提交记录
修改UI/Controls/Base/Img.cs+24 −10看文件
@@ -33,6 +33,17 @@ namespace UI.Controls.Base
3333 typeof(CornerRadius),
3434 typeof(Img));
3535
36新增: public string Src
37新增: {
38新增: get { return (string)GetValue(SrcProperty); }
39新增: set { SetValue(SrcProperty, value); }
40新增: }
41新增: public static readonly DependencyProperty SrcProperty =
42新增: DependencyProperty.Register("Src",
43新增: typeof(string),
44新增: typeof(Img), new PropertyMetadata("pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png", new PropertyChangedCallback(OnPropertyChanged)));
45新增:
46新增:
3647
3748 /// <summary>
3849 /// 图片链接
@@ -50,29 +61,32 @@ namespace UI.Controls.Base
5061 private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
5162 {
5263 var control = (d as Img);
53删除: if (e.Property == URLProperty && e.OldValue != e.NewValue)
64新增: if (e.Property == URLProperty && e.OldValue != e.NewValue && e.NewValue != null)
5465 {
55删除: control.Handle();
66新增: control.Handle(e.NewValue.ToString());
5667 }
5768 }
58删除:
69新增:
5970 public Img()
6071 {
6172 DefaultStyleKey = typeof(Img);
62删除:
6373 }
6474
65删除: private void Handle()
75新增: private void Handle(string path)
6676 {
67删除: if (URL != null && URL.Length > 8 && URL.Substring(0, 8) == "AppIcons")
77新增: if (path != null && path.Length > 8 && path.Substring(0, 8) == "AppIcons")
6878 {
69删除: URL = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, URL);
79新增: Src = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
7080 }
71删除: if (URL == null || (URL.IndexOf("pack://") == -1 && !File.Exists(URL)))
81新增: else if (path == null || (path.IndexOf("pack://") == -1 && !File.Exists(path)))
7282 {
73删除: URL = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png";
83新增: Src = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png";
84新增: }
85新增: else
86新增: {
87新增: Src = path;
7488 }
7589 }
76删除:
90新增:
7791 }
7892}
修改UI/Themes/Base/Img.xaml+1 −1看文件
@@ -20,7 +20,7 @@
2020
2121 <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" CornerRadius="{TemplateBinding Radius}">
2222 <Border.Background>
23删除: <ImageBrush Stretch="Fill" x:Name="image" ImageSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Img}}, Path=URL}"/>
23新增: <ImageBrush Stretch="Fill" x:Name="image" ImageSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Img}}, Path=Src}"/>
2424 </Border.Background>
2525 </Border>
2626