diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml
index f8cb0c9..2a1e66c 100644
--- a/.github/workflows/vale.yml
+++ b/.github/workflows/vale.yml
@@ -21,10 +21,31 @@ jobs:
ssh-key: ${{ secrets.VALE_STYLES_ACCESS_KEY }}
- name: copy vale rules to the root repo
run: shopt -s dotglob && cp -r ./vale-styles/vale/* .
+
+ - name: detect README file
+ id: detect
+ shell: bash
+ run: |
+ set -euo pipefail
+
+ found="$(find . -maxdepth 1 -type f -iname 'readme.md' -print | head -n 1 || true)"
+
+ if [[ -z "$found" ]]; then
+ echo "No README.md found in repo root. Nothing to lint."
+ echo "files=[]" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+
+ found="${found#./}"
+
+ echo "Found README: $found"
+ echo "files=[\"$found\"]" >> "$GITHUB_OUTPUT"
+
- name: vale linter check
+ if: steps.detect.outputs.files != '[]'
uses: DevExpress/vale-action@reviewdog
with:
- files: '["[Rr]eadme.md"]'
+ files: ${{ steps.detect.outputs.files }}
fail_on_error: true
filter_mode: nofilter
reporter: github-check
\ No newline at end of file
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 0000000..a88e69e
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1 @@
+* @DevExpressExampleBot
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index f1900ef..7536adc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
This code example is provided "as is" without warranty of any kind. Developer Express Inc ("DevExpress") disclaims all warranties,
either express or implied, including the warranties of merchantability and fitness for a particular purpose.
-For licensing terms and conditions of DevExpress product(s) required for, or associated with the use of this code example,
-please refer to the applicable End-User License Agreement at https://www.devexpress.com/Support/licensingfaq.xml
\ No newline at end of file
+For terms and conditions governing use of DevExpress product libraries, including product libraries used in this sample,
+please review the applicable DevExpress End-User License Agreement at the following address: https://www.devexpress.com/Support/licensingfaq.xml
\ No newline at end of file
diff --git a/README.md b/README.md
index 83fca52..693401a 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
-
[](https://supportcenter.devexpress.com/ticket/details/T830604)
[](https://docs.devexpress.com/GeneralInformation/403183)
[](#does-this-example-address-your-development-requirementsobjectives)
@@ -25,7 +24,7 @@ This example includes multiple solutions that demonstrate:
After you bind the Data Grid to a database, you can implement CRUD operations (create, read update, delete). View the example: [Implement CRUD Operations in the WPF Data Grid](https://github.com/DevExpress-Examples/how-to-implement-crud-operations).
-## Does this example address your development requirements/objectives?
+## Does This Example Address Your Development Requirements/Objectives?
[
](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=wpf-data-grid-bind-to-pagedasyncsource&~~~was_helpful=yes) [
](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=wpf-data-grid-bind-to-pagedasyncsource&~~~was_helpful=no)
diff --git a/VB/PagedAsyncSourceMVVMSample/App.xaml b/VB/PagedAsyncSourceMVVMSample/App.xaml
new file mode 100644
index 0000000..adb2a05
--- /dev/null
+++ b/VB/PagedAsyncSourceMVVMSample/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/VB/PagedAsyncSourceMVVMSample/App.xaml.vb b/VB/PagedAsyncSourceMVVMSample/App.xaml.vb
new file mode 100644
index 0000000..883e284
--- /dev/null
+++ b/VB/PagedAsyncSourceMVVMSample/App.xaml.vb
@@ -0,0 +1,12 @@
+Imports System.Windows
+
+Namespace PagedAsyncSourceMVVMSample
+
+ '''
+ ''' Interaction logic for App.xaml
+ '''
+ Public Partial Class App
+ Inherits Application
+
+ End Class
+End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueFilterConverter.vb b/VB/PagedAsyncSourceMVVMSample/IssueFilterConverter.vb
index d39cb6d..3054dc8 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueFilterConverter.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueFilterConverter.vb
@@ -1,4 +1,4 @@
-Imports DevExpress.Data.Filtering
+Imports DevExpress.Data.Filtering
Imports DevExpress.Xpf.Data
Imports System
Imports System.Globalization
@@ -7,36 +7,30 @@ Imports System.Windows.Data
Imports System.Windows.Markup
Namespace PagedAsyncSourceMVVMSample
- Public Class IssueFilterConverter
- Inherits MarkupExtension
- Implements IValueConverter
- Private Function IValueConverter_Convert(ByVal filter As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
- Return DirectCast(filter, CriteriaOperator).Match(binary:= Function(propertyName, value, type)
- If propertyName = "Votes" AndAlso type = BinaryOperatorType.GreaterOrEqual Then
- Return New IssueFilter(minVotes:= CInt(Math.Truncate(value)))
- End If
- If propertyName = "Priority" AndAlso type = BinaryOperatorType.Equal Then
- Return New IssueFilter(priority:= CType(value, Priority))
- End If
- If propertyName = "Created" Then
- If type = BinaryOperatorType.GreaterOrEqual Then
- Return New IssueFilter(createdFrom:= CDate(value))
- End If
- If type = BinaryOperatorType.Less Then
- Return New IssueFilter(createdTo:= CDate(value))
- End If
- End If
- Throw New InvalidOperationException()
- End Function, [and]:= Function(filters)
- Return New IssueFilter(createdFrom:= filters.Select(Function(x) x.CreatedFrom).SingleOrDefault(Function(x) x IsNot Nothing), createdTo:= filters.Select(Function(x) x.CreatedTo).SingleOrDefault(Function(x) x IsNot Nothing), minVotes:= filters.Select(Function(x) x.MinVotes).SingleOrDefault(Function(x) x IsNot Nothing), priority:= filters.Select(Function(x) x.Priority).SingleOrDefault(Function(x) x IsNot Nothing))
- End Function, null:= CType(Nothing, IssueFilter))
- End Function
- Private Function IValueConverter_ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
- Throw New NotImplementedException()
- End Function
- Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
- Return Me
- End Function
- End Class
+ Public Class IssueFilterConverter
+ Inherits MarkupExtension
+ Implements IValueConverter
+
+ Private Function Convert(ByVal filter As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
+ Return CType(filter, CriteriaOperator).Match(binary:=Function(propertyName, value, type)
+ If Equals(propertyName, "Votes") AndAlso type = BinaryOperatorType.GreaterOrEqual Then Return New IssueFilter(minVotes:=CInt(value))
+ If Equals(propertyName, "Priority") AndAlso type = BinaryOperatorType.Equal Then Return New IssueFilter(priority:=CType(value, Priority))
+ If Equals(propertyName, "Created") Then
+ If type = BinaryOperatorType.GreaterOrEqual Then Return New IssueFilter(createdFrom:=CDate(value))
+ If type = BinaryOperatorType.Less Then Return New IssueFilter(createdTo:=CDate(value))
+ End If
+
+ Throw New InvalidOperationException()
+ End Function, [and]:=Function(filters) New IssueFilter(createdFrom:=filters.[Select](Function(x) x.CreatedFrom).SingleOrDefault(Function(x) x IsNot Nothing), createdTo:=filters.[Select](Function(x) x.CreatedTo).SingleOrDefault(Function(x) x IsNot Nothing), minVotes:=filters.[Select](Function(x) x.MinVotes).SingleOrDefault(Function(x) x IsNot Nothing), priority:=filters.[Select](Function(x) x.Priority).SingleOrDefault(Function(x) x IsNot Nothing)), null:=Nothing)
+ End Function
+
+ Private Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+ Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
+ Return Me
+ End Function
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueService/IssueData.vb b/VB/PagedAsyncSourceMVVMSample/IssueService/IssueData.vb
index 211ef78..8af3acb 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueService/IssueData.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueService/IssueData.vb
@@ -1,65 +1,75 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceMVVMSample
- Public Class IssueData
- Public Sub New(ByVal subject As String, ByVal user As String, ByVal created As DateTime, ByVal votes As Integer, ByVal priority As Priority)
- Me.Subject = subject
- Me.User = user
- Me.Created = created
- Me.Votes = votes
- Me.Priority = priority
- End Sub
- Private privateSubject As String
- Public Property Subject() As String
- Get
- Return privateSubject
- End Get
- Private Set(ByVal value As String)
- privateSubject = value
- End Set
- End Property
- Private privateUser As String
- Public Property User() As String
- Get
- Return privateUser
- End Get
- Private Set(ByVal value As String)
- privateUser = value
- End Set
- End Property
- Private privateCreated As DateTime
- Public Property Created() As DateTime
- Get
- Return privateCreated
- End Get
- Private Set(ByVal value As DateTime)
- privateCreated = value
- End Set
- End Property
- Private privateVotes As Integer
- Public Property Votes() As Integer
- Get
- Return privateVotes
- End Get
- Private Set(ByVal value As Integer)
- privateVotes = value
- End Set
- End Property
- Private privatePriority As Priority
- Public Property Priority() As Priority
- Get
- Return privatePriority
- End Get
- Private Set(ByVal value As Priority)
- privatePriority = value
- End Set
- End Property
- End Class
- Public Enum Priority
- Low
- BelowNormal
- Normal
- AboveNormal
- High
- End Enum
+
+ Public Class IssueData
+
+ Private _Subject As String, _User As String, _Created As DateTime, _Votes As Integer, _Priority As Priority
+
+ Public Sub New(ByVal subject As String, ByVal user As String, ByVal created As System.DateTime, ByVal votes As Integer, ByVal priority As PagedAsyncSourceMVVMSample.Priority)
+ Me.Subject = subject
+ Me.User = user
+ Me.Created = created
+ Me.Votes = votes
+ Me.Priority = priority
+ End Sub
+
+ Public Property Subject As String
+ Get
+ Return _Subject
+ End Get
+
+ Private Set(ByVal value As String)
+ _Subject = value
+ End Set
+ End Property
+
+ Public Property User As String
+ Get
+ Return _User
+ End Get
+
+ Private Set(ByVal value As String)
+ _User = value
+ End Set
+ End Property
+
+ Public Property Created As DateTime
+ Get
+ Return _Created
+ End Get
+
+ Private Set(ByVal value As DateTime)
+ _Created = value
+ End Set
+ End Property
+
+ Public Property Votes As Integer
+ Get
+ Return _Votes
+ End Get
+
+ Private Set(ByVal value As Integer)
+ _Votes = value
+ End Set
+ End Property
+
+ Public Property Priority As Priority
+ Get
+ Return _Priority
+ End Get
+
+ Private Set(ByVal value As Priority)
+ _Priority = value
+ End Set
+ End Property
+ End Class
+
+ Public Enum Priority
+ Low
+ BelowNormal
+ Normal
+ AboveNormal
+ High
+ End Enum
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueService/IssueFilter.vb b/VB/PagedAsyncSourceMVVMSample/IssueService/IssueFilter.vb
index aa1b4c3..bf49d4b 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueService/IssueFilter.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueService/IssueFilter.vb
@@ -1,48 +1,56 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceMVVMSample
- Public Class IssueFilter
- Public Sub New(Optional ByVal priority? As Priority = Nothing, Optional ByVal createdFrom? As DateTime = Nothing, Optional ByVal createdTo? As DateTime = Nothing, Optional ByVal minVotes? As Integer = Nothing)
- Me.Priority = priority
- Me.CreatedFrom = createdFrom
- Me.CreatedTo = createdTo
- Me.MinVotes = minVotes
- End Sub
- Private privatePriority? As Priority
- Public Property Priority() As Priority?
- Get
- Return privatePriority
- End Get
- Private Set(ByVal value? As Priority)
- privatePriority = value
- End Set
- End Property
- Private privateCreatedFrom? As DateTime
- Public Property CreatedFrom() As DateTime?
- Get
- Return privateCreatedFrom
- End Get
- Private Set(ByVal value? As DateTime)
- privateCreatedFrom = value
- End Set
- End Property
- Private privateCreatedTo? As DateTime
- Public Property CreatedTo() As DateTime?
- Get
- Return privateCreatedTo
- End Get
- Private Set(ByVal value? As DateTime)
- privateCreatedTo = value
- End Set
- End Property
- Private privateMinVotes? As Integer
- Public Property MinVotes() As Integer?
- Get
- Return privateMinVotes
- End Get
- Private Set(ByVal value? As Integer)
- privateMinVotes = value
- End Set
- End Property
- End Class
+
+ Public Class IssueFilter
+
+ Private _Priority As PagedAsyncSourceMVVMSample.Priority?, _CreatedFrom As System.DateTime?, _CreatedTo As System.DateTime?, _MinVotes As Integer?
+
+ Public Sub New(ByVal Optional priority As PagedAsyncSourceMVVMSample.Priority? = Nothing, ByVal Optional createdFrom As System.DateTime? = Nothing, ByVal Optional createdTo As System.DateTime? = Nothing, ByVal Optional minVotes As Integer? = Nothing)
+ Me.Priority = priority
+ Me.CreatedFrom = createdFrom
+ Me.CreatedTo = createdTo
+ Me.MinVotes = minVotes
+ End Sub
+
+ Public Property Priority As PagedAsyncSourceMVVMSample.Priority?
+ Get
+ Return _Priority
+ End Get
+
+ Private Set(ByVal value As PagedAsyncSourceMVVMSample.Priority?)
+ _Priority = value
+ End Set
+ End Property
+
+ Public Property CreatedFrom As System.DateTime?
+ Get
+ Return _CreatedFrom
+ End Get
+
+ Private Set(ByVal value As System.DateTime?)
+ _CreatedFrom = value
+ End Set
+ End Property
+
+ Public Property CreatedTo As System.DateTime?
+ Get
+ Return _CreatedTo
+ End Get
+
+ Private Set(ByVal value As System.DateTime?)
+ _CreatedTo = value
+ End Set
+ End Property
+
+ Public Property MinVotes As Integer?
+ Get
+ Return _MinVotes
+ End Get
+
+ Private Set(ByVal value As Integer?)
+ _MinVotes = value
+ End Set
+ End Property
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueService/IssueSortOrder.vb b/VB/PagedAsyncSourceMVVMSample/IssueService/IssueSortOrder.vb
index 0a8c240..9a3d730 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueService/IssueSortOrder.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueService/IssueSortOrder.vb
@@ -1,8 +1,9 @@
-Namespace PagedAsyncSourceMVVMSample
- Public Enum IssueSortOrder
- [Default]
- CreatedDescending
- VotesAscending
- VotesDescending
- End Enum
+Namespace PagedAsyncSourceMVVMSample
+
+ Public Enum IssueSortOrder
+ [Default]
+ CreatedDescending
+ VotesAscending
+ VotesDescending
+ End Enum
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesService.vb b/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesService.vb
index 3aa0e99..5fe9719 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesService.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesService.vb
@@ -1,86 +1,86 @@
-Imports System
+Imports System
Imports System.Collections.Generic
Imports System.Linq
-Imports System.Threading
Imports System.Threading.Tasks
Namespace PagedAsyncSourceMVVMSample
- Public Module IssuesService
- #Region "helpers"
- Private SyncObject As New Object()
- Private AllIssues As New Lazy(Of IssueData())(Function()
- Dim [date] = DateTime.Today
- Dim rnd = New Random(0)
- Return Enumerable.Range(0, 100000).Select(Function(i)
- [date] = [date].AddSeconds(-rnd.Next(20 * 60))
- Return New IssueData(subject:= OutlookDataGenerator.GetSubject(), user:= OutlookDataGenerator.GetFrom(), created:= [date], votes:= rnd.Next(100), priority:= OutlookDataGenerator.GetPriority())
- End Function).ToArray()
- End Function)
- Private Class DefaultSortComparer
- Implements IComparer(Of IssueData)
- Private Function IComparerGeneric_Compare(ByVal x As IssueData, ByVal y As IssueData) As Integer Implements IComparer(Of IssueData).Compare
- If x.Created.Date <> y.Created.Date Then
- Return Comparer(Of DateTime).Default.Compare(x.Created.Date, y.Created.Date)
- End If
- Return Comparer(Of Integer).Default.Compare(x.Votes, y.Votes)
- End Function
- End Class
- #End Region
+ Public Module IssuesService
- Public Async Function GetIssuesAsync(ByVal page As Integer, ByVal pageSize As Integer, ByVal sortOrder As IssueSortOrder, ByVal filter As IssueFilter) As Task(Of IssueData())
- Await Task.Delay(300)
- Dim issues = SortIssues(sortOrder, AllIssues.Value)
- If filter IsNot Nothing Then
- issues = FilterIssues(filter, issues)
- End If
- Return issues.Skip(page * pageSize).Take(pageSize).ToArray()
- End Function
+#Region "helpers"
+ Private SyncObject As Object = New Object()
- Public Async Function GetSummariesAsync(ByVal filter As IssueFilter) As Task(Of IssuesSummaries)
- Await Task.Delay(300)
- Dim issues = DirectCast(AllIssues.Value, IEnumerable(Of IssueData))
- If filter IsNot Nothing Then
- issues = FilterIssues(filter, issues)
- End If
- Dim lastCreated = If(issues.Any(), issues.Max(Function(x) x.Created), CType(Nothing, DateTime?))
- Return New IssuesSummaries(count:= issues.Count(), lastCreated:= lastCreated)
- End Function
+ Private AllIssues As Lazy(Of IssueData()) = New Lazy(Of IssueData())(Function()
+ Dim [date] = Date.Today
+ Dim rnd = New Random(0)
+ Return Enumerable.Range(0, 100000).[Select](Function(i)
+ [date] = [date].AddSeconds(-rnd.Next(20 * 60))
+ Return New IssueData(subject:=GetSubject(), user:=GetFrom(), created:=[date], votes:=rnd.Next(100), priority:=GetPriority())
+ End Function).ToArray()
+ End Function)
- #Region "filter"
- Private Function FilterIssues(ByVal filter As IssueFilter, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
- If filter.CreatedFrom IsNot Nothing OrElse filter.CreatedTo IsNot Nothing Then
- If filter.CreatedFrom Is Nothing OrElse filter.CreatedTo Is Nothing Then
- Throw New InvalidOperationException()
- End If
-'INSTANT VB WARNING: Comparisons involving nullable type instances require Option Strict Off:
- issues = issues.Where(Function(x) x.Created >= filter.CreatedFrom.Value AndAlso x.Created < filter.CreatedTo)
- End If
- If filter.MinVotes IsNot Nothing Then
- issues = issues.Where(Function(x) x.Votes >= filter.MinVotes.Value)
- End If
- If filter.Priority IsNot Nothing Then
- issues = issues.Where(Function(x) filter.Priority.Equals(x.Priority))
- End If
- Return issues
- End Function
- #End Region
+ Private Class DefaultSortComparer
+ Implements IComparer(Of IssueData)
- #Region "sort"
- Private Function SortIssues(ByVal sortOrder As IssueSortOrder, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
- Select Case sortOrder
- Case IssueSortOrder.Default
- Return issues.OrderByDescending(Function(x) x, New DefaultSortComparer()).ThenByDescending(Function(x) x.Created)
- Case IssueSortOrder.CreatedDescending
- Return issues.OrderByDescending(Function(x) x.Created)
- Case IssueSortOrder.VotesAscending
- Return issues.OrderBy(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
- Case IssueSortOrder.VotesDescending
- Return issues.OrderByDescending(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
- Case Else
- Throw New InvalidOperationException()
- End Select
- End Function
- #End Region
- End Module
+ Private Function Compare(ByVal x As IssueData, ByVal y As IssueData) As Integer Implements IComparer(Of IssueData).Compare
+ If x.Created.Date <> y.Created.Date Then Return Comparer(Of Date).Default.Compare(x.Created.Date, y.Created.Date)
+ Return Comparer(Of Integer).Default.Compare(x.Votes, y.Votes)
+ End Function
+ End Class
+
+#End Region
+ Public Async Function GetIssuesAsync(ByVal page As Integer, ByVal pageSize As Integer, ByVal sortOrder As IssueSortOrder, ByVal filter As IssueFilter) As Task(Of IssueData())
+ Await Task.Delay(300)
+ Dim issues = SortIssues(sortOrder, AllIssues.Value)
+ If filter IsNot Nothing Then issues = FilterIssues(filter, issues)
+ Return issues.Skip(page * pageSize).Take(pageSize).ToArray()
+ End Function
+
+ Public Async Function GetSummariesAsync(ByVal filter As IssueFilter) As Task(Of IssuesSummaries)
+ Await Task.Delay(300)
+ Dim issues = CType(AllIssues.Value, IEnumerable(Of IssueData))
+ If filter IsNot Nothing Then issues = FilterIssues(filter, issues)
+ Dim lastCreated = If(issues.Any(), issues.Max(Function(x) x.Created), DirectCast(Nothing, Date?))
+ Return New IssuesSummaries(count:=issues.Count(), lastCreated:=lastCreated)
+ End Function
+
+#Region "filter"
+ Private Function FilterIssues(ByVal filter As IssueFilter, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
+ If filter.CreatedFrom IsNot Nothing OrElse filter.CreatedTo IsNot Nothing Then
+ If filter.CreatedFrom Is Nothing OrElse filter.CreatedTo Is Nothing Then
+ Throw New InvalidOperationException()
+ End If
+
+ issues = issues.Where(Function(x) x.Created >= filter.CreatedFrom.Value AndAlso x.Created < filter.CreatedTo)
+ End If
+
+ If filter.MinVotes IsNot Nothing Then
+ issues = issues.Where(Function(x) x.Votes >= filter.MinVotes.Value)
+ End If
+
+ If filter.Priority IsNot Nothing Then
+ issues = issues.Where(Function(x) x.Priority = filter.Priority)
+ End If
+
+ Return issues
+ End Function
+
+#End Region
+#Region "sort"
+ Private Function SortIssues(ByVal sortOrder As IssueSortOrder, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
+ Select Case sortOrder
+ Case IssueSortOrder.Default
+ Return issues.OrderByDescending(Function(x) x, New DefaultSortComparer()).ThenByDescending(Function(x) x.Created)
+ Case IssueSortOrder.CreatedDescending
+ Return issues.OrderByDescending(Function(x) x.Created)
+ Case IssueSortOrder.VotesAscending
+ Return issues.OrderBy(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
+ Case IssueSortOrder.VotesDescending
+ Return issues.OrderByDescending(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
+ Case Else
+ Throw New InvalidOperationException()
+ End Select
+ End Function
+#End Region
+ End Module
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesSummaries.vb b/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesSummaries.vb
index 76142c4..3431d18 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesSummaries.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueService/IssuesSummaries.vb
@@ -1,29 +1,34 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceMVVMSample
- Public Class IssuesSummaries
- Public Sub New(ByVal count As Integer, ByVal lastCreated? As DateTime)
- Me.Count = count
- Me.LastCreated = lastCreated
- End Sub
-
- Private privateCount As Integer
- Public Property Count() As Integer
- Get
- Return privateCount
- End Get
- Private Set(ByVal value As Integer)
- privateCount = value
- End Set
- End Property
- Private privateLastCreated? As DateTime
- Public Property LastCreated() As DateTime?
- Get
- Return privateLastCreated
- End Get
- Private Set(ByVal value? As DateTime)
- privateLastCreated = value
- End Set
- End Property
- End Class
+
+ Public Class IssuesSummaries
+
+ Private _Count As Integer, _LastCreated As System.DateTime?
+
+ Public Sub New(ByVal count As Integer, ByVal lastCreated As System.DateTime?)
+ Me.Count = count
+ Me.LastCreated = lastCreated
+ End Sub
+
+ Public Property Count As Integer
+ Get
+ Return _Count
+ End Get
+
+ Private Set(ByVal value As Integer)
+ _Count = value
+ End Set
+ End Property
+
+ Public Property LastCreated As System.DateTime?
+ Get
+ Return _LastCreated
+ End Get
+
+ Private Set(ByVal value As System.DateTime?)
+ _LastCreated = value
+ End Set
+ End Property
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueService/OutlookDataGenerator.vb b/VB/PagedAsyncSourceMVVMSample/IssueService/OutlookDataGenerator.vb
index 5ef82c4..f9ca406 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueService/OutlookDataGenerator.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueService/OutlookDataGenerator.vb
@@ -1,21 +1,25 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceMVVMSample
- Public Module OutlookDataGenerator
- Private rnd As New Random()
- Private Subjects() As String = { "Developer Express MasterView. Integrating the control into an Accounting System.", "Web Edition: Data Entry Page. There is an issue with date validation.", "Payables Due Calculator is ready for testing.", "Web Edition: Search Page is ready for testing.", "Main Menu: Duplicate Items. Somebody has to review all menu items in the system.", "Receivables Calculator. Where can I find the complete specs?", "Ledger: Inconsistency. Please fix it.", "Receivables Printing module is ready for testing.", "Screen Redraw. Somebody has to look at it.", "Email System. What library are we going to use?", "Cannot add new vendor. This module doesn't work!", "History. Will we track sales history in our system?", "Main Menu: Add a File menu. File menu item is missing.", "Currency Mask. The current currency mask in completely unusable.", "Drag & Drop operations are not available in the scheduler module.", "Data Import. What database types will we support?", "Reports. The list of incomplete reports.", "Data Archiving. We still don't have this features in our application.", "Email Attachments. Is it possible to add multiple attachments? I haven't found a way to do this.", "Check Register. We are using different paths for different modules.", "Data Export. Our customers asked us for export to Microsoft Excel"}
-
- Private ReadOnly Users() As String = { "Peter Dolan", "Ryan Fischer", "Richard Fisher", "Tom Hamlett", "Mark Hamilton", "Steve Lee", "Jimmy Lewis", "Jeffrey W McClain", "Andrew Miller", "Dave Murrel", "Bert Parkins", "Mike Roller", "Ray Shipman", "Paul Bailey", "Brad Barnes", "Carl Lucas", "Jerry Campbell"}
-
- Public Function GetSubject() As String
- Return Subjects(rnd.Next(Subjects.Length - 1))
- End Function
-
- Public Function GetFrom() As String
- Return Users(rnd.Next(Users.Length))
- End Function
- Public Function GetPriority() As Priority
- Return CType(rnd.Next(5), Priority)
- End Function
- End Module
+
+ Public Module OutlookDataGenerator
+
+ Private rnd As Random = New Random()
+
+ Private Subjects As String() = New String() {"Developer Express MasterView. Integrating the control into an Accounting System.", "Web Edition: Data Entry Page. There is an issue with date validation.", "Payables Due Calculator is ready for testing.", "Web Edition: Search Page is ready for testing.", "Main Menu: Duplicate Items. Somebody has to review all menu items in the system.", "Receivables Calculator. Where can I find the complete specs?", "Ledger: Inconsistency. Please fix it.", "Receivables Printing module is ready for testing.", "Screen Redraw. Somebody has to look at it.", "Email System. What library are we going to use?", "Cannot add new vendor. This module doesn't work!", "History. Will we track sales history in our system?", "Main Menu: Add a File menu. File menu item is missing.", "Currency Mask. The current currency mask in completely unusable.", "Drag & Drop operations are not available in the scheduler module.", "Data Import. What database types will we support?", "Reports. The list of incomplete reports.", "Data Archiving. We still don't have this features in our application.", "Email Attachments. Is it possible to add multiple attachments? I haven't found a way to do this.", "Check Register. We are using different paths for different modules.", "Data Export. Our customers asked us for export to Microsoft Excel"}
+
+ Private ReadOnly Users As String() = New String() {"Peter Dolan", "Ryan Fischer", "Richard Fisher", "Tom Hamlett", "Mark Hamilton", "Steve Lee", "Jimmy Lewis", "Jeffrey W McClain", "Andrew Miller", "Dave Murrel", "Bert Parkins", "Mike Roller", "Ray Shipman", "Paul Bailey", "Brad Barnes", "Carl Lucas", "Jerry Campbell"}
+
+ Public Function GetSubject() As String
+ Return Subjects(rnd.Next(Subjects.Length - 1))
+ End Function
+
+ Public Function GetFrom() As String
+ Return Users(rnd.Next(Users.Length))
+ End Function
+
+ Public Function GetPriority() As Priority
+ Return CType(rnd.Next(5), Priority)
+ End Function
+ End Module
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/IssueServiceViewModel.vb b/VB/PagedAsyncSourceMVVMSample/IssueServiceViewModel.vb
index 9636448..dfb8c5f 100644
--- a/VB/PagedAsyncSourceMVVMSample/IssueServiceViewModel.vb
+++ b/VB/PagedAsyncSourceMVVMSample/IssueServiceViewModel.vb
@@ -1,4 +1,4 @@
-Imports DevExpress.Mvvm
+Imports DevExpress.Mvvm
Imports DevExpress.Mvvm.DataAnnotations
Imports DevExpress.Xpf.Data
Imports DevExpress.Mvvm.Xpf
@@ -6,63 +6,60 @@ Imports System
Imports System.ComponentModel
Imports System.Linq
Imports System.Threading.Tasks
-Imports PagedAsyncSourceMVVMSample
Namespace PagedAsyncSourceMVVMSample
- Public Class IssueServiceViewModel
- Inherits ViewModelBase
-
- Public Sub FetchIssues(ByVal args As FetchPageAsyncArgs)
- args.Result = GetIssuesAsync(args)
- End Sub
- Private Async Function GetIssuesAsync(ByVal args As FetchPageAsyncArgs) As Task(Of FetchRowsResult)
-'INSTANT VB WARNING: Instant VB cannot determine whether both operands of this division are integer types - if they are then you should use the VB integer division operator:
- Dim issues = Await IssuesService.GetIssuesAsync(page:= args.Skip/args.Take, pageSize:= args.Take, sortOrder:= GetIssueSortOrder(args.SortOrder), filter:= CType(args.Filter, IssueFilter))
+ Public Class IssueServiceViewModel
+ Inherits ViewModelBase
- Return New FetchRowsResult(issues, hasMoreRows:= issues.Length = args.Take)
- End Function
- Private Shared Function GetIssueSortOrder(ByVal sortOrder() As SortDefinition) As IssueSortOrder
- If sortOrder.Length > 0 Then
- Dim sort = sortOrder.Single()
- If sort.PropertyName = "Created" Then
- If sort.Direction <> ListSortDirection.Descending Then
- Throw New InvalidOperationException()
- End If
- Return IssueSortOrder.CreatedDescending
- End If
- If sort.PropertyName = "Votes" Then
- Return If(sort.Direction = ListSortDirection.Ascending, IssueSortOrder.VotesAscending, IssueSortOrder.VotesDescending)
- End If
- End If
- Return IssueSortOrder.Default
- End Function
+
+ Public Sub FetchIssues(ByVal args As FetchPageAsyncArgs)
+ args.Result = GetIssuesAsync(args)
+ End Sub
-
- Public Sub GetTotalSummaries(ByVal args As GetSummariesAsyncArgs)
- args.Result = GetTotalSummariesAsync(args)
- End Sub
- Private Shared Async Function GetTotalSummariesAsync(ByVal e As GetSummariesAsyncArgs) As Task(Of Object())
- Dim summaryValues = Await IssuesService.GetSummariesAsync(CType(e.Filter, IssueFilter))
- Return e.Summaries.Select(Function(x)
- If x.SummaryType = SummaryType.Count Then
- Return DirectCast(summaryValues.Count, Object)
- End If
- If x.SummaryType = SummaryType.Max AndAlso x.PropertyName = "Created" Then
- Return summaryValues.LastCreated
- End If
- Throw New InvalidOperationException()
- End Function).ToArray()
- End Function
+ Private Async Function GetIssuesAsync(ByVal args As FetchPageAsyncArgs) As Task(Of FetchRowsResult)
+ Dim issues = Await IssuesService.GetIssuesAsync(page:=args.Skip \ args.Take, pageSize:=args.Take, sortOrder:=GetIssueSortOrder(args.SortOrder), filter:=CType(args.Filter, IssueFilter))
+ Return New FetchRowsResult(issues, hasMoreRows:=issues.Length = args.Take)
+ End Function
-
- Public Sub GetUniqueValues(ByVal args As GetUniqueValuesAsyncArgs)
- If args.PropertyName = "Priority" Then
- Dim values = System.Enum.GetValues(GetType(Priority)).Cast(Of Object)().ToArray()
- args.Result = Task.FromResult(values)
- Else
- Throw New InvalidOperationException()
- End If
- End Sub
- End Class
+ Private Shared Function GetIssueSortOrder(ByVal sortOrder As SortDefinition()) As IssueSortOrder
+ If sortOrder.Length > 0 Then
+ Dim sort = sortOrder.[Single]()
+ If Equals(sort.PropertyName, "Created") Then
+ If sort.Direction <> ListSortDirection.Descending Then Throw New InvalidOperationException()
+ Return IssueSortOrder.CreatedDescending
+ End If
+
+ If Equals(sort.PropertyName, "Votes") Then
+ Return If(sort.Direction = ListSortDirection.Ascending, IssueSortOrder.VotesAscending, IssueSortOrder.VotesDescending)
+ End If
+ End If
+
+ Return IssueSortOrder.Default
+ End Function
+
+
+ Public Sub GetTotalSummaries(ByVal args As GetSummariesAsyncArgs)
+ args.Result = GetTotalSummariesAsync(args)
+ End Sub
+
+ Private Shared Async Function GetTotalSummariesAsync(ByVal e As GetSummariesAsyncArgs) As Task(Of Object())
+ Dim summaryValues = Await GetSummariesAsync(CType(e.Filter, IssueFilter))
+ Return e.Summaries.[Select](Function(x)
+ If x.SummaryType = SummaryType.Count Then Return CObj(summaryValues.Count)
+ If x.SummaryType = SummaryType.Max AndAlso Equals(x.PropertyName, "Created") Then Return summaryValues.LastCreated
+ Throw New InvalidOperationException()
+ End Function).ToArray()
+ End Function
+
+
+ Public Sub GetUniqueValues(ByVal args As GetUniqueValuesAsyncArgs)
+ If Equals(args.PropertyName, "Priority") Then
+ Dim values = [Enum].GetValues(GetType(Priority)).Cast(Of Object)().ToArray()
+ args.Result = Task.FromResult(values)
+ Else
+ Throw New InvalidOperationException()
+ End If
+ End Sub
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/MainWindow.xaml.vb b/VB/PagedAsyncSourceMVVMSample/MainWindow.xaml.vb
index 4c0989f..819dbbb 100644
--- a/VB/PagedAsyncSourceMVVMSample/MainWindow.xaml.vb
+++ b/VB/PagedAsyncSourceMVVMSample/MainWindow.xaml.vb
@@ -1,17 +1,13 @@
-Imports DevExpress.Data.Filtering
-Imports DevExpress.Xpf.Data
-Imports System
Imports System.ComponentModel
-Imports System.Linq
-Imports System.Threading.Tasks
Imports System.Windows
Namespace PagedAsyncSourceMVVMSample
- Partial Public Class MainWindow
- Inherits Window
- Public Sub New()
- InitializeComponent()
- End Sub
- End Class
+ Public Partial Class MainWindow
+ Inherits Window
+
+ Public Sub New()
+ Me.InitializeComponent()
+ End Sub
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.sln b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.sln
index 6c47c30..6ca9bde 100644
--- a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.sln
+++ b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.sln
@@ -1,3 +1,4 @@
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 16
VisualStudioVersion = 15.0.27130.2020
diff --git a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.vbproj b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.vbproj
index 21d71fd..19ec5f2 100644
--- a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.vbproj
+++ b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.Net5.vbproj
@@ -1,5 +1,6 @@
+ On
net5.0-windows
WinExe
@@ -10,27 +11,10 @@
true
x86;AnyCPU
false
- obj*/**
+ false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -41,4 +25,4 @@
-
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.sln b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.sln
index 41cb5d1..966f7e0 100644
--- a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.sln
+++ b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.sln
@@ -1,3 +1,4 @@
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 15.0.27130.2020
diff --git a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.vbproj b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.vbproj
index 217d7e4..2d0e722 100644
--- a/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.vbproj
+++ b/VB/PagedAsyncSourceMVVMSample/PagedAsyncSourceMVVMSample.vbproj
@@ -1,6 +1,7 @@
-
+
+ On
Debug
AnyCPU
{6F822734-A614-41AD-A092-690C82DAB7B6}
@@ -11,11 +12,8 @@
v4.5.2
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ 4
true
- On
- Binary
- Off
- On
obj.NetFX
@@ -24,41 +22,19 @@
full
false
bin\Debug\
- true
- true
+ DEBUG,TRACE
prompt
- true
+ 4
AnyCPU
pdbonly
true
bin\Release\
- false
- true
+ TRACE
prompt
- true
+ 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -84,7 +60,7 @@
-
+
MSBuild:Compile
Designer
@@ -92,8 +68,8 @@
MSBuild:Compile
Designer
-
- Application.xaml
+
+ App.xaml
Code
@@ -110,32 +86,31 @@
-
+
Code
-
+
True
True
Resources.resx
-
+
True
Settings.settings
True
-
- VbMyResourcesResXFileCodeGenerator
+
+ ResXFileCodeGenerator
Resources.Designer.vb
- My.Resources
+ PagedAsyncSourceMVVMSample.Properties
-
+
SettingsSingleFileGenerator
Settings.Designer.vb
- My
-
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceMVVMSample/Properties/AssemblyInfo.vb b/VB/PagedAsyncSourceMVVMSample/Properties/AssemblyInfo.vb
new file mode 100644
index 0000000..362b001
--- /dev/null
+++ b/VB/PagedAsyncSourceMVVMSample/Properties/AssemblyInfo.vb
@@ -0,0 +1,44 @@
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+Imports System.Windows
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+
+
+
+
+
+
+
+' Setting ComVisible to false makes the types in this assembly not visible
+' to COM components. If you need to access a type in this assembly from
+' COM, set the ComVisible attribute to true on that type.
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .csproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to en-US. Then uncomment
+'the NeutralResourceLanguage attribute below. Update the "en-US" in
+'the line below to match the UICulture setting in the project file.
+'[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+'(used if a resource is not found in the page,
+' or application resource dictionaries)
+'(used if a resource is not found in the page,
+' app, or any theme specific resource dictionaries)
+ 'where theme specific resource dictionaries are located
+'where the generic resource dictionary is located
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' [assembly: AssemblyVersion("1.0.*")]
+
+
diff --git a/VB/PagedAsyncSourceMVVMSample/Properties/Resources.Designer.vb b/VB/PagedAsyncSourceMVVMSample/Properties/Resources.Designer.vb
new file mode 100644
index 0000000..97d5307
--- /dev/null
+++ b/VB/PagedAsyncSourceMVVMSample/Properties/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+Namespace PagedAsyncSourceMVVMSample.Properties
+
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ ' This class was auto-generated by the StronglyTypedResourceBuilder
+ ' class via a tool like ResGen or Visual Studio.
+ ' To add or remove a member, edit your .ResX file then rerun ResGen
+ ' with the /str option, or rebuild your VS project.
+
+
+
+ Friend Class Resources
+
+ Private Shared resourceMan As Global.System.Resources.ResourceManager
+
+ Private Shared resourceCulture As Global.System.Globalization.CultureInfo
+
+
+ Friend Sub New()
+ End Sub
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+
+ Friend Shared ReadOnly Property ResourceManager As Global.System.Resources.ResourceManager
+ Get
+ If(PagedAsyncSourceMVVMSample.Properties.Resources.resourceMan Is Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Resources", GetType(PagedAsyncSourceMVVMSample.Properties.Resources).Assembly)
+ PagedAsyncSourceMVVMSample.Properties.Resources.resourceMan = temp
+ End If
+
+ Return PagedAsyncSourceMVVMSample.Properties.Resources.resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+
+ Friend Shared Property Culture As Global.System.Globalization.CultureInfo
+ Get
+ Return PagedAsyncSourceMVVMSample.Properties.Resources.resourceCulture
+ End Get
+
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ PagedAsyncSourceMVVMSample.Properties.Resources.resourceCulture = value
+ End Set
+ End Property
+ End Class
+End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/Properties/Resources.resx b/VB/PagedAsyncSourceMVVMSample/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/VB/PagedAsyncSourceMVVMSample/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceMVVMSample/Properties/Settings.Designer.vb b/VB/PagedAsyncSourceMVVMSample/Properties/Settings.Designer.vb
new file mode 100644
index 0000000..a4ccbda
--- /dev/null
+++ b/VB/PagedAsyncSourceMVVMSample/Properties/Settings.Designer.vb
@@ -0,0 +1,25 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+Namespace PagedAsyncSourceMVVMSample.Properties
+
+
+
+ Friend NotInheritable Partial Class Settings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As PagedAsyncSourceMVVMSample.Properties.Settings = CType((Global.System.Configuration.ApplicationSettingsBase.Synchronized(New PagedAsyncSourceMVVMSample.Properties.Settings())), PagedAsyncSourceMVVMSample.Properties.Settings)
+
+ Public Shared ReadOnly Property [Default] As Settings
+ Get
+ Return PagedAsyncSourceMVVMSample.Properties.Settings.defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
diff --git a/VB/PagedAsyncSourceMVVMSample/Properties/Settings.settings b/VB/PagedAsyncSourceMVVMSample/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/VB/PagedAsyncSourceMVVMSample/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceSample/App.xaml b/VB/PagedAsyncSourceSample/App.xaml
new file mode 100644
index 0000000..5243d35
--- /dev/null
+++ b/VB/PagedAsyncSourceSample/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/VB/PagedAsyncSourceSample/App.xaml.vb b/VB/PagedAsyncSourceSample/App.xaml.vb
new file mode 100644
index 0000000..7329a23
--- /dev/null
+++ b/VB/PagedAsyncSourceSample/App.xaml.vb
@@ -0,0 +1,12 @@
+Imports System.Windows
+
+Namespace PagedAsyncSourceSample
+
+ '''
+ ''' Interaction logic for App.xaml
+ '''
+ Public Partial Class App
+ Inherits Application
+
+ End Class
+End Namespace
diff --git a/VB/PagedAsyncSourceSample/IssueService/IssueData.vb b/VB/PagedAsyncSourceSample/IssueService/IssueData.vb
index 0820d4c..c1d556a 100644
--- a/VB/PagedAsyncSourceSample/IssueService/IssueData.vb
+++ b/VB/PagedAsyncSourceSample/IssueService/IssueData.vb
@@ -1,65 +1,75 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceSample
- Public Class IssueData
- Public Sub New(ByVal subject As String, ByVal user As String, ByVal created As DateTime, ByVal votes As Integer, ByVal priority As Priority)
- Me.Subject = subject
- Me.User = user
- Me.Created = created
- Me.Votes = votes
- Me.Priority = priority
- End Sub
- Private privateSubject As String
- Public Property Subject() As String
- Get
- Return privateSubject
- End Get
- Private Set(ByVal value As String)
- privateSubject = value
- End Set
- End Property
- Private privateUser As String
- Public Property User() As String
- Get
- Return privateUser
- End Get
- Private Set(ByVal value As String)
- privateUser = value
- End Set
- End Property
- Private privateCreated As DateTime
- Public Property Created() As DateTime
- Get
- Return privateCreated
- End Get
- Private Set(ByVal value As DateTime)
- privateCreated = value
- End Set
- End Property
- Private privateVotes As Integer
- Public Property Votes() As Integer
- Get
- Return privateVotes
- End Get
- Private Set(ByVal value As Integer)
- privateVotes = value
- End Set
- End Property
- Private privatePriority As Priority
- Public Property Priority() As Priority
- Get
- Return privatePriority
- End Get
- Private Set(ByVal value As Priority)
- privatePriority = value
- End Set
- End Property
- End Class
- Public Enum Priority
- Low
- BelowNormal
- Normal
- AboveNormal
- High
- End Enum
+
+ Public Class IssueData
+
+ Private _Subject As String, _User As String, _Created As DateTime, _Votes As Integer, _Priority As Priority
+
+ Public Sub New(ByVal subject As String, ByVal user As String, ByVal created As System.DateTime, ByVal votes As Integer, ByVal priority As PagedAsyncSourceSample.Priority)
+ Me.Subject = subject
+ Me.User = user
+ Me.Created = created
+ Me.Votes = votes
+ Me.Priority = priority
+ End Sub
+
+ Public Property Subject As String
+ Get
+ Return _Subject
+ End Get
+
+ Private Set(ByVal value As String)
+ _Subject = value
+ End Set
+ End Property
+
+ Public Property User As String
+ Get
+ Return _User
+ End Get
+
+ Private Set(ByVal value As String)
+ _User = value
+ End Set
+ End Property
+
+ Public Property Created As DateTime
+ Get
+ Return _Created
+ End Get
+
+ Private Set(ByVal value As DateTime)
+ _Created = value
+ End Set
+ End Property
+
+ Public Property Votes As Integer
+ Get
+ Return _Votes
+ End Get
+
+ Private Set(ByVal value As Integer)
+ _Votes = value
+ End Set
+ End Property
+
+ Public Property Priority As Priority
+ Get
+ Return _Priority
+ End Get
+
+ Private Set(ByVal value As Priority)
+ _Priority = value
+ End Set
+ End Property
+ End Class
+
+ Public Enum Priority
+ Low
+ BelowNormal
+ Normal
+ AboveNormal
+ High
+ End Enum
End Namespace
diff --git a/VB/PagedAsyncSourceSample/IssueService/IssueFilter.vb b/VB/PagedAsyncSourceSample/IssueService/IssueFilter.vb
index dec52c7..b6b3a06 100644
--- a/VB/PagedAsyncSourceSample/IssueService/IssueFilter.vb
+++ b/VB/PagedAsyncSourceSample/IssueService/IssueFilter.vb
@@ -1,48 +1,56 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceSample
- Public Class IssueFilter
- Public Sub New(Optional ByVal priority? As Priority = Nothing, Optional ByVal createdFrom? As DateTime = Nothing, Optional ByVal createdTo? As DateTime = Nothing, Optional ByVal minVotes? As Integer = Nothing)
- Me.Priority = priority
- Me.CreatedFrom = createdFrom
- Me.CreatedTo = createdTo
- Me.MinVotes = minVotes
- End Sub
- Private privatePriority? As Priority
- Public Property Priority() As Priority?
- Get
- Return privatePriority
- End Get
- Private Set(ByVal value? As Priority)
- privatePriority = value
- End Set
- End Property
- Private privateCreatedFrom? As DateTime
- Public Property CreatedFrom() As DateTime?
- Get
- Return privateCreatedFrom
- End Get
- Private Set(ByVal value? As DateTime)
- privateCreatedFrom = value
- End Set
- End Property
- Private privateCreatedTo? As DateTime
- Public Property CreatedTo() As DateTime?
- Get
- Return privateCreatedTo
- End Get
- Private Set(ByVal value? As DateTime)
- privateCreatedTo = value
- End Set
- End Property
- Private privateMinVotes? As Integer
- Public Property MinVotes() As Integer?
- Get
- Return privateMinVotes
- End Get
- Private Set(ByVal value? As Integer)
- privateMinVotes = value
- End Set
- End Property
- End Class
+
+ Public Class IssueFilter
+
+ Private _Priority As PagedAsyncSourceSample.Priority?, _CreatedFrom As System.DateTime?, _CreatedTo As System.DateTime?, _MinVotes As Integer?
+
+ Public Sub New(ByVal Optional priority As PagedAsyncSourceSample.Priority? = Nothing, ByVal Optional createdFrom As System.DateTime? = Nothing, ByVal Optional createdTo As System.DateTime? = Nothing, ByVal Optional minVotes As Integer? = Nothing)
+ Me.Priority = priority
+ Me.CreatedFrom = createdFrom
+ Me.CreatedTo = createdTo
+ Me.MinVotes = minVotes
+ End Sub
+
+ Public Property Priority As PagedAsyncSourceSample.Priority?
+ Get
+ Return _Priority
+ End Get
+
+ Private Set(ByVal value As PagedAsyncSourceSample.Priority?)
+ _Priority = value
+ End Set
+ End Property
+
+ Public Property CreatedFrom As System.DateTime?
+ Get
+ Return _CreatedFrom
+ End Get
+
+ Private Set(ByVal value As System.DateTime?)
+ _CreatedFrom = value
+ End Set
+ End Property
+
+ Public Property CreatedTo As System.DateTime?
+ Get
+ Return _CreatedTo
+ End Get
+
+ Private Set(ByVal value As System.DateTime?)
+ _CreatedTo = value
+ End Set
+ End Property
+
+ Public Property MinVotes As Integer?
+ Get
+ Return _MinVotes
+ End Get
+
+ Private Set(ByVal value As Integer?)
+ _MinVotes = value
+ End Set
+ End Property
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceSample/IssueService/IssueSortOrder.vb b/VB/PagedAsyncSourceSample/IssueService/IssueSortOrder.vb
index 5977df1..def8817 100644
--- a/VB/PagedAsyncSourceSample/IssueService/IssueSortOrder.vb
+++ b/VB/PagedAsyncSourceSample/IssueService/IssueSortOrder.vb
@@ -1,8 +1,9 @@
-Namespace PagedAsyncSourceSample
- Public Enum IssueSortOrder
- [Default]
- CreatedDescending
- VotesAscending
- VotesDescending
- End Enum
+Namespace PagedAsyncSourceSample
+
+ Public Enum IssueSortOrder
+ [Default]
+ CreatedDescending
+ VotesAscending
+ VotesDescending
+ End Enum
End Namespace
diff --git a/VB/PagedAsyncSourceSample/IssueService/IssuesService.vb b/VB/PagedAsyncSourceSample/IssueService/IssuesService.vb
index 066900f..47724d9 100644
--- a/VB/PagedAsyncSourceSample/IssueService/IssuesService.vb
+++ b/VB/PagedAsyncSourceSample/IssueService/IssuesService.vb
@@ -1,86 +1,86 @@
-Imports System
+Imports System
Imports System.Collections.Generic
Imports System.Linq
-Imports System.Threading
Imports System.Threading.Tasks
Namespace PagedAsyncSourceSample
- Public Module IssuesService
- #Region "helpers"
- Private SyncObject As New Object()
- Private AllIssues As New Lazy(Of IssueData())(Function()
- Dim [date] = DateTime.Today
- Dim rnd = New Random(0)
- Return Enumerable.Range(0, 100000).Select(Function(i)
- [date] = [date].AddSeconds(-rnd.Next(20 * 60))
- Return New IssueData(subject:= OutlookDataGenerator.GetSubject(), user:= OutlookDataGenerator.GetFrom(), created:= [date], votes:= rnd.Next(100), priority:= OutlookDataGenerator.GetPriority())
- End Function).ToArray()
- End Function)
- Private Class DefaultSortComparer
- Implements IComparer(Of IssueData)
- Private Function IComparerGeneric_Compare(ByVal x As IssueData, ByVal y As IssueData) As Integer Implements IComparer(Of IssueData).Compare
- If x.Created.Date <> y.Created.Date Then
- Return Comparer(Of DateTime).Default.Compare(x.Created.Date, y.Created.Date)
- End If
- Return Comparer(Of Integer).Default.Compare(x.Votes, y.Votes)
- End Function
- End Class
- #End Region
+ Public Module IssuesService
- Public Async Function GetIssuesAsync(ByVal page As Integer, ByVal pageSize As Integer, ByVal sortOrder As IssueSortOrder, ByVal filter As IssueFilter) As Task(Of IssueData())
- Await Task.Delay(300)
- Dim issues = SortIssues(sortOrder, AllIssues.Value)
- If filter IsNot Nothing Then
- issues = FilterIssues(filter, issues)
- End If
- Return issues.Skip(page * pageSize).Take(pageSize).ToArray()
- End Function
+#Region "helpers"
+ Private SyncObject As Object = New Object()
- Public Async Function GetSummariesAsync(ByVal filter As IssueFilter) As Task(Of IssuesSummaries)
- Await Task.Delay(300)
- Dim issues = DirectCast(AllIssues.Value, IEnumerable(Of IssueData))
- If filter IsNot Nothing Then
- issues = FilterIssues(filter, issues)
- End If
- Dim lastCreated = If(issues.Any(), issues.Max(Function(x) x.Created), CType(Nothing, DateTime?))
- Return New IssuesSummaries(count:= issues.Count(), lastCreated:= lastCreated)
- End Function
+ Private AllIssues As Lazy(Of IssueData()) = New Lazy(Of IssueData())(Function()
+ Dim [date] = Date.Today
+ Dim rnd = New Random(0)
+ Return Enumerable.Range(0, 100000).[Select](Function(i)
+ [date] = [date].AddSeconds(-rnd.Next(20 * 60))
+ Return New IssueData(subject:=GetSubject(), user:=GetFrom(), created:=[date], votes:=rnd.Next(100), priority:=GetPriority())
+ End Function).ToArray()
+ End Function)
- #Region "filter"
- Private Function FilterIssues(ByVal filter As IssueFilter, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
- If filter.CreatedFrom IsNot Nothing OrElse filter.CreatedTo IsNot Nothing Then
- If filter.CreatedFrom Is Nothing OrElse filter.CreatedTo Is Nothing Then
- Throw New InvalidOperationException()
- End If
-'INSTANT VB WARNING: Comparisons involving nullable type instances require Option Strict Off:
- issues = issues.Where(Function(x) x.Created >= filter.CreatedFrom.Value AndAlso x.Created < filter.CreatedTo)
- End If
- If filter.MinVotes IsNot Nothing Then
- issues = issues.Where(Function(x) x.Votes >= filter.MinVotes.Value)
- End If
- If filter.Priority IsNot Nothing Then
- issues = issues.Where(Function(x) filter.Priority.Equals(x.Priority))
- End If
- Return issues
- End Function
- #End Region
+ Private Class DefaultSortComparer
+ Implements IComparer(Of IssueData)
- #Region "sort"
- Private Function SortIssues(ByVal sortOrder As IssueSortOrder, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
- Select Case sortOrder
- Case IssueSortOrder.Default
- Return issues.OrderByDescending(Function(x) x, New DefaultSortComparer()).ThenByDescending(Function(x) x.Created)
- Case IssueSortOrder.CreatedDescending
- Return issues.OrderByDescending(Function(x) x.Created)
- Case IssueSortOrder.VotesAscending
- Return issues.OrderBy(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
- Case IssueSortOrder.VotesDescending
- Return issues.OrderByDescending(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
- Case Else
- Throw New InvalidOperationException()
- End Select
- End Function
- #End Region
- End Module
+ Private Function Compare(ByVal x As IssueData, ByVal y As IssueData) As Integer Implements IComparer(Of IssueData).Compare
+ If x.Created.Date <> y.Created.Date Then Return Comparer(Of Date).Default.Compare(x.Created.Date, y.Created.Date)
+ Return Comparer(Of Integer).Default.Compare(x.Votes, y.Votes)
+ End Function
+ End Class
+
+#End Region
+ Public Async Function GetIssuesAsync(ByVal page As Integer, ByVal pageSize As Integer, ByVal sortOrder As IssueSortOrder, ByVal filter As IssueFilter) As Task(Of IssueData())
+ Await Task.Delay(300)
+ Dim issues = SortIssues(sortOrder, AllIssues.Value)
+ If filter IsNot Nothing Then issues = FilterIssues(filter, issues)
+ Return issues.Skip(page * pageSize).Take(pageSize).ToArray()
+ End Function
+
+ Public Async Function GetSummariesAsync(ByVal filter As IssueFilter) As Task(Of IssuesSummaries)
+ Await Task.Delay(300)
+ Dim issues = CType(AllIssues.Value, IEnumerable(Of IssueData))
+ If filter IsNot Nothing Then issues = FilterIssues(filter, issues)
+ Dim lastCreated = If(issues.Any(), issues.Max(Function(x) x.Created), DirectCast(Nothing, Date?))
+ Return New IssuesSummaries(count:=issues.Count(), lastCreated:=lastCreated)
+ End Function
+
+#Region "filter"
+ Private Function FilterIssues(ByVal filter As IssueFilter, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
+ If filter.CreatedFrom IsNot Nothing OrElse filter.CreatedTo IsNot Nothing Then
+ If filter.CreatedFrom Is Nothing OrElse filter.CreatedTo Is Nothing Then
+ Throw New InvalidOperationException()
+ End If
+
+ issues = issues.Where(Function(x) x.Created >= filter.CreatedFrom.Value AndAlso x.Created < filter.CreatedTo)
+ End If
+
+ If filter.MinVotes IsNot Nothing Then
+ issues = issues.Where(Function(x) x.Votes >= filter.MinVotes.Value)
+ End If
+
+ If filter.Priority IsNot Nothing Then
+ issues = issues.Where(Function(x) x.Priority = filter.Priority)
+ End If
+
+ Return issues
+ End Function
+
+#End Region
+#Region "sort"
+ Private Function SortIssues(ByVal sortOrder As IssueSortOrder, ByVal issues As IEnumerable(Of IssueData)) As IEnumerable(Of IssueData)
+ Select Case sortOrder
+ Case IssueSortOrder.Default
+ Return issues.OrderByDescending(Function(x) x, New DefaultSortComparer()).ThenByDescending(Function(x) x.Created)
+ Case IssueSortOrder.CreatedDescending
+ Return issues.OrderByDescending(Function(x) x.Created)
+ Case IssueSortOrder.VotesAscending
+ Return issues.OrderBy(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
+ Case IssueSortOrder.VotesDescending
+ Return issues.OrderByDescending(Function(x) x.Votes).ThenByDescending(Function(x) x.Created)
+ Case Else
+ Throw New InvalidOperationException()
+ End Select
+ End Function
+#End Region
+ End Module
End Namespace
diff --git a/VB/PagedAsyncSourceSample/IssueService/IssuesSummaries.vb b/VB/PagedAsyncSourceSample/IssueService/IssuesSummaries.vb
index e1d83ca..10ee7ec 100644
--- a/VB/PagedAsyncSourceSample/IssueService/IssuesSummaries.vb
+++ b/VB/PagedAsyncSourceSample/IssueService/IssuesSummaries.vb
@@ -1,29 +1,34 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceSample
- Public Class IssuesSummaries
- Public Sub New(ByVal count As Integer, ByVal lastCreated? As DateTime)
- Me.Count = count
- Me.LastCreated = lastCreated
- End Sub
-
- Private privateCount As Integer
- Public Property Count() As Integer
- Get
- Return privateCount
- End Get
- Private Set(ByVal value As Integer)
- privateCount = value
- End Set
- End Property
- Private privateLastCreated? As DateTime
- Public Property LastCreated() As DateTime?
- Get
- Return privateLastCreated
- End Get
- Private Set(ByVal value? As DateTime)
- privateLastCreated = value
- End Set
- End Property
- End Class
+
+ Public Class IssuesSummaries
+
+ Private _Count As Integer, _LastCreated As System.DateTime?
+
+ Public Sub New(ByVal count As Integer, ByVal lastCreated As System.DateTime?)
+ Me.Count = count
+ Me.LastCreated = lastCreated
+ End Sub
+
+ Public Property Count As Integer
+ Get
+ Return _Count
+ End Get
+
+ Private Set(ByVal value As Integer)
+ _Count = value
+ End Set
+ End Property
+
+ Public Property LastCreated As System.DateTime?
+ Get
+ Return _LastCreated
+ End Get
+
+ Private Set(ByVal value As System.DateTime?)
+ _LastCreated = value
+ End Set
+ End Property
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceSample/IssueService/OutlookDataGenerator.vb b/VB/PagedAsyncSourceSample/IssueService/OutlookDataGenerator.vb
index d3edab0..21ad513 100644
--- a/VB/PagedAsyncSourceSample/IssueService/OutlookDataGenerator.vb
+++ b/VB/PagedAsyncSourceSample/IssueService/OutlookDataGenerator.vb
@@ -1,21 +1,25 @@
-Imports System
+Imports System
Namespace PagedAsyncSourceSample
- Public Module OutlookDataGenerator
- Private rnd As New Random()
- Private Subjects() As String = { "Developer Express MasterView. Integrating the control into an Accounting System.", "Web Edition: Data Entry Page. There is an issue with date validation.", "Payables Due Calculator is ready for testing.", "Web Edition: Search Page is ready for testing.", "Main Menu: Duplicate Items. Somebody has to review all menu items in the system.", "Receivables Calculator. Where can I find the complete specs?", "Ledger: Inconsistency. Please fix it.", "Receivables Printing module is ready for testing.", "Screen Redraw. Somebody has to look at it.", "Email System. What library are we going to use?", "Cannot add new vendor. This module doesn't work!", "History. Will we track sales history in our system?", "Main Menu: Add a File menu. File menu item is missing.", "Currency Mask. The current currency mask in completely unusable.", "Drag & Drop operations are not available in the scheduler module.", "Data Import. What database types will we support?", "Reports. The list of incomplete reports.", "Data Archiving. We still don't have this features in our application.", "Email Attachments. Is it possible to add multiple attachments? I haven't found a way to do this.", "Check Register. We are using different paths for different modules.", "Data Export. Our customers asked us for export to Microsoft Excel"}
-
- Private ReadOnly Users() As String = { "Peter Dolan", "Ryan Fischer", "Richard Fisher", "Tom Hamlett", "Mark Hamilton", "Steve Lee", "Jimmy Lewis", "Jeffrey W McClain", "Andrew Miller", "Dave Murrel", "Bert Parkins", "Mike Roller", "Ray Shipman", "Paul Bailey", "Brad Barnes", "Carl Lucas", "Jerry Campbell"}
-
- Public Function GetSubject() As String
- Return Subjects(rnd.Next(Subjects.Length - 1))
- End Function
-
- Public Function GetFrom() As String
- Return Users(rnd.Next(Users.Length))
- End Function
- Public Function GetPriority() As Priority
- Return CType(rnd.Next(5), Priority)
- End Function
- End Module
+
+ Public Module OutlookDataGenerator
+
+ Private rnd As Random = New Random()
+
+ Private Subjects As String() = New String() {"Developer Express MasterView. Integrating the control into an Accounting System.", "Web Edition: Data Entry Page. There is an issue with date validation.", "Payables Due Calculator is ready for testing.", "Web Edition: Search Page is ready for testing.", "Main Menu: Duplicate Items. Somebody has to review all menu items in the system.", "Receivables Calculator. Where can I find the complete specs?", "Ledger: Inconsistency. Please fix it.", "Receivables Printing module is ready for testing.", "Screen Redraw. Somebody has to look at it.", "Email System. What library are we going to use?", "Cannot add new vendor. This module doesn't work!", "History. Will we track sales history in our system?", "Main Menu: Add a File menu. File menu item is missing.", "Currency Mask. The current currency mask in completely unusable.", "Drag & Drop operations are not available in the scheduler module.", "Data Import. What database types will we support?", "Reports. The list of incomplete reports.", "Data Archiving. We still don't have this features in our application.", "Email Attachments. Is it possible to add multiple attachments? I haven't found a way to do this.", "Check Register. We are using different paths for different modules.", "Data Export. Our customers asked us for export to Microsoft Excel"}
+
+ Private ReadOnly Users As String() = New String() {"Peter Dolan", "Ryan Fischer", "Richard Fisher", "Tom Hamlett", "Mark Hamilton", "Steve Lee", "Jimmy Lewis", "Jeffrey W McClain", "Andrew Miller", "Dave Murrel", "Bert Parkins", "Mike Roller", "Ray Shipman", "Paul Bailey", "Brad Barnes", "Carl Lucas", "Jerry Campbell"}
+
+ Public Function GetSubject() As String
+ Return Subjects(rnd.Next(Subjects.Length - 1))
+ End Function
+
+ Public Function GetFrom() As String
+ Return Users(rnd.Next(Users.Length))
+ End Function
+
+ Public Function GetPriority() As Priority
+ Return CType(rnd.Next(5), Priority)
+ End Function
+ End Module
End Namespace
diff --git a/VB/PagedAsyncSourceSample/MainWindow.xaml.vb b/VB/PagedAsyncSourceSample/MainWindow.xaml.vb
index ef74cdb..17d15b4 100644
--- a/VB/PagedAsyncSourceSample/MainWindow.xaml.vb
+++ b/VB/PagedAsyncSourceSample/MainWindow.xaml.vb
@@ -1,4 +1,4 @@
-Imports DevExpress.Data.Filtering
+Imports DevExpress.Data.Filtering
Imports DevExpress.Xpf.Data
Imports System
Imports System.ComponentModel
@@ -7,100 +7,71 @@ Imports System.Threading.Tasks
Imports System.Windows
Namespace PagedAsyncSourceSample
- Partial Public Class MainWindow
- Inherits Window
- Public Sub New()
- InitializeComponent()
+ Public Partial Class MainWindow
+ Inherits Window
- Dim source = New PagedAsyncSource() With {
- .ElementType = GetType(IssueData),
- .PageNavigationMode = PageNavigationMode.ArbitraryWithTotalPageCount
- }
- AddHandler Me.Unloaded, Sub(o, e)
- source.Dispose()
- End Sub
+ Public Sub New()
+ Me.InitializeComponent()
+ Dim source = New PagedAsyncSource() With {.ElementType = GetType(IssueData), .PageNavigationMode = PageNavigationMode.ArbitraryWithTotalPageCount}
+ AddHandler Unloaded, Sub(o, e) source.Dispose()
+ AddHandler source.FetchPage, Sub(o, e) e.Result = FetchRowsAsync(e)
+ AddHandler source.GetUniqueValues, Sub(o, e)
+ If Equals(e.PropertyName, "Priority") Then
+ Dim values = [Enum].GetValues(GetType(Priority)).Cast(Of Object)().ToArray()
+ e.Result = Task.FromResult(values)
+ Else
+ Throw New InvalidOperationException()
+ End If
+ End Sub
+ AddHandler source.GetTotalSummaries, Sub(o, e) e.Result = GetTotalSummariesAsync(e)
+ Me.grid.ItemsSource = source
+ End Sub
- AddHandler source.FetchPage, Sub(o, e)
- e.Result = FetchRowsAsync(e)
- End Sub
+ Private Shared Async Function FetchRowsAsync(ByVal e As FetchPageAsyncEventArgs) As Task(Of FetchRowsResult)
+ Dim sortOrder As IssueSortOrder = GetIssueSortOrder(e)
+ Dim filter As IssueFilter = MakeIssueFilter(e.Filter)
+ Dim issues = Await GetIssuesAsync(page:=e.Skip \ e.Take, pageSize:=e.Take, sortOrder:=sortOrder, filter:=filter)
+ Return New FetchRowsResult(issues, hasMoreRows:=issues.Length = e.Take)
+ End Function
- AddHandler source.GetUniqueValues, Sub(o, e)
- If e.PropertyName = "Priority" Then
- Dim values = System.Enum.GetValues(GetType(Priority)).Cast(Of Object)().ToArray()
- e.Result = Task.FromResult(values)
- Else
- Throw New InvalidOperationException()
- End If
- End Sub
+ Private Shared Async Function GetTotalSummariesAsync(ByVal e As GetSummariesAsyncEventArgs) As Task(Of Object())
+ Dim filter As IssueFilter = MakeIssueFilter(e.Filter)
+ Dim summaryValues = Await GetSummariesAsync(filter)
+ Return e.Summaries.[Select](Function(x)
+ If x.SummaryType = SummaryType.Count Then Return CObj(summaryValues.Count)
+ If x.SummaryType = SummaryType.Max AndAlso Equals(x.PropertyName, "Created") Then Return summaryValues.LastCreated
+ Throw New InvalidOperationException()
+ End Function).ToArray()
+ End Function
- AddHandler source.GetTotalSummaries, Sub(o, e)
- e.Result = GetTotalSummariesAsync(e)
- End Sub
+ Private Shared Function GetIssueSortOrder(ByVal e As FetchPageAsyncEventArgs) As IssueSortOrder
+ If e.SortOrder.Length > 0 Then
+ Dim sort = e.SortOrder.[Single]()
+ If Equals(sort.PropertyName, "Created") Then
+ If sort.Direction <> ListSortDirection.Descending Then Throw New InvalidOperationException()
+ Return IssueSortOrder.CreatedDescending
+ End If
- grid.ItemsSource = source
- End Sub
+ If Equals(sort.PropertyName, "Votes") Then
+ Return If(sort.Direction = ListSortDirection.Ascending, IssueSortOrder.VotesAscending, IssueSortOrder.VotesDescending)
+ End If
+ End If
- Private Shared Async Function FetchRowsAsync(ByVal e As FetchPageAsyncEventArgs) As Task(Of FetchRowsResult)
- Dim sortOrder As IssueSortOrder = GetIssueSortOrder(e)
- Dim filter As IssueFilter = MakeIssueFilter(e.Filter)
+ Return IssueSortOrder.Default
+ End Function
-'INSTANT VB WARNING: Instant VB cannot determine whether both operands of this division are integer types - if they are then you should use the VB integer division operator:
- Dim issues = Await IssuesService.GetIssuesAsync(page:= e.Skip / e.Take, pageSize:= e.Take, sortOrder:= sortOrder, filter:= filter)
+ Private Shared Function MakeIssueFilter(ByVal filter As CriteriaOperator) As IssueFilter
+ Return filter.Match(binary:=Function(propertyName, value, type)
+ If Equals(propertyName, "Votes") AndAlso type = BinaryOperatorType.GreaterOrEqual Then Return New IssueFilter(minVotes:=CInt(value))
+ If Equals(propertyName, "Priority") AndAlso type = BinaryOperatorType.Equal Then Return New IssueFilter(priority:=CType(value, Priority))
+ If Equals(propertyName, "Created") Then
+ If type = BinaryOperatorType.GreaterOrEqual Then Return New IssueFilter(createdFrom:=CDate(value))
+ If type = BinaryOperatorType.Less Then Return New IssueFilter(createdTo:=CDate(value))
+ End If
- Return New FetchRowsResult(issues, hasMoreRows:= issues.Length = e.Take)
- End Function
-
- Private Shared Async Function GetTotalSummariesAsync(ByVal e As GetSummariesAsyncEventArgs) As Task(Of Object())
- Dim filter As IssueFilter = MakeIssueFilter(e.Filter)
- Dim summaryValues = Await IssuesService.GetSummariesAsync(filter)
- Return e.Summaries.Select(Function(x)
- If x.SummaryType = SummaryType.Count Then
- Return DirectCast(summaryValues.Count, Object)
- End If
- If x.SummaryType = SummaryType.Max AndAlso x.PropertyName = "Created" Then
- Return summaryValues.LastCreated
- End If
- Throw New InvalidOperationException()
- End Function).ToArray()
- End Function
-
- Private Shared Function GetIssueSortOrder(ByVal e As FetchPageAsyncEventArgs) As IssueSortOrder
- If e.SortOrder.Length > 0 Then
- Dim sort = e.SortOrder.Single()
- If sort.PropertyName = "Created" Then
- If sort.Direction <> ListSortDirection.Descending Then
- Throw New InvalidOperationException()
- End If
- Return IssueSortOrder.CreatedDescending
- End If
- If sort.PropertyName = "Votes" Then
- Return If(sort.Direction = ListSortDirection.Ascending, IssueSortOrder.VotesAscending, IssueSortOrder.VotesDescending)
- End If
- End If
- Return IssueSortOrder.Default
- End Function
-
- Private Shared Function MakeIssueFilter(ByVal filter As CriteriaOperator) As IssueFilter
- Return filter.Match(binary:= Function(propertyName, value, type)
- If propertyName = "Votes" AndAlso type = BinaryOperatorType.GreaterOrEqual Then
- Return New IssueFilter(minVotes:= CInt(Math.Truncate(value)))
- End If
- If propertyName = "Priority" AndAlso type = BinaryOperatorType.Equal Then
- Return New IssueFilter(priority:= CType(value, Priority))
- End If
- If propertyName = "Created" Then
- If type = BinaryOperatorType.GreaterOrEqual Then
- Return New IssueFilter(createdFrom:= CDate(value))
- End If
- If type = BinaryOperatorType.Less Then
- Return New IssueFilter(createdTo:= CDate(value))
- End If
- End If
- Throw New InvalidOperationException()
- End Function, [and]:= Function(filters)
- Return New IssueFilter(createdFrom:= filters.Select(Function(x) x.CreatedFrom).SingleOrDefault(Function(x) x IsNot Nothing), createdTo:= filters.Select(Function(x) x.CreatedTo).SingleOrDefault(Function(x) x IsNot Nothing), minVotes:= filters.Select(Function(x) x.MinVotes).SingleOrDefault(Function(x) x IsNot Nothing), priority:= filters.Select(Function(x) x.Priority).SingleOrDefault(Function(x) x IsNot Nothing))
- End Function, null:= CType(Nothing, IssueFilter))
- End Function
- End Class
+ Throw New InvalidOperationException()
+ End Function, [and]:=Function(filters) New IssueFilter(createdFrom:=filters.[Select](Function(x) x.CreatedFrom).SingleOrDefault(Function(x) x IsNot Nothing), createdTo:=filters.[Select](Function(x) x.CreatedTo).SingleOrDefault(Function(x) x IsNot Nothing), minVotes:=filters.[Select](Function(x) x.MinVotes).SingleOrDefault(Function(x) x IsNot Nothing), priority:=filters.[Select](Function(x) x.Priority).SingleOrDefault(Function(x) x IsNot Nothing)), null:=Nothing)
+ End Function
+ End Class
End Namespace
diff --git a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.sln b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.sln
index 4693cc7..669f32a 100644
--- a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.sln
+++ b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.sln
@@ -1,3 +1,4 @@
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 16
VisualStudioVersion = 15.0.27130.2020
diff --git a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.vbproj b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.vbproj
index 990f11f..04780f1 100644
--- a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.vbproj
+++ b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.Net5.vbproj
@@ -1,5 +1,6 @@
+ On
net5.0-windows
WinExe
@@ -10,27 +11,10 @@
true
x86;AnyCPU
false
- obj*/**
+ false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -41,4 +25,4 @@
-
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.sln b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.sln
index 31d9b3a..fa29822 100644
--- a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.sln
+++ b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.sln
@@ -1,3 +1,4 @@
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 15.0.27130.2020
diff --git a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.vbproj b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.vbproj
index 5ab4150..f7674b1 100644
--- a/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.vbproj
+++ b/VB/PagedAsyncSourceSample/PagedAsyncSourceSample.vbproj
@@ -1,6 +1,7 @@
-
+
+ On
Debug
AnyCPU
{79E2DF88-9F7F-4E69-BFFC-2EB43ED750AC}
@@ -11,11 +12,8 @@
v4.5.2
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ 4
true
- On
- Binary
- Off
- On
obj.NetFX
@@ -24,41 +22,19 @@
full
false
bin\Debug\
- true
- true
+ DEBUG,TRACE
prompt
- true
+ 4
AnyCPU
pdbonly
true
bin\Release\
- false
- true
+ TRACE
prompt
- true
+ 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -84,7 +60,7 @@
-
+
MSBuild:Compile
Designer
@@ -92,8 +68,8 @@
MSBuild:Compile
Designer
-
- Application.xaml
+
+ App.xaml
Code
@@ -108,32 +84,31 @@
-
+
Code
-
+
True
True
Resources.resx
-
+
True
Settings.settings
True
-
- VbMyResourcesResXFileCodeGenerator
+
+ ResXFileCodeGenerator
Resources.Designer.vb
- My.Resources
+ PagedAsyncSourceSample.Properties
-
+
SettingsSingleFileGenerator
Settings.Designer.vb
- My
-
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceSample/Properties/AssemblyInfo.vb b/VB/PagedAsyncSourceSample/Properties/AssemblyInfo.vb
new file mode 100644
index 0000000..d3d7d29
--- /dev/null
+++ b/VB/PagedAsyncSourceSample/Properties/AssemblyInfo.vb
@@ -0,0 +1,44 @@
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+Imports System.Windows
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+
+
+
+
+
+
+
+' Setting ComVisible to false makes the types in this assembly not visible
+' to COM components. If you need to access a type in this assembly from
+' COM, set the ComVisible attribute to true on that type.
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .csproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to en-US. Then uncomment
+'the NeutralResourceLanguage attribute below. Update the "en-US" in
+'the line below to match the UICulture setting in the project file.
+'[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+'(used if a resource is not found in the page,
+' or application resource dictionaries)
+'(used if a resource is not found in the page,
+' app, or any theme specific resource dictionaries)
+ 'where theme specific resource dictionaries are located
+'where the generic resource dictionary is located
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' [assembly: AssemblyVersion("1.0.*")]
+
+
diff --git a/VB/PagedAsyncSourceSample/Properties/Resources.Designer.vb b/VB/PagedAsyncSourceSample/Properties/Resources.Designer.vb
new file mode 100644
index 0000000..5c662ae
--- /dev/null
+++ b/VB/PagedAsyncSourceSample/Properties/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+Namespace PagedAsyncSourceSample.Properties
+
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ ' This class was auto-generated by the StronglyTypedResourceBuilder
+ ' class via a tool like ResGen or Visual Studio.
+ ' To add or remove a member, edit your .ResX file then rerun ResGen
+ ' with the /str option, or rebuild your VS project.
+
+
+
+ Friend Class Resources
+
+ Private Shared resourceMan As Global.System.Resources.ResourceManager
+
+ Private Shared resourceCulture As Global.System.Globalization.CultureInfo
+
+
+ Friend Sub New()
+ End Sub
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+
+ Friend Shared ReadOnly Property ResourceManager As Global.System.Resources.ResourceManager
+ Get
+ If(PagedAsyncSourceSample.Properties.Resources.resourceMan Is Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Resources", GetType(PagedAsyncSourceSample.Properties.Resources).Assembly)
+ PagedAsyncSourceSample.Properties.Resources.resourceMan = temp
+ End If
+
+ Return PagedAsyncSourceSample.Properties.Resources.resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+
+ Friend Shared Property Culture As Global.System.Globalization.CultureInfo
+ Get
+ Return PagedAsyncSourceSample.Properties.Resources.resourceCulture
+ End Get
+
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ PagedAsyncSourceSample.Properties.Resources.resourceCulture = value
+ End Set
+ End Property
+ End Class
+End Namespace
diff --git a/VB/PagedAsyncSourceSample/Properties/Resources.resx b/VB/PagedAsyncSourceSample/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/VB/PagedAsyncSourceSample/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceSample/Properties/Settings.Designer.vb b/VB/PagedAsyncSourceSample/Properties/Settings.Designer.vb
new file mode 100644
index 0000000..d022030
--- /dev/null
+++ b/VB/PagedAsyncSourceSample/Properties/Settings.Designer.vb
@@ -0,0 +1,25 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+Namespace PagedAsyncSourceSample.Properties
+
+
+
+ Friend NotInheritable Partial Class Settings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As PagedAsyncSourceSample.Properties.Settings = CType((Global.System.Configuration.ApplicationSettingsBase.Synchronized(New PagedAsyncSourceSample.Properties.Settings())), PagedAsyncSourceSample.Properties.Settings)
+
+ Public Shared ReadOnly Property [Default] As Settings
+ Get
+ Return PagedAsyncSourceSample.Properties.Settings.defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
diff --git a/VB/PagedAsyncSourceSample/Properties/Settings.settings b/VB/PagedAsyncSourceSample/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/VB/PagedAsyncSourceSample/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VB/PagedAsyncSourceSamples.Net5.sln b/VB/PagedAsyncSourceSamples.Net5.sln
index 0ccb465..ba51ff0 100644
--- a/VB/PagedAsyncSourceSamples.Net5.sln
+++ b/VB/PagedAsyncSourceSamples.Net5.sln
@@ -1,3 +1,4 @@
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 16
VisualStudioVersion = 16.0.30804.86
diff --git a/VB/PagedAsyncSourceSamples.sln b/VB/PagedAsyncSourceSamples.sln
index 2734d89..4325644 100644
--- a/VB/PagedAsyncSourceSamples.sln
+++ b/VB/PagedAsyncSourceSamples.sln
@@ -1,3 +1,4 @@
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 16.0.30804.86