5c4a8adf9b
- corretti movimenti e rotazioni di LayerStart, Ribs e Reduce - bottone impostazioni Grid visibile solo se Grid abilitata - migliorato controllo esistenza direttorio generazione CN.
167 lines
6.0 KiB
VB.net
167 lines
6.0 KiB
VB.net
Imports System.Runtime.InteropServices
|
|
Imports System.Threading
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class MyStatusBarVM
|
|
Inherits EgtWPFLib5.StatusBarVM
|
|
|
|
' 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_bStopProgress As Boolean
|
|
Friend ReadOnly Property bStopProgress As Boolean
|
|
Get
|
|
Return m_bStopProgress
|
|
End Get
|
|
End Property
|
|
|
|
Private m_bGridVisibility As Boolean
|
|
Public Property bGridVisibility As Boolean
|
|
Get
|
|
Return m_bGridVisibility
|
|
End Get
|
|
Set(value As Boolean)
|
|
If Map.refRibPanelVM.bGrid_IsChecked Or Map.refStartMachPanelVM.bGrid_IsChecked Or Map.refShellNumberPanelVM.bGrid_IsChecked Then Return
|
|
m_bGridVisibility = value
|
|
EgtSetGridShow(value, value)
|
|
EgtDraw()
|
|
Map.refRibPanelVM.NotifyPropertyChanged(NameOf(Map.refRibPanelVM.bGrid_IsEnabled))
|
|
Map.refStartMachPanelVM.NotifyPropertyChanged(NameOf(Map.refStartMachPanelVM.bGrid_IsEnabled))
|
|
Map.refShellNumberPanelVM.NotifyPropertyChanged(NameOf(Map.refShellNumberPanelVM.bGrid_IsEnabled))
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdStopProgress As ICommand
|
|
|
|
Public ReadOnly Property GridVisibilityMsg As String
|
|
Get
|
|
Return "GRID"
|
|
End Get
|
|
End Property
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in Map
|
|
Map.SetRefMyStatusBarVM(Me)
|
|
' Installo funzione gestione eventi per lua
|
|
EgtSetProcessEvents(m_ProcEventsCallback)
|
|
' Installo funzione output testo su status per lua
|
|
EgtSetOutText(m_OutTextCallback)
|
|
' imposto stato di visualizzazione della griglia
|
|
m_bGridVisibility = GetMainPrivateProfileInt(S_GRID, K_SHOWGRID, 1) <> 0
|
|
NotifyPropertyChanged(NameOf(bGridVisibility))
|
|
' modo di visualizzazione
|
|
Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
|
|
Map.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM))
|
|
' visualizzazione freccia direzione su curve
|
|
Map.refShowPanelVM.CurveDirIsChecked = EgtGetShowCurveDirection()
|
|
End Sub
|
|
|
|
Friend Overloads Sub SetSnapPointType(sSnapPntType As SP)
|
|
Dim BtnColor As Brush
|
|
BtnColor = New SolidColorBrush(SystemColors.ControlColor)
|
|
Select Case sSnapPntType
|
|
Case SP.PT_SKETCH
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1102), BtnColor) 'Sketch Point
|
|
Case SP.PT_GRID
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1104), BtnColor) 'Grid Point
|
|
Case SP.PT_END
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1106), BtnColor) 'End Point
|
|
Case SP.PT_MID
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1108), BtnColor) 'Mid Point
|
|
Case SP.CENTER
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1110), BtnColor) 'Center
|
|
Case SP.CENTROID
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1112), BtnColor) 'Centroid
|
|
Case SP.PT_NEAR
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1114), BtnColor) 'Near Point
|
|
Case SP.PT_INTERS
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1116), BtnColor) 'Inters Point
|
|
Case SP.PT_TANGENT
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1118), BtnColor) 'Tang Point
|
|
Case SP.PT_PERPENDICULAR
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1120), BtnColor) 'Perp Point
|
|
Case SP.PT_MINDIST
|
|
Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1122), BtnColor) 'MinDist Point
|
|
Case Else
|
|
Map.refMyStatusBarVM.SetSnapPointType("---", BtnColor)
|
|
End Select
|
|
End Sub
|
|
|
|
Friend Sub ResetStopProgress()
|
|
m_bStopProgress = False
|
|
End Sub
|
|
|
|
Public Function OutText(ByRef psText As IntPtr) As Boolean
|
|
' Assegno stringa
|
|
OutputMessage = (Marshal.PtrToStringUni(psText))
|
|
' Costringo ad aggiornare
|
|
UpdateUI()
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
|
|
' Se previsto, imposto progress
|
|
If nProg > 0 Then SetLoadingProgress(Math.Min(nProg, 100))
|
|
' Costringo ad aggiornare
|
|
UpdateUI()
|
|
' Eventuale attesa
|
|
Thread.Sleep(nPause)
|
|
' Ritorno eventuale stop
|
|
If m_bStopProgress Then
|
|
m_bStopProgress = False
|
|
Return 1
|
|
Else
|
|
Return 0
|
|
End If
|
|
End Function
|
|
|
|
Friend Sub StartLoading(sMessage As String, bIsStop As Boolean)
|
|
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsActive(bIsStop)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(bIsStop)
|
|
Map.refMyStatusBarVM.SetOutputMessage(sMessage)
|
|
End Sub
|
|
|
|
Friend Sub EndLoading(sMessage As String, Optional nMessageTime As Integer = 3)
|
|
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(False)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsActive(False)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(False)
|
|
Map.refMyStatusBarVM.SetOutputMessage(sMessage, nMessageTime)
|
|
End Sub
|
|
|
|
Friend Sub RefreshMachName()
|
|
' NotifyPropertyChanged(NameOf(CurrMachine))
|
|
End Sub
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "StopProgress"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Exec.
|
|
''' </summary>
|
|
Public ReadOnly Property StopProgress_Command As ICommand
|
|
Get
|
|
If m_cmdStopProgress Is Nothing Then
|
|
m_cmdStopProgress = New Command(AddressOf StopProgress)
|
|
End If
|
|
Return m_cmdStopProgress
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Sub StopProgress()
|
|
m_bStopProgress = True
|
|
End Sub
|
|
|
|
#End Region ' StopProgress
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|