示例#1
0
        private TypeCount ToTypeCount(JToken instance)
        {
            TypeCount typeCount = new TypeCount
            {
                Type  = instance.Value <JObject>().Property("key").Value.ToString(),
                Count = Convert.ToInt32(instance.Value <JObject>().Property("doc_count").Value.ToString())
            };

            typeCount.ShortTypeName = typeCount.Type.GetShortTypeName();
            ContentType contentType = _contentTypeRepository.Load(typeCount.ShortTypeName);

            if (contentType != null)
            {
                typeCount.Name  = contentType.LocalizedName;
                typeCount.Group = contentType.LocalizedGroupName;
            }

            if (String.IsNullOrWhiteSpace(typeCount.Name))
            {
                typeCount.Name = typeCount.ShortTypeName;
            }

            if (String.IsNullOrWhiteSpace(typeCount.Group))
            {
                typeCount.Group = " " + LocalizationExtensions.TranslateWithPath("nocategory", "/epinovaelasticsearch/indexinspector/");
            }

            return(typeCount);
        }
示例#2
0
        static void Main(string[] args)
        {
            TypeCount typeCount = new TypeCount()
            {
                Name = null
            };

            ShowAllType();
            //Console.WriteLine(typeCount);
            WriteLine(Convert.ToString(10, 16));
            //typeCount.ShowAllType();
        }
示例#3
0
            public TypeCount FindByType(string type)
            {
                foreach (TypeCount t in this)
                {
                    if (t.mType == type)
                    {
                        return(t);
                    }
                }
                TypeCount obj = new TypeCount();

                obj.mType = type;
                Add(obj);
                return(obj);
            }
示例#4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RequestAPIManager manager = new RequestAPIManager();

            manager.getSomeTypeCount(2, 0).ContinueWith(t =>
            {
                TypeCount x = t.Result;
                if (x == null)
                {
                    MessageBox.Show("获取数据失败");
                    return;
                }
                Console.WriteLine("总共数量:" + x.count);
                x.data.ForEach(item => { Console.WriteLine(item.rm); });
            });
        }
示例#5
0
 public TypeCountViewModel(TypeCount typeCount)
 {
     _typeCount = typeCount;
 }