当前位置: 首页>>代码示例>>C#>>正文


C# BindableCollection.Match方法代码示例

本文整理汇总了C#中BindableCollection.Match方法的典型用法代码示例。如果您正苦于以下问题:C# BindableCollection.Match方法的具体用法?C# BindableCollection.Match怎么用?C# BindableCollection.Match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BindableCollection的用法示例。


在下文中一共展示了BindableCollection.Match方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TrialsListModel

        public TrialsListModel()
        {
            Trials = new BindableCollection<Trial>(new PrimaryKeyComparer<Trial>(x => x.Id));

            Search = GetQueryParam("search");

            RavenQueryStatistics stats;
            var query = Session.Query<Trials_Search.ReduceResult>("Trials/Search")
                .Statistics(out stats)
                .Skip(Paging.PageNumber * ItemsPerPage)
                .Take(ItemsPerPage);

            if (string.IsNullOrEmpty(Search) == false)
            {
                query = query

                    .Where(x => x.Query == Search);
            }

            query
                .OrderByDescending(x => x.StartedAt)
                .As<Trial>()
                .ToListAsync()
                .ContinueOnSuccess(trials =>
                {
                    Trials.Match(trials);
                    Paging.NumberOfItems.Value = stats.TotalResults;
                    Paging.NumberOfPages.Value = Paging.NumberOfItems.Value / ItemsPerPage;
                });
        }
开发者ID:DanielDar,项目名称:Orders,代码行数:30,代码来源:TrialsListModel.cs

示例2: HomeListModel

        public HomeListModel()
        {
            string date = GetQueryParam("date");

            if (date == null)
                LookAtDate = DateTime.Today;
            else
            {
                int year, month;
                int.TryParse(date.Substring(6, 4), out year);
                int.TryParse(date.Substring(3, 2), out month);
                LookAtDate = new DateTime(year, month, 1);
            }

            ProductStats =
                new BindableCollection<Products_Stats.ReduceResult>(
                    new PrimaryKeyComparer<Products_Stats.ReduceResult>(
                        x => Tuple.Create(x.Year, x.Month, x.Total.Currency, x.ProductId)));

            Session.Query<Products_Stats.ReduceResult>("Products/Stats")
                .Where(x => x.Year == LookAtDate.Year && x.Month == LookAtDate.Month)
                .ToListAsync()
                .ContinueOnSuccess(items => ProductStats.Match(items));

            OrderStatsUsd = new BindableCollection<Orders_Stats.ReduceResult>(
                    new PrimaryKeyComparer<Orders_Stats.ReduceResult>(
                        x => Tuple.Create(x.Date, x.Currency)));

            OrderStatsEuro =
                new BindableCollection<Orders_Stats.ReduceResult>(
                    new PrimaryKeyComparer<Orders_Stats.ReduceResult>(
                        x => Tuple.Create(x.Date, x.Currency)));

            DateTime yearBack = LookAtDate.AddYears(-1);

            Session.Query<Orders_Stats.ReduceResult>("Orders/Stats")
                .Where(x => x.Date >= yearBack && x.Date < LookAtDate && x.Currency == "EUR")
                .ToListAsync()
                .ContinueOnSuccess(items => OrderStatsEuro.Match(items));

            Session.Query<Orders_Stats.ReduceResult>("Orders/Stats")
                 .Where(x => x.Date >= yearBack && x.Date < LookAtDate && x.Currency == "USD")
                .ToListAsync()
                .ContinueOnSuccess(items => OrderStatsUsd.Match(items));
        }
开发者ID:DanielDar,项目名称:Orders,代码行数:45,代码来源:HomeListModel.cs

示例3: ProductsListModel

 public ProductsListModel()
 {
     Products = new BindableCollection<Product>(new PrimaryKeyComparer<Product>(x => x.Id));
     Session.Query<Product>().ToListAsync()
         .ContinueOnSuccess(products => Products.Match(products));
 }
开发者ID:DanielDar,项目名称:Orders,代码行数:6,代码来源:ProductsListModel.cs


注:本文中的BindableCollection.Match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。