Public Module Utility Friend EgaltechBlue1 As New SolidColorBrush(Color.FromArgb(255, 77, 132, 196)) Friend EgaltechGreen As New SolidColorBrush(Color.FromArgb(255, 0, 255, 0)) Friend EgaltechRed As New SolidColorBrush(Color.FromArgb(255, 255, 0, 0)) Friend EgaltechYellow As New SolidColorBrush(Color.FromArgb(255, 255, 255, 0)) ' Funzione che permette di trovare il primo contenitore di tipo T di un elemento grafico dependencyObject Public Function FindAncestor(Of T As Class)(dependencyObject As DependencyObject) As T Dim target As DependencyObject = dependencyObject Do target = LogicalTreeHelper.GetParent(target) Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T) If IsNothing(target) Then target = dependencyObject Do target = VisualTreeHelper.GetParent(target) Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T) End If Return TryCast(target, T) End Function Public Sub UpdateUI() ' Costringo ad aggiornare UI Dim nDummy As Integer Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _ New Action(Function() nDummy = 0)) End Sub Friend Function IsUUID(UUID As String) As Boolean Dim result As Guid Return Guid.TryParse(UUID, result) End Function Friend Const ToolDrawUUIDName As String = "*AUTOMATIC*" End Module