Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports DevExpress.Utils.Internal
Imports DevExpress.Xpf.Docking
Imports DevExpress.Xpf.Docking.Base
Imports DevExpress.Xpf.Layout.Core
Imports System.IO
Imports Dock = DevExpress.Xpf.Core.Dock
Namespace DockingDemo
Public Class UniversalContainerConverter(Of T)
Inherits MarkupExtension
Implements IValueConverter
Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
Return Me
End Function
#Region "IValueConverter Members"
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
If parameter Is Nothing Then
Return Orientation.Vertical
End If
Return (CType(parameter, IList))(0)
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Return (CType(value, UniversalContainer(Of T))).Value
End Function
#End Region
End Class
Public Class UniversalContainer(Of T)
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 privateDisplayName As String
Public Property DisplayName() As String
Get
Return privateDisplayName
End Get
Set(ByVal value As String)
privateDisplayName = value
End Set
End Property
Private privateValue As T
Public Property Value() As T
Get
Return privateValue
End Get
Set(ByVal value As T)
privateValue = value
End Set
End Property
End Class
Public Class RTLContainer
Inherits UniversalContainer(Of FlowDirection)
End Class
Public Class RTLContainerConverter
Inherits UniversalContainerConverter(Of FlowDirection)
End Class
Public Class OrientationContainer
Inherits UniversalContainer(Of Orientation)
End Class
Public Class OrientationContainerConverter
Inherits UniversalContainerConverter(Of Orientation)
End Class
Public Class CaptionLocationContainer
Inherits UniversalContainer(Of CaptionLocation)
End Class
Public Class CaptionLocationContainerConverter
Inherits UniversalContainerConverter(Of CaptionLocation)
End Class
Public Class ClosePageButtonShowModeContainer
Inherits UniversalContainer(Of ClosePageButtonShowMode)
End Class
Public Class ClosePageButtonShowModeContainerConverter
Inherits UniversalContainerConverter(Of ClosePageButtonShowMode)
End Class
Public Class TabHeaderLayoutTypeContainer
Inherits UniversalContainer(Of TabHeaderLayoutType)
End Class
Public Class TabHeaderLayoutTypeContainerConverter
Inherits UniversalContainerConverter(Of TabHeaderLayoutType)
End Class
Public Class AutoHideExpandModeContainer
Inherits UniversalContainer(Of AutoHideExpandMode)
End Class
Public Class AutoHideExpandModeContainerConverter
Inherits UniversalContainerConverter(Of AutoHideExpandMode)
End Class
Public Class DockContainer
Inherits UniversalContainer(Of Dock)
End Class
Public Class DockContainerConverter
Inherits UniversalContainerConverter(Of Dock)
End Class
Public Class SourceConverter
Implements IValueConverter
#Region "IValueConverter Members"
Private Function IValueConverter_Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim ms As New MemoryStream(CType(value, Byte()))
Dim source As BitmapSource = New BitmapImage()
source.SetSource(ms)
Return source
End Function
Private Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
#End Region
End Class
Public Enum TileLayout
[Default]
Layout3x2
Layout3x3
Layout4x2
End Enum
Friend NotInheritable Class TileLayoutExtension
Private Sub New()
End Sub
Public Shared Function GetRowCount(ByVal layout As TileLayout) As Integer
Return If((layout = TileLayout.Layout3x3), 3, 2)
End Function
Public Shared Function GetColumnsCount(ByVal layout As TileLayout) As Integer
Return If((layout = TileLayout.Layout4x2), 4, 3)
End Function
End Class
Public Class TileLayoutContainer
Inherits UniversalContainer(Of TileLayout)
End Class
Public Class TileLayoutContainerConverter
Inherits UniversalContainerConverter(Of TileLayout)
End Class
Friend NotInheritable Class TileImageHelper
Private Shared images As IDictionary(Of Integer, Image) = New Dictionary(Of Integer, Image)()
Private Sub New()
End Sub
Public Shared Function GetImage(ByVal index As Integer) As Image
Dim result As Image = Nothing
If (Not images.TryGetValue(index, result)) Then
Dim uri As New Uri(String.Format("/Images/TileImages/{0:D2}.jpg", index), UriKind.Relative)
result = New Image()
result.Source = New System.Windows.Media.Imaging.BitmapImage(uri)
images.Add(index, result)
End If
Return result
End Function
End Class
Public NotInheritable Class FontSizes
Private Shared itemsCore() As Double = { 3.0, 4.0, 5.0, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0, 10.5, 11.0, 11.5, 12.0, 12.5, 13.0, 13.5, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 22.0, 24.0, 26.0, 28.0, 30.0, 32.0, 34.0, 36.0, 38.0, 40.0, 44.0, 48.0, 52.0, 56.0, 60.0, 64.0, 68.0, 72.0, 76.0, 80.0, 88.0, 96.0, 104.0, 112.0, 120.0, 128.0, 136.0, 144.0}
Private Sub New()
End Sub
Public Shared ReadOnly Property Items() As Double()
Get
Return itemsCore
End Get
End Property
End Class
Public NotInheritable Class FontFamilies
Private Shared fontNames_Renamed As List(Of String)
Private Sub New()
End Sub
Public Shared ReadOnly Property FontNames() As List(Of String)
Get
If fontNames_Renamed Is Nothing Then
fontNames_Renamed = GetSystemFontNames()
End If
Return fontNames_Renamed
End Get
End Property
Private Shared Function GetSystemFontNames() As List(Of String)
Return New List(Of String)(FontManager.GetFontFamilyNames())
End Function
End Class
Public Class Employee
Inherits DependencyObject
Private privateTitleOfCourtesy As String
Public Property TitleOfCourtesy() As String
Get
Return privateTitleOfCourtesy
End Get
Set(ByVal value As String)
privateTitleOfCourtesy = value
End Set
End Property
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 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 privateNotes As String
Public Property Notes() As String
Get
Return privateNotes
End Get
Set(ByVal value As String)
privateNotes = value
End Set
End Property
Private privateAddress As String
Public Property Address() As String
Get
Return privateAddress
End Get
Set(ByVal value As String)
privateAddress = value
End Set
End Property
Private privateCountry As String
Public Property Country() As String
Get
Return privateCountry
End Get
Set(ByVal value As String)
privateCountry = value
End Set
End Property
Private privateCity As String
Public Property City() As String
Get
Return privateCity
End Get
Set(ByVal value As String)
privateCity = value
End Set
End Property
Private privateHomePhone As String
Public Property HomePhone() As String
Get
Return privateHomePhone
End Get
Set(ByVal value As String)
privateHomePhone = value
End Set
End Property
Private privateRegion As String
Public Property Region() As String
Get
Return privateRegion
End Get
Set(ByVal value As String)
privateRegion = value
End Set
End Property
Private privatePostalCode As String
Public Property PostalCode() As String
Get
Return privatePostalCode
End Get
Set(ByVal value As String)
privatePostalCode = value
End Set
End Property
Private privateBirthDate As String
Public Property BirthDate() As String
Get
Return privateBirthDate
End Get
Set(ByVal value As String)
privateBirthDate = value
End Set
End Property
Private privateHireDate As String
Public Property HireDate() As String
Get
Return privateHireDate
End Get
Set(ByVal value As String)
privateHireDate = value
End Set
End Property
Private privateExtension As String
Public Property Extension() As String
Get
Return privateExtension
End Get
Set(ByVal value As String)
privateExtension = 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
Public Shared Function CreateSampleData() As List(Of Employee)
Dim employees As New List(Of Employee)()
Dim employee As New Employee()
employee.TitleOfCourtesy = "Dr."
employee.Title = "Sales Representative"
employee.FirstName = "Andrew"
employee.LastName = "Fuller"
employee.Notes = "Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association."
employee.Address = "908 W. Capital Way"
employee.Country = "USA"
employee.City = "Tacoma"
employee.HomePhone = "(206) 555-9482"
employee.Region = "WA"
employee.PostalCode = "98401"
employee.Photo = New BitmapImage(New Uri("/DockingDemo;component/Images/LayoutItemsVisibility/person1.png", UriKind.RelativeOrAbsolute))
employees.Add(employee)
employee = New Employee()
employee.FirstName = "Janet"
employee.LastName = "Leverling"
employee.Notes = "Janet has a BS degree in chemistry from Boston College (1984). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate in 1991 and promoted to sales representative in February 1992."
employee.City = "Kirkland"
employee.Photo = New BitmapImage(New Uri("/DockingDemo;component/Images/LayoutItemsVisibility/person2.png", UriKind.RelativeOrAbsolute))
employees.Add(employee)
employee = New Employee()
employee.TitleOfCourtesy = "Dr."
employee.LastName = "Evil"
employee.Photo = New BitmapImage(New Uri("/DockingDemo;component/Images/LayoutItemsVisibility/person3.png", UriKind.RelativeOrAbsolute))
employees.Add(employee)
Return employees
End Function
End Class
Public Class CommandsModel
Private privateClose As ICommand
Public Property Close() As ICommand
Get
Return privateClose
End Get
Private Set(ByVal value As ICommand)
privateClose = value
End Set
End Property
Private privateMDIStyle As ICommand
Public Property MDIStyle() As ICommand
Get
Return privateMDIStyle
End Get
Private Set(ByVal value As ICommand)
privateMDIStyle = value
End Set
End Property
Private privateCascade As ICommand
Public Property Cascade() As ICommand
Get
Return privateCascade
End Get
Private Set(ByVal value As ICommand)
privateCascade = value
End Set
End Property
Private privateTileHorizontal As ICommand
Public Property TileHorizontal() As ICommand
Get
Return privateTileHorizontal
End Get
Private Set(ByVal value As ICommand)
privateTileHorizontal = value
End Set
End Property
Private privateTileVertical As ICommand
Public Property TileVertical() As ICommand
Get
Return privateTileVertical
End Get
Private Set(ByVal value As ICommand)
privateTileVertical = value
End Set
End Property
Private privateArrangeIcons As ICommand
Public Property ArrangeIcons() As ICommand
Get
Return privateArrangeIcons
End Get
Private Set(ByVal value As ICommand)
privateArrangeIcons = value
End Set
End Property
Public Sub New()
Close = DockControllerCommand.Close
MDIStyle = MDIControllerCommand.ChangeMDIStyle
Cascade = MDIControllerCommand.Cascade
TileHorizontal = MDIControllerCommand.TileHorizontal
TileVertical = MDIControllerCommand.TileVertical
ArrangeIcons = MDIControllerCommand.ArrangeIcons
End Sub
Private privateTarget As Object
Public Property Target() As Object
Get
Return privateTarget
End Get
Set(ByVal value As Object)
privateTarget = value
End Set
End Property
End Class
End Namespace