Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Controls.Primitives
Imports System.Windows.Data
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports DevExpress.Xpf.Docking
Imports DevExpress.Xpf.Editors
Namespace DockingDemo
Partial Public Class Dashboard
Inherits DockingDemoModule
Public Sub New()
InitializeComponent()
AddHandler dockManager.Loaded, AddressOf dockManager_Loaded
AddHandler dockManager.Unloaded, AddressOf dockManager_Unloaded
End Sub
Private selectedTeam As Integer = 0
Private Sub dockManager_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
teamList.ItemsSource = New StoreDB().GetTeams()
Dim currentTeamBinding As New Binding("SelectedItem") With {.Source = teamList}
dockManager.SetBinding(FrameworkElement.DataContextProperty, currentTeamBinding)
teamList.SelectedIndex = selectedTeam
Dim projectListBinding As New Binding("DataContext") With {.Source = dockManager}
projectList.SetBinding(Selector.DataContextProperty, projectListBinding)
projectList.SelectedIndex = 0
Dim currentProjectBinding As New Binding("SelectedItem") With {.Source = projectList}
historyImage.SetBinding(FrameworkElement.DataContextProperty, currentProjectBinding)
End Sub
Private Sub dockManager_Unloaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
selectedTeam = If(teamList IsNot Nothing AndAlso teamList.SelectedIndex >= 0, teamList.SelectedIndex, 0)
End Sub
Private Sub teamList_SelectedIndexChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
projectList.SelectedIndex = 0
End Sub
End Class
#Region "SampleData"
Public Class StoreDB
Public Function GetTeams() As List(Of Team)
Return CreateSampleData()
End Function
Private Shared Function CreateSampleData() As List(Of Team)
Dim lead1 As New Person("John", "Doe") With {.Email = "JohnDoe@team.com", .Phone = "111-2222", .ICQ = "77-77-77", .JobTitle = "Team lead", .Photo = New BitmapImage(New Uri("/DockingDemo;component/Images/Dashboard/1.png", UriKind.Relative))}
Dim lead2 As New Person("Jane", "Doe") With {.Email = "JaneDoe@team.com", .Phone = "222-3333", .ICQ = "88-88-88", .JobTitle = "Team lead", .Photo = New BitmapImage(New Uri("/DockingDemo;component/Images/Dashboard/2.png", UriKind.Relative))}
Dim person1 As New Person("James", "Sheppard") With {.JobTitle = "Developer", .ICQ = "11-11-11"}
Dim person2 As New Person("Kate", "Locke") With {.JobTitle = "Designer", .ICQ = "22-22-22"}
Dim person3 As New Person("Clarie", "Ford") With {.JobTitle = "Developer", .ICQ = "33-33-33"}
Dim person4 As New Person("Jack", "Littleton") With {.JobTitle = "Developer", .ICQ = "44-44-44"}
Dim person5 As New Person("Hugo", "Pace") With {.JobTitle = "Designer", .ICQ = "55-55-55"}
Dim person6 As New Person("Helen", "Hunt") With {.JobTitle = "Developer", .ICQ = "66-66-66"}
Dim project1 As New Project("Billing System") With {.BugsTotal = 15, .IssuesTotal = 27, .History = New BitmapImage(New Uri("/DockingDemo;component/Images/Dashboard/history1.png", UriKind.Relative))}
Dim project2 As New Project("Contract Management System") With {.BugsTotal = 15, .IssuesTotal = 24, .History = New BitmapImage(New Uri("/DockingDemo;component/Images/Dashboard/history2.png", UriKind.Relative))}
Dim project3 As New Project("Internal Software") With {.BugsTotal = 40, .IssuesTotal = 50, .History = New BitmapImage(New Uri("/DockingDemo;component/Images/Dashboard/history3.png", UriKind.Relative))}
Dim project4 As New Project("Company WebSite") With {.BugsTotal = 20, .IssuesTotal = 22, .History = New BitmapImage(New Uri("/DockingDemo;component/Images/Dashboard/history4.png", UriKind.Relative))}
Dim team1 As New Team("Bad Boys") With {.Lead = lead1}
team1.Projects = New List(Of Project)()
team1.Projects.AddRange(New Project() { project1, project2 })
team1.Staff = New List(Of Person)()
team1.Staff.AddRange(New Person() { lead1, person1, person3, person4, person5 })
Dim team2 As New Team("Dream Girls") With {.Lead = lead2}
team2.Projects = New List(Of Project)()
team2.Projects.AddRange(New Project() { project3, project4 })
team2.Staff = New List(Of Person)()
team2.Staff.AddRange(New Person() { lead2, person2, person6 })
Dim list As New List(Of Team)()
list.AddRange(New Team() { team1, team2 })
Return list
End Function
End Class
Public Class Team
Public Sub New(ByVal name As String)
Name = name
End Sub
Private privateName As String
Public Property Name() As String
Get
Return privateName
End Get
Set(ByVal value As String)
privateName = value
End Set
End Property
Private privateLead As Person
Public Property Lead() As Person
Get
Return privateLead
End Get
Set(ByVal value As Person)
privateLead = value
End Set
End Property
Private privateProjects As List(Of Project)
Public Property Projects() As List(Of Project)
Get
Return privateProjects
End Get
Set(ByVal value As List(Of Project))
privateProjects = value
End Set
End Property
Private privateStaff As List(Of Person)
Public Property Staff() As List(Of Person)
Get
Return privateStaff
End Get
Set(ByVal value As List(Of Person))
privateStaff = value
End Set
End Property
End Class
Public Class Person
Public Sub New(ByVal firstName As String, ByVal lastName As String)
FirstName = firstName
LastName = lastName
End Sub
Private privateFirstName As String
Public Property FirstName() As String
Get
Return privateFirstName
End Get
Set(ByVal value As String)
privateFirstName = value
End Set
End Property
Private privateLastName As String
Public Property LastName() As String
Get
Return privateLastName
End Get
Set(ByVal value As String)
privateLastName = value
End Set
End Property
Private privateJobTitle As String
Public Property JobTitle() As String
Get
Return privateJobTitle
End Get
Set(ByVal value As String)
privateJobTitle = value
End Set
End Property
Private privatePhoto As ImageSource
Public Property Photo() As ImageSource
Get
Return privatePhoto
End Get
Set(ByVal value As ImageSource)
privatePhoto = value
End Set
End Property
Private privateICQ As String
Public Property ICQ() As String
Get
Return privateICQ
End Get
Set(ByVal value As String)
privateICQ = value
End Set
End Property
Private privatePhone As String
Public Property Phone() As String
Get
Return privatePhone
End Get
Set(ByVal value As String)
privatePhone = value
End Set
End Property
Private privateEmail As String
Public Property Email() As String
Get
Return privateEmail
End Get
Set(ByVal value As String)
privateEmail = value
End Set
End Property
End Class
Public Class Project
Public Sub New(ByVal title As String)
Title = title
End Sub
Private privateTitle As String
Public Property Title() As String
Get
Return privateTitle
End Get
Set(ByVal value As String)
privateTitle = value
End Set
End Property
Private privateIssuesTotal As Integer
Public Property IssuesTotal() As Integer
Get
Return privateIssuesTotal
End Get
Set(ByVal value As Integer)
privateIssuesTotal = value
End Set
End Property
Private privateBugsTotal As Integer
Public Property BugsTotal() As Integer
Get
Return privateBugsTotal
End Get
Set(ByVal value As Integer)
privateBugsTotal = value
End Set
End Property
Private privateHistory As ImageSource
Public Property History() As ImageSource
Get
Return privateHistory
End Get
Set(ByVal value As ImageSource)
privateHistory = value
End Set
End Property
End Class
#End Region ' SampleData
End Namespace