efb250b4a4
- aggiunto il campo "Weight" al general del door, - aggiunta di una variabile booleana alla funzione ReadDDF nella classe Door per permettere di stampare le funzioni scritte nelle textbox, attualmente no è in uso (settata True)
811 lines
26 KiB
VB.net
811 lines
26 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
Imports EgtUILib
|
|
|
|
Public Class OptionsViewModel
|
|
Implements INotifyPropertyChanged
|
|
|
|
Dim m_rfCurrDoor As Door
|
|
|
|
Public ReadOnly Property LanguageList As ObservableCollection(Of Language)
|
|
Get
|
|
Return OptionModule.m_LanguageList
|
|
End Get
|
|
End Property
|
|
|
|
Public Property SelectedLanguage As Language
|
|
Get
|
|
Return OptionModule.m_SelectedLanguage
|
|
End Get
|
|
Set(value As Language)
|
|
If value IsNot OptionModule.m_SelectedLanguage Then
|
|
OptionModule.m_SelectedLanguage = value
|
|
WritePrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property MeasureUnitList As List(Of String)
|
|
Get
|
|
Return OptionModule.m_MeasureUnitList
|
|
End Get
|
|
End Property
|
|
|
|
Public Property SelectedMeasureUnit As String
|
|
Get
|
|
Return OptionModule.m_SelectedMeasureUnit
|
|
End Get
|
|
Set(value As String)
|
|
If value IsNot OptionModule.m_SelectedMeasureUnit Then
|
|
OptionModule.m_SelectedMeasureUnit = value
|
|
' iniziliazzo il valore dell'unità di misura
|
|
DdfFile.UnitMeasure = value
|
|
If value = OptionModule.m_MeasureUnitList(0) Then
|
|
OptionModule.m_bIsMmUnit = True
|
|
ElseIf value = OptionModule.m_MeasureUnitList(1) Then
|
|
OptionModule.m_bIsMmUnit = False
|
|
End If
|
|
EgtSetUiUnits(OptionModule.m_bIsMmUnit)
|
|
WritePrivateProfileString(S_SCENE, K_MMUNITS, If(OptionModule.m_bIsMmUnit, 1, 0).ToString)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property OptionLauncher As List(Of String)
|
|
Get
|
|
Return OptionModule.m_OptionLauncherList
|
|
End Get
|
|
End Property
|
|
|
|
Public Property SelectedOptionLauncher As String
|
|
Get
|
|
Return OptionModule.m_SelectedOptionLauncher
|
|
End Get
|
|
Set(value As String)
|
|
If value IsNot OptionModule.m_SelectedOptionLauncher Then
|
|
OptionModule.m_SelectedOptionLauncher = Trim(value)
|
|
Select Case OptionModule.m_SelectedOptionLauncher
|
|
Case "Open Window"
|
|
WritePrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(0))
|
|
Case "Last Project"
|
|
WritePrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(1))
|
|
Case "Empty"
|
|
WritePrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(2))
|
|
End Select
|
|
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Carico i parametri associati al Bevel Up
|
|
Public Property BevelUpIsChecked As Boolean
|
|
Get
|
|
If OptionModule.m_bBevelUp = Visibility.Visible Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
'Return OptionModule.m_bBevelUp
|
|
End Get
|
|
Set(value As Boolean)
|
|
' se sto accendendo o spegmemdo un bevel
|
|
If QuestionSetBevel(CheckBevel(OptionModule.m_bBevelUp, value)) Then
|
|
If value Then
|
|
OptionModule.m_bBevelUp = Visibility.Visible
|
|
Else
|
|
OptionModule.m_bBevelUp = Visibility.Collapsed
|
|
End If
|
|
|
|
If value Then
|
|
DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "1")
|
|
Else
|
|
DefaultWritePrivateProfileString(S_EDGE, K_BEVELU_INI, "0")
|
|
End If
|
|
RefreshEdgeTypeList()
|
|
NotifyPropertyChanged("EdgeTypeList")
|
|
Else
|
|
Return
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Carico i parametri associati al Bevel Down
|
|
Public Property BevelDownIsChecked As Boolean
|
|
Get
|
|
If OptionModule.m_bBevelDown = Visibility.Visible Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End Get
|
|
Set(value As Boolean)
|
|
If QuestionSetBevel(CheckBevel(OptionModule.m_bBevelDown, value)) Then
|
|
If value Then
|
|
OptionModule.m_bBevelDown = Visibility.Visible
|
|
Else
|
|
OptionModule.m_bBevelDown = Visibility.Collapsed
|
|
End If
|
|
If value Then
|
|
DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "1")
|
|
Else
|
|
DefaultWritePrivateProfileString(S_EDGE, K_BEVELD_INI, "0")
|
|
End If
|
|
RefreshEdgeTypeList()
|
|
Else
|
|
Return
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Carico i valori di Default della porta
|
|
Public Property WidthValue As String
|
|
Get
|
|
Return OptionModule.m_Width
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_Width = value
|
|
DefaultWritePrivateProfileString(S_SIZE, K_WIDTH_INI, OptionModule.m_Width)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property HeightValue As String
|
|
Get
|
|
Return OptionModule.m_Height
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_Height = value
|
|
DefaultWritePrivateProfileString(S_SIZE, K_HEIGHT_INI, OptionModule.m_Height)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ThicknessValue As String
|
|
Get
|
|
Return OptionModule.m_Thickness
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_Thickness = value
|
|
DefaultWritePrivateProfileString(S_SIZE, K_THICKNESS_INI, OptionModule.m_Thickness)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property WeightValue As String
|
|
Get
|
|
Return OptionModule.m_Weight
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_Weight = value
|
|
DefaultWritePrivateProfileString(S_SIZE, K_WEIGHT_INI, OptionModule.m_Weight)
|
|
End Set
|
|
End Property
|
|
|
|
Public Shared Property IsCheckedWeight As Boolean
|
|
Get
|
|
If Door.IsCheckedWeight = Visibility.Visible Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value Then
|
|
Door.IsCheckedWeight = Visibility.Visible
|
|
DefaultWritePrivateProfileString(S_SIZE, K_WEIGHTISCHECKED_INI, "1")
|
|
Else
|
|
If Door.IsCheckedWeight = Visibility.Visible Then
|
|
If MessageBox.Show("Caution. Weight is setted in the current door. Do you want to remove?", "Questyion", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) = MessageBoxResult.Yes Then
|
|
Door.IsCheckedWeight = Visibility.Collapsed
|
|
DefaultWritePrivateProfileString(S_SIZE, K_WEIGHTISCHECKED_INI, "0")
|
|
Else
|
|
Return
|
|
End If
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property SwingTypeList As List(Of String)
|
|
Get
|
|
Return OptionModule.m_SwingTypeList
|
|
End Get
|
|
End Property
|
|
|
|
Public Property SwingValue As String
|
|
Get
|
|
Return OptionModule.m_Swing
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_Swing = value
|
|
DefaultWritePrivateProfileString(S_SIZE, K_SWING_INI, OptionModule.m_Swing)
|
|
End Set
|
|
End Property
|
|
|
|
'Private Shared m_EdgeTypeList As New ObservableCollection(Of EdgeType)
|
|
Public Shared ReadOnly Property EdgeTypeList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
Return Door.m_EdgeTypeList
|
|
End Get
|
|
End Property
|
|
|
|
' ''Public Property EdgeTypeList As ObservableCollection(Of String)
|
|
' '' Get
|
|
' '' Return Door.m_EdgeTypeList
|
|
' '' End Get
|
|
' '' Set(value As ObservableCollection(Of String))
|
|
' '' ' carico la lista degli EdgeType appena aggiornata
|
|
' '' Door.m_EdgeTypeList = value
|
|
' '' ' aggiorno le lista pressenti nella pagina delle impostazioni
|
|
' '' NotifyPropertyChanged("EdgeTypeList")
|
|
' '' ' verifico che esista una porta
|
|
' '' If Not IsNothing(m_rfCurrDoor) Then
|
|
' '' ' Aggiorno le liste degli elementi
|
|
' '' m_rfCurrDoor.NotifyPropertyChanged("EdgeTypeList")
|
|
' '' 'EdgeDoorControl(m_rfCurrDoor.LockEdgeType)
|
|
' '' m_rfCurrDoor.NotifyPropertyChanged("LockEdgeType")
|
|
' '' m_rfCurrDoor.NotifyPropertyChanged("HingeEdgeType")
|
|
' '' End If
|
|
' '' End Set
|
|
' ''End Property
|
|
|
|
Public Property LockEdgeType As EdgeType
|
|
Get
|
|
If m_LockEdgeType.IsActive = Visibility.Collapsed Then
|
|
m_LockEdgeType = EdgeTypeList(0)
|
|
End If
|
|
Return m_LockEdgeType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
OptionModule.m_LockEdgeType = value
|
|
DefaultWritePrivateProfileString(S_EDGE, K_LOCKEDGE_INI, OptionModule.m_LockEdgeType.Name)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property HingeEdgeType As EdgeType
|
|
Get
|
|
If m_HingeEdgeType.IsActive = Visibility.Collapsed Then
|
|
m_HingeEdgeType = EdgeTypeList(0)
|
|
End If
|
|
Return m_HingeEdgeType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
m_HingeEdgeType = value
|
|
DefaultWritePrivateProfileString(S_EDGE, K_HINGEDGE_INI, OptionModule.m_HingeEdgeType.Name)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property TopType As EdgeType
|
|
Get
|
|
If m_TopType.IsActive = Visibility.Collapsed Then
|
|
m_TopType = EdgeTypeList(0)
|
|
End If
|
|
Return OptionModule.m_TopType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
OptionModule.m_TopType = value
|
|
DefaultWritePrivateProfileString(S_EDGE, K_TOPEDGE_INI, OptionModule.m_TopType.Name)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property BottomType As EdgeType
|
|
Get
|
|
If m_BottomType.IsActive = Visibility.Collapsed Then
|
|
m_BottomType = EdgeTypeList(0)
|
|
End If
|
|
Return OptionModule.m_BottomType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
OptionModule.m_BottomType = value
|
|
DefaultWritePrivateProfileString(S_EDGE, K_BOTTOMEDGE_INI, OptionModule.m_BottomType.Name)
|
|
End Set
|
|
End Property
|
|
|
|
' is Checked
|
|
Public Property LockEdgeIsChecked As Boolean
|
|
Get
|
|
Return OptionModule.m_LockEdgeMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_LockEdgeMachining = value
|
|
If value Then
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_LOCKEDGEISCHECKED_INI, "1")
|
|
Else
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_LOCKEDGEISCHECKED_INI, "0")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property HingeEdgeIsChecked As Boolean
|
|
Get
|
|
Return OptionModule.m_HingeEdgeMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_HingeEdgeMachining = value
|
|
If value Then
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_HINGEDGEEISCHECKED_INI, "1")
|
|
Else
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_HINGEDGEEISCHECKED_INI, "0")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property TopIsChecked As Boolean
|
|
Get
|
|
Return OptionModule.m_TopMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_TopMachining = value
|
|
If value Then
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_TOPISCHECKED_INI, "1")
|
|
Else
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_TOPISCHECKED_INI, "0")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property BottomIsChecked As Boolean
|
|
Get
|
|
Return OptionModule.m_BottomMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_BottomMachining = value
|
|
If value Then
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_BOTTOMISCHECKED_INI, "1")
|
|
Else
|
|
DefaultWritePrivateProfileString(S_MACHINING, K_BOTTOMISCHECKED_INI, "0")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' OverMaterial
|
|
Public Property LockEdgeOverMaterialValue As String
|
|
Get
|
|
Return OptionModule.m_LockEdgeOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_LockEdgeOverMaterial = value
|
|
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_LOCKEDGEOVERMATERIAL_INI, OptionModule.m_LockEdgeOverMaterial)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property HingeEdgeOverMaterialValue As String
|
|
Get
|
|
Return OptionModule.m_HingeEdgeOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_HingeEdgeOverMaterial = value
|
|
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_HINGEDGEOVERMATERIAL_INI, OptionModule.m_HingeEdgeOverMaterial)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property TopOverMaterialValue As String
|
|
Get
|
|
Return OptionModule.m_TopOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_TopOverMaterial = value
|
|
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_TOPOVERMATERIAL_INI, OptionModule.m_TopOverMaterial)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property BottomOverMaterialValue As String
|
|
Get
|
|
Return OptionModule.m_BottomOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
OptionModule.m_BottomOverMaterial = value
|
|
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_BOTTOMOVERMATERIAL_INI, OptionModule.m_BottomOverMaterial)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MyProjectDir As String
|
|
Get
|
|
Return IniFile.m_MyProjectDir
|
|
End Get
|
|
Set(value As String)
|
|
If value IsNot IniFile.m_MyProjectDir Then
|
|
IniFile.m_MyProjectDir = value
|
|
' iniziliazzo il valore dell'unità di misura
|
|
WritePrivateProfileString(S_DOORS, K_MYPROJECTDIR, value)
|
|
End If
|
|
NotifyPropertyChanged("MyProjectDir")
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdCloseOptions As ICommand
|
|
Private m_cmdBrowse As ICommand
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property Title As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 209)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property StartUpMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 210)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CurrentLanguageMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONPAGE + 1)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property LanguageAdvertMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONPAGE + 2)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MeasureUnit As String
|
|
Get
|
|
Return EgtMsg(50211)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DirectoryMsg As String
|
|
Get
|
|
Return EgtMsg(50212)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property General As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 201)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OptionStart As String
|
|
Get
|
|
Return EgtMsg(50213)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CurrentUnitMeasure As String
|
|
Get
|
|
Return EgtMsg(50200)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CurrentDirectiry As String
|
|
Get
|
|
Return EgtMsg(50214)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property WidthMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 1)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EdgeMsg As String
|
|
Get
|
|
Return EgtMsg(50215)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OverMaterialMsg As String
|
|
Get
|
|
Return EgtMsg(50216)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property HeightMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 2)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ThicknessMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 3)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property SwingMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 4)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property LockEdgeMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 5)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property HingeEdgeMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 6)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TopMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 7)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property WeightMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 47)
|
|
End Get
|
|
End Property
|
|
|
|
|
|
Public ReadOnly Property BottomMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 8)
|
|
End Get
|
|
End Property
|
|
|
|
' Machinig
|
|
Public ReadOnly Property LockEdgeOverMaterial As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 202)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property HingeEdgeOverMaterial As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 203)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TopOverMaterial As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 204)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BottomOverMaterial As String
|
|
Get
|
|
Return EgtMsg(MSG_MAINWINDOW + 205)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MsgBrowse As String
|
|
Get
|
|
Return EgtMsg(50217)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MsgClose As String
|
|
Get
|
|
Return EgtMsg(50218)
|
|
End Get
|
|
End Property
|
|
|
|
' BevelMsg
|
|
Public ReadOnly Property BevelMsg As String
|
|
Get
|
|
Return EgtMsg(50219)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BevelUpMsg As String
|
|
Get
|
|
Return EgtMsg(50220)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BevelDownMsg As String
|
|
Get
|
|
Return EgtMsg(50221)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MachinePositionMsg As String
|
|
Get
|
|
Return EgtMsg(50222)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
'' '' Aggiorno la lista dei bevel
|
|
' ''Private Sub RefreshEdgeTypeList()
|
|
' '' ' creo una variabile locale di tipo ObservableCollection
|
|
' '' Dim rEdgeTypeList As New ObservableCollection(Of String)
|
|
' '' ' Carico questa lista leggendo il file Default.ini
|
|
' '' DefaultGetPrivateProfileObservableCollection(S_EDGE, K_EDGETYPE_LIST_INI, rEdgeTypeList)
|
|
' '' ' Confronto la lista appena creata con le indicazioni raccolte nell'OptionModule (verifico se i bevel up e down sono selezionati)
|
|
' '' ' quindi aggiorno la lista eliminando se serve i bevel
|
|
' '' SetEdgeTypeList(rEdgeTypeList, OptionModule.m_bBevelUp, OptionModule.m_bBevelDown)
|
|
' '' ' richiamo la proprietà pubblica di questa classe
|
|
' '' EdgeTypeList = rEdgeTypeList
|
|
' ''End Sub
|
|
|
|
' Controllo di eliminare un bevel dalla lista: 1 se accendo un bevel, 2 se spengo un bevel, -1 tutti i casi che non sono questi
|
|
Private Function CheckBevel(VisibilityBevel As Visibility, bValue As Boolean) As Integer
|
|
Dim bAnser As Integer
|
|
Dim bBevel As Boolean
|
|
If VisibilityBevel = Visibility.Visible Then
|
|
bBevel = True
|
|
Else
|
|
bBevel = False
|
|
End If
|
|
If bBevel And Not bValue Then
|
|
' significa che sta togliendo dalla lista
|
|
bAnser = 1
|
|
ElseIf Not bBevel And bValue Then
|
|
' sto aggiungendo un bevel alla lista
|
|
bAnser = 2
|
|
Else
|
|
' non accade nulla
|
|
bAnser = -1
|
|
End If
|
|
Return bAnser
|
|
End Function
|
|
|
|
' chiedo se vuole continuare: vero se cambia li lista
|
|
Private Function QuestionSetBevel(bCheckBevel As Integer) As Boolean
|
|
If bCheckBevel = 1 Then
|
|
' controllo se to oliminando da uno degli elementi della lista: se si chiedo di continuare
|
|
If m_rfCurrDoor.LockEdgeType.Name = "BU" Or m_rfCurrDoor.LockEdgeType.Name = "BD" Or m_rfCurrDoor.HingeEdgeType.Name = "BU" Or m_rfCurrDoor.HingeEdgeType.Name = "BD" Then
|
|
' Se blocco tutto non accade nulla
|
|
If MessageBox.Show("It is a bevel of the current door. Do You want to proced?", "Caution", MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.No) = MessageBoxResult.No Then
|
|
Return False
|
|
Else
|
|
' se decido di continuare
|
|
Return True
|
|
End If
|
|
Else
|
|
' se non sono presenti elementi nella lista
|
|
Return True
|
|
End If
|
|
' se sto attivando un bevel nella lista
|
|
ElseIf bCheckBevel = 2 Then
|
|
Return True
|
|
Else
|
|
' per tutti gli altri casi (-1) non accade nulla
|
|
Return False
|
|
End If
|
|
End Function
|
|
|
|
' creo la lista di oggetti aggiornando la visibilità dei bevel Up e Down
|
|
Public Sub RefreshEdgeTypeList()
|
|
For Index = 0 To Door.m_EdgeTypeList.Count - 1
|
|
If m_StaticEdgeTypeList(Index) = "BU" Then
|
|
Door.m_EdgeTypeList(Index).Name = m_StaticEdgeTypeList(Index)
|
|
Door.m_EdgeTypeList(Index).IsActive = OptionModule.m_bBevelUp
|
|
ElseIf m_StaticEdgeTypeList(Index) = "BD" Then
|
|
Door.m_EdgeTypeList(Index).Name = m_StaticEdgeTypeList(Index)
|
|
Door.m_EdgeTypeList(Index).IsActive = OptionModule.m_bBevelDown
|
|
Else
|
|
Door.m_EdgeTypeList(Index).Name = m_StaticEdgeTypeList(Index)
|
|
Door.m_EdgeTypeList(Index).IsActive = Visibility.Visible
|
|
End If
|
|
Next
|
|
NotifyPropertyChanged("LockEdgeType")
|
|
m_rfCurrDoor.NotifyPropertyChanged("LockEdgeType")
|
|
NotifyPropertyChanged("HingeEdgeType")
|
|
m_rfCurrDoor.NotifyPropertyChanged("HingeEdgeType")
|
|
NotifyPropertyChanged("TopType")
|
|
m_rfCurrDoor.NotifyPropertyChanged("TopType")
|
|
NotifyPropertyChanged("BottomType")
|
|
m_rfCurrDoor.NotifyPropertyChanged("BottomType")
|
|
End Sub
|
|
|
|
Public Shared Sub CreateEdgeTypeList()
|
|
For Index = 0 To m_StaticEdgeTypeList.Count - 1
|
|
If m_StaticEdgeTypeList(Index) = "BU" Then
|
|
Door.m_EdgeTypeList.Add(New EdgeType(m_StaticEdgeTypeList(Index), OptionModule.m_bBevelUp))
|
|
ElseIf m_StaticEdgeTypeList(Index) = "BD" Then
|
|
Door.m_EdgeTypeList.Add(New EdgeType(m_StaticEdgeTypeList(Index), OptionModule.m_bBevelDown))
|
|
Else
|
|
Door.m_EdgeTypeList.Add(New EdgeType(m_StaticEdgeTypeList(Index), Visibility.Visible))
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Sub New(rCurrDoor As Door)
|
|
m_rfCurrDoor = rCurrDoor
|
|
End Sub
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "CloseOptionsCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that remove the current selected machining.
|
|
''' </summary>
|
|
Public ReadOnly Property CloseOptionsCommand() As ICommand
|
|
Get
|
|
If m_cmdCloseOptions Is Nothing Then
|
|
m_cmdCloseOptions = New Command(AddressOf CloseOptions)
|
|
End If
|
|
Return m_cmdCloseOptions
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
|
|
''' </summary>
|
|
Public Sub CloseOptions()
|
|
' Chiusura finestra
|
|
For Each Window In Application.Current.Windows
|
|
If TypeOf Window Is OptionsView Then
|
|
Dim OptionsWindow As OptionsView = DirectCast(Window, OptionsView)
|
|
' se eseguo una modifica prima di avere una porta...controllo bene!!
|
|
If Not IsNothing(m_rfCurrDoor) Then
|
|
m_rfCurrDoor.VisibilityWeight = Door.IsCheckedWeight
|
|
m_rfCurrDoor.NotifyPropertyChanged("Weight")
|
|
m_rfCurrDoor.NotifyPropertyChanged("VisibilityWeight")
|
|
End If
|
|
OptionsWindow.Close()
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
#End Region ' CloseOptionsCommand
|
|
|
|
Public ReadOnly Property BrowseCommand() As ICommand
|
|
Get
|
|
If m_cmdBrowse Is Nothing Then
|
|
m_cmdBrowse = New Command(AddressOf Browse)
|
|
End If
|
|
Return m_cmdBrowse
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Browse()
|
|
Dim FolderBrowserDialog As New System.Windows.Forms.FolderBrowserDialog
|
|
FolderBrowserDialog.SelectedPath = IniFile.m_MyProjectDir
|
|
' mostriamo la finestra di dialogo aperta fino alla directory MyProjects
|
|
If FolderBrowserDialog.ShowDialog <> Forms.DialogResult.OK Then
|
|
' se la risposta è diversa da OK esce
|
|
Return
|
|
End If
|
|
MyProjectDir = FolderBrowserDialog.SelectedPath
|
|
End Sub
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class EdgeType
|
|
Implements INotifyPropertyChanged
|
|
|
|
Private m_Name As String
|
|
Public Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
m_Name = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsActive As Visibility
|
|
Public Property IsActive As Visibility
|
|
Get
|
|
Return m_IsActive
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_IsActive = value
|
|
NotifyPropertyChanged("IsActive")
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(sName As String, bIsActive As Visibility)
|
|
m_Name = sName
|
|
m_IsActive = bIsActive
|
|
End Sub
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
End Class |