跳到主要内容

github/tai

公开

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

浏览文件

GetCountConverter.cs

28 行 · 840 B历史下载
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Globalization;
5using System.Linq;
6using System.Text;
7using System.Threading.Tasks;
8using System.Windows.Data;
9using System.Windows.Media;
10
11namespace UI.Controls.Converters
12{
13 [ValueConversion(typeof(object), typeof(string))]
14 public class GetCountConverter : IValueConverter
15 {
16 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
17 {
18 if (value == null) return "0";
19 var list = value as IEnumerable<object>;
20 return list == null ? "0" : list.Count().ToString();
21 }
22
23 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
24 {
25 throw new NotImplementedException();
26 }
27 }
28}