Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/Silverlight/VB/ChartsDemo/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/Silverlight/VB/ChartsDemo/Utils.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Linq
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Data
Imports System.Windows.Resources
Imports System.Xml.Linq
Imports DevExpress.Xpf.Charts
Imports DevExpress.Xpf.Editors
Imports System.Globalization
Imports DevExpress.Utils

Namespace ChartsDemo
	Public NotInheritable Class DataLoader
		Private Sub New()
		End Sub
		Public Shared Function LoadXmlFromResources(ByVal fileName As String) As XDocument
			Try
				Return XDocument.Load("/ChartsDemo;component" & fileName)
			Catch
				Return Nothing
			End Try
		End Function
	End Class

	Public NotInheritable Class DemoModuleControlHelper
		Private Sub New()
		End Sub
		Friend Shared Sub PrepareComboBox(ByVal comboBox As ComboBoxEdit, ParamArray ByVal items() As String)
			For Each item As String In items
				comboBox.Items.Add(item)
			Next item
			comboBox.SelectedIndex = 0
		End Sub
	End Class

	Public NotInheritable Class ToolTipControlHelper
		Private Sub New()
		End Sub
		Friend Shared Sub PrepareToolTipPositionComboBox(ByVal comboBox As ComboBoxEdit)
			comboBox.Items.Add("Mouse Pointer")
			comboBox.Items.Add("Relative")
			comboBox.Items.Add("Free")
			comboBox.SelectedIndex = 0
		End Sub
		Friend Shared Sub PrepareToolTipLocationComboBox(ByVal comboBox As ComboBoxEdit)
			comboBox.Items.Add("Top Right")
			comboBox.Items.Add("Top Left")
			comboBox.Items.Add("Bottom Right")
			comboBox.Items.Add("Bottom Left")
			comboBox.SelectedIndex = 0
		End Sub
		Friend Shared Function GetLocationFromComboBox(ByVal selectedIndex As Integer) As ToolTipLocation
			Select Case selectedIndex
				Case 0
					Return ToolTipLocation.TopRight
				Case 1
					Return ToolTipLocation.TopLeft
				Case 2
					Return ToolTipLocation.BottomRight
				Case Else
					Return ToolTipLocation.BottomLeft
			End Select
		End Function
	End Class

	Public NotInheritable Class ResolveOverlappingModeHelper
		Private Sub New()
		End Sub
		Public Shared Sub PrepareListBox(ByVal listBox As ListBoxEdit, ByVal index As Integer)
			listBox.Items.Add("None")
			listBox.Items.Add("Default")
			listBox.Items.Add("Hide Overlapped")
			listBox.Items.Add("Justify Around Point")
			listBox.Items.Add("Justify All Around Point")
			listBox.SelectedIndex = index
		End Sub
		Public Shared Function GetMode(ByVal listBox As ListBoxEdit) As ResolveOverlappingMode
			Select Case listBox.SelectedIndex
				Case 0
					Return ResolveOverlappingMode.None
				Case 1
					Return ResolveOverlappingMode.Default
				Case 2
					Return ResolveOverlappingMode.HideOverlapped
				Case 3
					Return ResolveOverlappingMode.JustifyAroundPoint
				Case 4
					Return ResolveOverlappingMode.JustifyAllAroundPoint
				Case Else
					Return ResolveOverlappingMode.None
			End Select
		End Function
	End Class

	Public NotInheritable Class RangeArea2DHelper
		Private Sub New()
		End Sub
		Public Shared Sub PrepareComboBox(ByVal comboBox As ComboBoxEdit, ByVal index As Integer)
			comboBox.Items.Add("One Label")
			comboBox.Items.Add("Two Labels")
			comboBox.Items.Add("Min Value Label")
			comboBox.Items.Add("Max Value Label")
			comboBox.Items.Add("Value1 Label")
			comboBox.Items.Add("Value2 Label")
			comboBox.SelectedIndex = index
		End Sub
		Public Shared Function GetMode(ByVal comboBox As ComboBoxEdit) As RangeAreaLabelKind
			Select Case comboBox.SelectedIndex
				Case 0
					Return RangeAreaLabelKind.OneLabel
				Case 1
					Return RangeAreaLabelKind.TwoLabels
				Case 2
					Return RangeAreaLabelKind.MinValueLabel
				Case 3
					Return RangeAreaLabelKind.MaxValueLabel
				Case 4
					Return RangeAreaLabelKind.Value1Label
				Case 5
					Return RangeAreaLabelKind.Value2Label
				Case Else
					Return RangeAreaLabelKind.TwoLabels
			End Select
		End Function
	End Class

	Public NotInheritable Class Marker2DModelKindHelper
		Private Sub New()
		End Sub
		Public Shared Function FindActualMarker2DModelKind(ByVal modelType As Type) As Marker2DKind
			Dim marker2DKinds As IEnumerable(Of Marker2DKind) = Marker2DModel.GetPredefinedKinds()
			For Each marker2DKind As Marker2DKind In marker2DKinds
				If Object.Equals(marker2DKind.Type, modelType) Then
					Return marker2DKind
				End If
			Next marker2DKind
			Return Nothing
		End Function
	End Class

	Public NotInheritable Class Pie2DModelKindHelper
		Private Sub New()
		End Sub
		Public Shared Function FindActualPie2DModelKind(ByVal modelType As Type) As Pie2DKind
			Dim pie2DKinds As IEnumerable(Of Pie2DKind) = Pie2DModel.GetPredefinedKinds()
			For Each pie2DType As Pie2DKind In pie2DKinds
				If Object.Equals(pie2DType.Type, modelType) Then
					Return pie2DType
				End If
			Next pie2DType
			Return Nothing
		End Function
	End Class

	Public NotInheritable Class Bar2DModelKindHelper
		Private Sub New()
		End Sub
		Public Shared Function FindActualBar2DModelKind(ByVal modelType As Type) As Bar2DKind
			Dim bar2DKinds As IEnumerable(Of Bar2DKind) = Bar2DModel.GetPredefinedKinds()
			For Each bar2DKind As Bar2DKind In bar2DKinds
				If Object.Equals(bar2DKind.Type, modelType) Then
					Return bar2DKind
				End If
			Next bar2DKind
			Return Nothing
		End Function
	End Class

	Public NotInheritable Class RangeBar2DModelKindHelper
		Private Sub New()
		End Sub
		Public Shared Function FindActualRangeBar2DModelKind(ByVal modelType As Type) As RangeBar2DKind
			Dim bar2DKinds As IEnumerable(Of RangeBar2DKind) = RangeBar2DModel.GetPredefinedKinds()
			For Each bar2DKind As RangeBar2DKind In bar2DKinds
				If Object.Equals(bar2DKind.Type, modelType) Then
					Return bar2DKind
				End If
			Next bar2DKind
			Return Nothing
		End Function
	End Class

	Public NotInheritable Class Stock2DModelKindHelper
		Private Sub New()
		End Sub
		Public Shared Function FindActualStock2DModelKind(ByVal modelType As Type) As Stock2DKind
			Dim stock2DKinds As IEnumerable(Of Stock2DKind) = Stock2DModel.GetPredefinedKinds()
			For Each stock2DKind As Stock2DKind In stock2DKinds
				If Object.Equals(stock2DKind.Type, modelType) Then
					Return stock2DKind
				End If
			Next stock2DKind
			Return Nothing
		End Function
	End Class

	Public NotInheritable Class CandleStick2DModelKindHelper
		Private Sub New()
		End Sub
		Public Shared Function FindActualCandleStick2DModelKind(ByVal modelType As Type) As CandleStick2DKind
			Dim candleStick2DKinds As IEnumerable(Of CandleStick2DKind) = CandleStick2DModel.GetPredefinedKinds()
			For Each candleStick2DKind As CandleStick2DKind In candleStick2DKinds
				If Object.Equals(candleStick2DKind.Type, modelType) Then
					Return candleStick2DKind
				End If
			Next candleStick2DKind
			Return Nothing
		End Function
	End Class

	Public Class FinancialPoint
		Inherits DependencyObject
		Private argument_Renamed As String
		Private highValue_Renamed As Double
		Private lowValue_Renamed As Double
		Private openValue_Renamed As Double
		Private closeValue_Renamed As Double

		Public Property Argument() As String
			Get
				Return argument_Renamed
			End Get
			Set(ByVal value As String)
				argument_Renamed = value
			End Set
		End Property
		Public Property HighValue() As Double
			Get
				Return highValue_Renamed
			End Get
			Set(ByVal value As Double)
				highValue_Renamed = value
			End Set
		End Property
		Public Property LowValue() As Double
			Get
				Return lowValue_Renamed
			End Get
			Set(ByVal value As Double)
				lowValue_Renamed = value
			End Set
		End Property
		Public Property OpenValue() As Double
			Get
				Return openValue_Renamed
			End Get
			Set(ByVal value As Double)
				openValue_Renamed = value
			End Set
		End Property
		Public Property CloseValue() As Double
			Get
				Return closeValue_Renamed
			End Get
			Set(ByVal value As Double)
				closeValue_Renamed = value
			End Set
		End Property
	End Class

	Public Class IndustryBubblePoint
		Inherits DependencyObject
		Public Shared ReadOnly NameProperty As DependencyProperty
		Public Shared ReadOnly NumberOfCasesProperty As DependencyProperty
		Public Shared ReadOnly RateProperty As DependencyProperty

		Shared Sub New()
			Dim ownerType As Type = GetType(IndustryBubblePoint)
			NameProperty = DependencyProperty.Register("Name", GetType(String), ownerType, New PropertyMetadata(String.Empty))
			NumberOfCasesProperty = DependencyProperty.Register("NumberOfCases", GetType(Integer), ownerType, New PropertyMetadata(0))
			RateProperty = DependencyProperty.Register("Rate", GetType(Double), ownerType, New PropertyMetadata(0.0))
		End Sub

		Public Property Name() As String
			Get
				Return CStr(GetValue(NameProperty))
			End Get
			Set(ByVal value As String)
				SetValue(NameProperty, value)
			End Set
		End Property
		Public Property NumberOfCases() As Integer
			Get
				Return CInt(Fix(GetValue(NumberOfCasesProperty)))
			End Get
			Set(ByVal value As Integer)
				SetValue(NumberOfCasesProperty, value)
			End Set
		End Property
		Public Property Rate() As Double
			Get
				Return CDbl(GetValue(RateProperty))
			End Get
			Set(ByVal value As Double)
				SetValue(RateProperty, value)
			End Set
		End Property
	End Class

	Public Class SeriesTypeItem
		Private ReadOnly diagramType_Renamed As Type
		Private ReadOnly seriesType_Renamed As Type
		Private ReadOnly seriesName As String
		Private ReadOnly seriesCount_Renamed As Integer

		Public ReadOnly Property DiagramType() As Type
			Get
				Return diagramType_Renamed
			End Get
		End Property
		Public ReadOnly Property SeriesType() As Type
			Get
				Return seriesType_Renamed
			End Get
		End Property
		Public ReadOnly Property SeriesCount() As Integer
			Get
				Return seriesCount_Renamed
			End Get
		End Property

		Public Sub New(ByVal diagramType As Type, ByVal seriesType As Type, ByVal seriesName As String)
			Me.New(diagramType, seriesType, seriesName, 1)
		End Sub
		Public Sub New(ByVal diagramType As Type, ByVal seriesType As Type, ByVal seriesName As String, ByVal seriesCount As Integer)
			Me.diagramType_Renamed = diagramType
			Me.seriesType_Renamed = seriesType
			Me.seriesName = seriesName
			Me.seriesCount_Renamed = seriesCount
		End Sub
		Public Overrides Function ToString() As String
			Return seriesName
		End Function
	End Class

	Public Class DemoValuesProvider
		Public ReadOnly Property Bubble2DLabelPositions() As IEnumerable(Of Bubble2DLabelPosition)
			Get
				Return DevExpress.Data.Mask.EnumHelper.GetValues(GetType(Bubble2DLabelPosition)).Cast(Of Bubble2DLabelPosition)()
			End Get
		End Property
		Public ReadOnly Property Bar2DLabelPositions() As IEnumerable(Of Bar2DLabelPosition)
			Get
				Return DevExpress.Data.Mask.EnumHelper.GetValues(GetType(Bar2DLabelPosition)).Cast(Of Bar2DLabelPosition)()
			End Get
		End Property
		Public ReadOnly Property RangeAreaLabelKinds() As IEnumerable(Of RangeAreaLabelKind)
			Get
				Return DevExpress.Data.Mask.EnumHelper.GetValues(GetType(RangeAreaLabelKind)).Cast(Of RangeAreaLabelKind)()
			End Get
		End Property
		Public ReadOnly Property PredefinedBar2DKinds() As IEnumerable(Of Bar2DKind)
			Get
				Return Bar2DModel.GetPredefinedKinds()
			End Get
		End Property
		Public ReadOnly Property PredefinedMarker2DKinds() As IEnumerable(Of Marker2DKind)
			Get
				Return Marker2DModel.GetPredefinedKinds()
			End Get
		End Property
		Public ReadOnly Property PredefinedCandleStick2DKinds() As IEnumerable(Of CandleStick2DKind)
			Get
				Return CandleStick2DModel.GetPredefinedKinds()
			End Get
		End Property
		Public ReadOnly Property PredefinedStock2DKinds() As IEnumerable(Of Stock2DKind)
			Get
				Return Stock2DModel.GetPredefinedKinds()
			End Get
		End Property
		Public ReadOnly Property PredefinedPie2DKinds() As IEnumerable(Of Pie2DKind)
			Get
				Return Pie2DModel.GetPredefinedKinds()
			End Get
		End Property
		Public ReadOnly Property PredefinedRangeBar2DKinds() As IEnumerable(Of RangeBar2DKind)
			Get
				Return RangeBar2DModel.GetPredefinedKinds()
			End Get
		End Property
		Public ReadOnly Property ScrollBarAlignments() As IEnumerable(Of ScrollBarAlignment)
			Get
				Return DevExpress.Data.Mask.EnumHelper.GetValues(GetType(ScrollBarAlignment)).Cast(Of ScrollBarAlignment)()
			End Get
		End Property
	End Class

	Public Enum CircularFunction
		TaubinsHeart
		Cardioid
		Lemniskate
	End Enum

	Public Class FunctionsPointGenerator
		Public Shared Function GeneratePoints(ByVal f As CircularFunction) As List(Of Point)
			Select Case f
				Case CircularFunction.TaubinsHeart
					Return GeneratePointsOfTaubinsHeart()
				Case CircularFunction.Cardioid
					Return GeneratePointsOfCardioid()
				Case CircularFunction.Lemniskate
					Return GeneratePointsOfLemniskate()
				Case Else
					Return Nothing
			End Select
		End Function

		Private Shared Function GeneratePointsOfLemniskate() As List(Of Point)
			Dim list As New List(Of Point)()
			For x As Double = 0 To 359 Step 5
				Dim xRadian As Double = DegreeToRadian(x)
				Dim cos As Double = Math.Cos(2 * xRadian)
				Dim y As Double = Math.Pow(Math.Abs(cos), 2)
				list.Add(New Point(x, y))
			Next x
			Return list
		End Function

		Private Shared Function GeneratePointsOfCardioid() As List(Of Point)
			Dim list As New List(Of Point)()
			Const a As Double = 200
			For x As Double = 0 To 359 Step 15
				Dim y As Double = 2 * a * Math.Cos(DegreeToRadian(x))
				list.Add(New Point(x, y))
			Next x
			Return list
		End Function

		Private Shared Function GeneratePointsOfTaubinsHeart() As List(Of Point)
			Dim list As New List(Of Point)()
			For x As Double = 0 To 359 Step 15
				Dim xRadian As Double = DegreeToRadian(x)
				Dim y As Double = 2 - 2 * Math.Sin(xRadian) + Math.Sin(xRadian) * Math.Sqrt(Math.Abs(Math.Cos(xRadian))) / (Math.Sin(xRadian) + 1.4)
				list.Add(New Point(x, y))
			Next x
			Return list
		End Function

		Private Shared Function DegreeToRadian(ByVal degree As Double) As Double
			Return 2 * Math.PI / 360 * degree
		End Function
	End Class

	Public Class Bar2DKindToTickmarksLengthConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim bar2DKind As Bar2DKind = TryCast(value, Bar2DKind)
			If bar2DKind IsNot Nothing Then
				Select Case bar2DKind.Name
					Case "Glass Cylinder"
						Return 18
					Case "Quasi-3D Bar"
						Return 9
				End Select
			End If
			Return 5
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class Bar2DKindToBar2DModelConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim bar2DKind As Bar2DKind = TryCast(value, Bar2DKind)
			If bar2DKind IsNot Nothing Then
				Return Activator.CreateInstance(bar2DKind.Type)
			End If
			Return value
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class RangeBar2DKindToRangeBar2DModelConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim bar2DKind As RangeBar2DKind = TryCast(value, RangeBar2DKind)
			If bar2DKind IsNot Nothing Then
				Return Activator.CreateInstance(bar2DKind.Type)
			End If
			Return value
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class Marker2DKindToMarker2DModelConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim marker2DKind As Marker2DKind = TryCast(value, Marker2DKind)
			If marker2DKind IsNot Nothing Then
				Return Activator.CreateInstance(marker2DKind.Type)
			End If
			Return value
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class CandleStick2DKindToCandleStick2DModelConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim candleStick2DKind As CandleStick2DKind = TryCast(value, CandleStick2DKind)
			If candleStick2DKind IsNot Nothing Then
				Return Activator.CreateInstance(candleStick2DKind.Type)
			End If
			Return value
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class Stock2DKindToStock2DModelConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim stock2DKind As Stock2DKind = TryCast(value, Stock2DKind)
			If stock2DKind IsNot Nothing Then
				Return Activator.CreateInstance(stock2DKind.Type)
			End If
			Return value
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class Pie2DKindToPie2DModelConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim pie2DKind As Pie2DKind = TryCast(value, Pie2DKind)
			If pie2DKind IsNot Nothing Then
				Return Activator.CreateInstance(pie2DKind.Type)
			End If
			Return value
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class MarkerSizeToLabelIndentConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Return (CDbl(value)) / 2
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class IsCheckedToVisibilityConverter
		Implements IValueConverter
		#Region "IValueConverter Members"
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			If CBool(value) Then
				Return Visibility.Visible
			End If
			Return Visibility.Collapsed
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
		#End Region
	End Class

	Public Class BoolToResolveOverlappingModeConverter
		Implements IValueConverter
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim booleanValue As Boolean = CBool(value)
			If booleanValue = True Then
				Return ResolveOverlappingMode.Default
			Else
				Return ResolveOverlappingMode.None
			End If
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
	End Class

	Public Class StringToRotationDirectionConverter
		Implements IValueConverter
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim str As String = TryCast(value, String)
			If str Is Nothing OrElse targetType IsNot GetType(CircularDiagramRotationDirection) Then
				Return Nothing
			End If
			If str = "Clockwise" Then
				Return CircularDiagramRotationDirection.Clockwise
			Else
				Return CircularDiagramRotationDirection.Counterclockwise
			End If
		End Function

		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
	End Class

	Public Class StringToCircularDiagramShapeStyleConverter
		Implements IValueConverter
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim str As String = TryCast(value, String)
			If str Is Nothing OrElse targetType IsNot GetType(CircularDiagramShapeStyle) Then
				Return Nothing
			End If
			If str = "Circle" Then
				Return CircularDiagramShapeStyle.Circle
			Else
				Return CircularDiagramShapeStyle.Polygon
			End If
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
	End Class

	Public Class StringToCrosshairSnapModeConverter
		Implements IValueConverter
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			Dim str As String = TryCast(value, String)
			If str Is Nothing OrElse targetType IsNot GetType(CrosshairSnapMode) Then
				Return Nothing
			End If
			If str = "Nearest Argument" Then
				Return CrosshairSnapMode.NearestArgument
			Else
				Return CrosshairSnapMode.NearestValue
			End If
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
	End Class

	Public Class NullableBooleanToInvertedBoolConverter
		Implements IValueConverter
		Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
			If TypeOf value Is Boolean? AndAlso targetType Is GetType(Boolean?) Then
				Dim boolValue? As Boolean = CType(value, Boolean?)
				If boolValue.GetValueOrDefault() = True Then
					Return False
				Else
					Return True
				End If
			End If
			Return Nothing
		End Function
		Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
			Return Nothing
		End Function
	End Class

	Public NotInheritable Class PaletteSelectorHelper
		Private Shared actualPalette_Renamed As Palette = New OfficePalette()

		Private Sub New()
		End Sub
		Public Shared Property ActualPalette() As Palette
			Get
				Return actualPalette_Renamed
			End Get
			Set(ByVal value As Palette)
				actualPalette_Renamed = value
			End Set
		End Property
	End Class
End Namespace