-aggiunto funzione che recupera il testo dal richtextbox
This commit is contained in:
@@ -68,7 +68,6 @@ Public Class ScriptWindowVM
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
m_sNameFile = "Prova"
|
||||
Map.SetRefScriptWindowVM(Me)
|
||||
End Sub
|
||||
|
||||
@@ -114,11 +113,18 @@ Public Class ScriptWindowVM
|
||||
|
||||
Private Sub SaveScript(sPathFileScript As String, sRichTextParagraph As String)
|
||||
Map.refSceneHostVM.SaveProj(sPathFileScript)
|
||||
File.WriteAllText(sPathFileScript, sRichTextParagraph)
|
||||
File.WriteAllText(sPathFileScript, sRichTextParagraph, Encoding.UTF8)
|
||||
End Sub
|
||||
|
||||
Public Function StringFromRichTextBox(ByVal rtb As RichTextBox) As String
|
||||
Dim textRange As New TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd)
|
||||
Public Function RichTextBox(sPathFileScript As String) As String
|
||||
' Recupero richtextbox
|
||||
Dim myRichTextBox As RichTextBox = Map.refScriptWindowV.sNameFile_RichTxBx
|
||||
' Recupero flowdocument
|
||||
Dim myFlowDoc As FlowDocument = Map.refScriptWindowV.FDocumentFile
|
||||
' Assegno al richtextbox il flowdocument
|
||||
myRichTextBox.Document = myFlowDoc
|
||||
' Leggo il richtextbox dall'inizio alla fine
|
||||
Dim textRange As New TextRange(myRichTextBox.Document.ContentStart, myRichTextBox.Document.ContentEnd)
|
||||
Return textRange.Text
|
||||
End Function
|
||||
|
||||
@@ -138,7 +144,11 @@ Public Class ScriptWindowVM
|
||||
End Property
|
||||
|
||||
Public Sub Conferma()
|
||||
SaveScript(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & m_sNameFile & ".lua", m_sRichTextParagraph)
|
||||
' Recupero il file script
|
||||
Dim sFileScript As String = RichTextBox(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & "m_sNameFile" & ".lua")
|
||||
' Salvo il file
|
||||
SaveScript(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & m_sNameFile & ".lua", sFileScript)
|
||||
' Eseguo il file
|
||||
EgtLuaExecFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & m_sNameFile & ".lua")
|
||||
' Imposto stato gestione mouse diretto della scena a nessuno
|
||||
Map.refSceneHostVM.MainScene.SetStatusNull()
|
||||
|
||||
Reference in New Issue
Block a user