public MainWindow() { InitializeComponent(); var source = new InfiniteAsyncSource() { ElementType = typeof(SCIssuesDemo) }; source.FetchRows += (o, e) => e.Result = Task.Run(() => FetchRows(e)); autoSuggestEdit.ItemsSource = source; Closing += (o, e) => source.Dispose(); }
public MainWindow() { InitializeComponent(); var source = new InfiniteAsyncSource { ElementType = typeof(EntityFrameworkIssues.Issues.Issue), KeyProperty = nameof(EntityFrameworkIssues.Issues.Issue.Id) }; source.FetchRows += OnFetchRows; source.GetTotalSummaries += OnGetTotalSummaries; grid.ItemsSource = source; LoadLookupData(); }
void InitSource() { Items = new InfiniteAsyncSource() { ElementType = typeof(IssueData) }; Items.FetchRows += (o, e) => { e.Result = FetchRowsAsync(e); }; Items.GetUniqueValues += (o, e) => { e.Result = GetUniqueValuesAsync(e); }; Items.GetTotalSummaries += (o, e) => { e.Result = GetTotalSummariesAsync(e); }; }
public MainWindow() { InitializeComponent(); var source = new InfiniteAsyncSource() { ElementType = typeof(IssueData) }; Unloaded += (o, e) => { source.Dispose(); }; source.FetchRows += (o, e) => { e.Result = Task.Run(() => FetchRows(e)); }; grid.ItemsSource = source; }
public MainWindow() { InitializeComponent(); var source = new InfiniteAsyncSource() { ElementType = typeof(IssueData) }; Unloaded += (o, e) => { source.Dispose(); }; var getSourceTask = Task.Run(() => { return(Enumerable .Range(0, 10000000) .Select(i => OutlookDataGenerator.CreateIssue()) .ToList()); }); source.FetchRows += (o, e) => { e.Result = FetchRows(e, getSourceTask); }; source.GetTotalSummaries += (o, e) => { e.Result = GetTotalSummaries(e, getSourceTask); }; source.GetUniqueValues += (o, e) => { if (e.PropertyName == "Priority") { e.Result = Task.FromResult(Enum.GetValues(typeof(Priority)).Cast <object>().ToArray()); } else { throw new InvalidOperationException(); } }; grid.ItemsSource = source; }
public MainWindow() { InitializeComponent(); using (var session = new Session()) { var classInfo = session.GetClassInfo <XPOIssues.Issues.Issue>(); var properties = classInfo.Members .Where(member => member.IsPublic && member.IsPersistent) .Select(member => member.Name) .ToArray(); _DetachedObjectsHelper = DetachedObjectsHelper <XPOIssues.Issues.Issue> .Create(classInfo.KeyProperty.Name, properties); } var source = new InfiniteAsyncSource { CustomProperties = _DetachedObjectsHelper.Properties, KeyProperty = nameof(XPOIssues.Issues.Issue.Oid) }; source.FetchRows += OnFetchRows; source.GetTotalSummaries += OnGetTotalSummaries; grid.ItemsSource = source; LoadLookupData(); }
public MainWindow() { InitializeComponent(); var source = new InfiniteAsyncSource() { CustomProperties = GetCustomProperties() }; Unloaded += (o, e) => { source.Dispose(); }; source.FetchRows += (o, e) => { e.Result = FetchRowsAsync(e); }; source.GetUniqueValues += (o, e) => { e.Result = GetUniqueValuesAsync(e.PropertyName); }; grid.ItemsSource = source; }
public MainWindow() { InitializeComponent(); var source = new InfiniteAsyncSource() { ElementType = typeof(IssueData) }; Unloaded += (o, e) => { source.Dispose(); }; source.FetchRows += (o, e) => { e.Result = Task.Run(() => FetchRows(e)); }; source.GetUniqueValues += (o, e) => { if (e.PropertyName == "User") { e.ResultWithCounts = Task.Run(() => GetIssueDataQueryable().DistinctWithCounts(e.PropertyName)); } else { e.Result = Task.Run(() => GetIssueDataQueryable().Distinct(e.PropertyName)); } }; source.GetTotalSummaries += (o, e) => { e.Result = Task.Run(() => { var queryable = GetIssueDataQueryable() .Where(MakeFilterExpression(e.Filter)); return(queryable.GetSummaries(e.Summaries)); }); }; grid.ItemsSource = source; }
public MainWindow() { InitializeComponent(); var source = new InfiniteAsyncSource() { ElementType = typeof(IssueData), KeyProperty = "Id" }; Unloaded += (o, e) => { source.Dispose(); }; source.FetchRows += (o, e) => { e.Result = FetchRowsAsync(e); }; source.GetUniqueValues += (o, e) => { if (e.PropertyName == "Priority") { var values = Enum.GetValues(typeof(Priority)).Cast <object>().ToArray(); e.Result = Task.FromResult(values); } else { throw new InvalidOperationException(); } }; source.GetTotalSummaries += (o, e) => { e.Result = GetTotalSummariesAsync(e); }; grid.ItemsSource = source; }