127 lines
3.9 KiB
VB.net
127 lines
3.9 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.Runtime.InteropServices
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports System.Threading
|
|
Imports System.Windows.Threading
|
|
Imports System.ComponentModel
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class StatusBarVM
|
|
Inherits EgtWPFLib5.StatusBarVM
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' Funzioni di callback per output In interfaccia da LUA
|
|
'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
|
|
Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
|
|
Private m_RefreshTimer As New DispatcherTimer
|
|
' tempo di cancellazione messaggio
|
|
Private m_nRefreshTime As Integer = 5000
|
|
|
|
' GRAPHICAL ELEMENTS
|
|
Private m_StatusOutput As String
|
|
Public Property StatusOutput As String
|
|
Get
|
|
Return m_StatusOutput
|
|
End Get
|
|
Set(value As String)
|
|
m_StatusOutput = value
|
|
NotifyPropertyChanged("StatusOutput")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_UnitMeasure As String = OptionModule.m_SelectedMeasureUnit
|
|
|
|
Public Property UnitMeasure As String
|
|
Get
|
|
Return m_UnitMeasure
|
|
End Get
|
|
Set(value As String)
|
|
If Trim(value) = ConstGen.VAL_INCHES Then value = "in"
|
|
m_UnitMeasure = value
|
|
NotifyPropertyChanged("UnitMeasure")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SnapPointTypeList As New List(Of SPItem)({New SPItem(SP.PT_END, EgtMsg(1105)), New SPItem(SP.PT_SKETCH, EgtMsg(1102)), New SPItem(SP.PT_MID, EgtMsg(1107)), New SPItem(SP.CENTER, EgtMsg(1109)), New SPItem(SP.PT_INTERS, EgtMsg(1115)), New SPItem(SP.CENTROID, EgtMsg(1111))})
|
|
Public ReadOnly Property SnapPointTypeList As List(Of SPItem)
|
|
Get
|
|
Return m_SnapPointTypeList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SnapPointSelect As SPItem = m_SnapPointTypeList(0)
|
|
Public Property SnapPointSelect As SPItem
|
|
Get
|
|
ActivateSnapPointSelected(m_SnapPointSelect)
|
|
Return m_SnapPointSelect
|
|
End Get
|
|
Set(value As SPItem)
|
|
m_SnapPointSelect = value
|
|
NotifyPropertyChanged("SnapPointSelect")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
' applica la selezione del punto notevole
|
|
Public Sub ActivateSnapPointSelected(SnapPoint As SPItem)
|
|
Map.refSceneManagerVM.ProjectScene.SetSnapPointType(SnapPoint.SPValue)
|
|
End Sub
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
Map.SetRefStatusBarVM(Me)
|
|
'' Installo funzione gestione eventi per lua
|
|
'EgtSetProcessEvents(m_ProcEventsCallback)
|
|
' Installo funzione output testo su status per lua
|
|
EgtSetOutText(m_OutTextCallback)
|
|
m_nRefreshTime = GetMainPrivateProfileInt(S_GENERAL, K_REFRESHTIME, 5000)
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
' riceve le stringhe dei messaggi lua EgtOutText
|
|
Public Function OutText(ByRef psText As IntPtr) As Boolean
|
|
' Assegno stringa
|
|
OutputMessage = (Marshal.PtrToStringUni(psText))
|
|
m_StatusOutput = OutputMessage
|
|
NotifyPropertyChanged("StatusOutput")
|
|
AddHandler m_RefreshTimer.Tick, AddressOf RefreshTimer_tick
|
|
m_RefreshTimer.Interval = TimeSpan.FromMilliseconds(m_nRefreshTime)
|
|
m_RefreshTimer.Start()
|
|
Return True
|
|
End Function
|
|
|
|
' dopo m_nRefreshTime pulisco il messaggio
|
|
Private Sub RefreshTimer_tick()
|
|
m_StatusOutput = String.Empty
|
|
NotifyPropertyChanged("StatusOutput")
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class SPItem
|
|
Private m_SPValue As SP
|
|
Public ReadOnly Property SPValue As SP
|
|
Get
|
|
Return m_SPValue
|
|
End Get
|
|
End Property
|
|
Private m_SPMessage As String
|
|
Public ReadOnly Property SPMessage As String
|
|
Get
|
|
Return m_SPMessage
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(Value As SP, Message As String)
|
|
m_SPValue = Value
|
|
m_SPMessage = Message
|
|
End Sub
|
|
|
|
End Class
|
|
|