-pulizia codice

This commit is contained in:
Demetrio Cassarino
2025-03-03 17:17:44 +01:00
parent f3bd024f29
commit 5f2c355121
2 changed files with 35 additions and 32 deletions
+3 -32
View File
@@ -1,6 +1,4 @@
Imports System.Windows.Threading
Public Class ScriptWindowV
Public Class ScriptWindowV
#Region "CONSTRUCTOR"
@@ -24,20 +22,7 @@ Public Class ScriptWindowV
End Sub
Private Sub sNameFile_RichTxBx_TextChanged(sender As Object, e As TextChangedEventArgs)
'Try
' If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.SyntaxHighlighting(sNameFile_RichTxBx)
'Catch ex As Exception
'End Try
If Not IsNothing(Map.refScriptWindowVM) AndAlso Map.refScriptWindowVM.textChangedTimer Is Nothing Then
Map.refScriptWindowVM.textChangedTimer = New DispatcherTimer()
Map.refScriptWindowVM.textChangedTimer.Interval = TimeSpan.FromMilliseconds(500)
AddHandler Map.refScriptWindowVM.textChangedTimer.Tick, AddressOf OnTextChangedTimerTick
End If
If Not IsNothing(Map.refScriptWindowVM) Then
Map.refScriptWindowVM.textChangedTimer.Stop()
Map.refScriptWindowVM.textChangedTimer.Start()
End If
If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.ChangeTimer()
End Sub
Private Sub sNameFile_RichTxBx_SelectionChanged(sender As Object, e As RoutedEventArgs)
@@ -50,15 +35,7 @@ Public Class ScriptWindowV
e.Handled = True
ElseIf e.Key = Key.Tab Then
e.Handled = True
' Ottieni la posizione corrente del cursore
Dim caretPosition As TextPointer = sNameFile_RichTxBx.CaretPosition
' Inserisci un carattere di tabulazione (3 spazi)
Dim tabString As String = " "
Dim run As New Run(tabString)
Dim textRange As New TextRange(caretPosition, caretPosition)
textRange.Text = tabString
' Aggiorna la posizione del cursore
sNameFile_RichTxBx.CaretPosition = textRange.End
Map.refScriptWindowVM.Tabulation(sNameFile_RichTxBx)
End If
End Sub
@@ -69,12 +46,6 @@ Public Class ScriptWindowV
sNameFile_RichTxBx.ScrollToVerticalOffset(sNameFile_RichTxBx.VerticalOffset - linesToScroll)
End Sub
Private Sub OnTextChangedTimerTick(sender As Object, e As EventArgs)
Map.refScriptWindowVM.textChangedTimer.Stop()
If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.SyntaxHighlighting(sNameFile_RichTxBx)
Map.refScriptWindowVM.ProcessTextChanges()
End Sub
#End Region ' Events
End Class