EgtDOORCreator :

- primo salvataggio.
This commit is contained in:
Dario Sassi
2017-01-11 14:42:25 +00:00
parent 5a397e5867
commit ee575750da
37 changed files with 3379 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
+10
View File
@@ -0,0 +1,10 @@
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ShutdownMode="OnMainWindowClose">
<Application.Resources>
<ResourceDictionary Source="EgtDOORCreatorDictionary.xaml"/>
</Application.Resources>
</Application>
+19
View File
@@ -0,0 +1,19 @@
Class Application
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
' can be handled in this file.
Protected Overrides Sub OnStartUp(e As System.Windows.StartupEventArgs)
MyBase.OnStartup(e)
ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
' Creo la View principale
Dim MainWndView As New MainWindow
MainWindow = MainWndView
' Creo il ViewModel principale
Dim MainWndViewModel As New MainWindowViewModel
' Assegno il ViewModel alla View
MainWndView.DataContext = MainWndViewModel
' Mostro la View principale
MainWndView.Show()
End Sub
End Class
+68
View File
@@ -0,0 +1,68 @@
''' <summary>
''' A command whose sole purpose is to
''' relay its functionality to other
''' objects by invoking delegates. The
''' default return value for the CanExecute
''' method is 'true'.
''' </summary>
Public Class Command
Implements ICommand
#Region "Fields"
Private ReadOnly _execute As Action(Of Object)
Private ReadOnly _canExecute As Predicate(Of Object)
#End Region ' Fields
#Region "Constructors"
''' <summary>
''' Creates a new command that can always execute.
''' </summary>
''' <param name="execute">The execution logic.</param>
Public Sub New(ByVal execute As Action(Of Object))
Me.New(execute, Nothing)
End Sub
''' <summary>
''' Creates a new command.
''' </summary>
''' <param name="execute">The execution logic.</param>
''' <param name="canExecute">The execution status logic.</param>
Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
If execute Is Nothing Then
Throw New ArgumentNullException("execute")
End If
_execute = execute
_canExecute = canExecute
End Sub
#End Region ' Constructors
#Region "ICommand Members"
<DebuggerStepThrough> _
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
Return If(_canExecute Is Nothing, True, _canExecute(parameter))
End Function
Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
AddHandler(ByVal value As EventHandler)
AddHandler CommandManager.RequerySuggested, value
End AddHandler
RemoveHandler(ByVal value As EventHandler)
RemoveHandler CommandManager.RequerySuggested, value
End RemoveHandler
RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
End RaiseEvent
End Event
Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
_execute(parameter)
End Sub
#End Region ' ICommand Members
End Class
+71
View File
@@ -0,0 +1,71 @@
Namespace EgtCAM5
''' <summary>
''' A command whose sole purpose is to
''' relay its functionality to other
''' objects by invoking delegates. The
''' default return value for the CanExecute
''' method is 'true'.
''' </summary>
Public Class RelayCommand
Implements ICommand
#Region "Fields"
Private ReadOnly _execute As Action(Of Object)
Private ReadOnly _canExecute As Predicate(Of Object)
#End Region ' Fields
#Region "Constructors"
''' <summary>
''' Creates a new command that can always execute.
''' </summary>
''' <param name="execute">The execution logic.</param>
Public Sub New(ByVal execute As Action(Of Object))
Me.New(execute, Nothing)
End Sub
''' <summary>
''' Creates a new command.
''' </summary>
''' <param name="execute">The execution logic.</param>
''' <param name="canExecute">The execution status logic.</param>
Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
If execute Is Nothing Then
Throw New ArgumentNullException("execute")
End If
_execute = execute
_canExecute = canExecute
End Sub
#End Region ' Constructors
#Region "ICommand Members"
<DebuggerStepThrough> _
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
Return If(_canExecute Is Nothing, True, _canExecute(parameter))
End Function
Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
AddHandler(ByVal value As EventHandler)
AddHandler CommandManager.RequerySuggested, value
End AddHandler
RemoveHandler(ByVal value As EventHandler)
RemoveHandler CommandManager.RequerySuggested, value
End RemoveHandler
RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
End RaiseEvent
End Event
Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
_execute(parameter)
End Sub
#End Region ' ICommand Members
End Class
End Namespace
+65
View File
@@ -0,0 +1,65 @@
Public Class CompoBtn
Private m_AddNewDoor As Action(Of String)
Private m_Name As String
Public ReadOnly Property Name As String
Get
Return m_Name
End Get
End Property
Private m_IniCompoName As String
Public ReadOnly Property IniCompoName As String
Get
Return m_IniCompoName
End Get
End Property
Private m_DDFCompoName As String
Public ReadOnly Property DDFCompoName As String
Get
Return m_DDFCompoName
End Get
End Property
Sub New(sName As String, sIniCompoName As String, sDDFCompoName As String, ByRef AddNewDoor As Action(Of String))
m_AddNewDoor = AddNewDoor
m_Name = sName
m_IniCompoName = sIniCompoName
m_DDFCompoName = sDDFCompoName
End Sub
' Definizione comando
Private m_CmdCompoBtn As ICommand
#Region "COMMANDS"
#Region "CompoBtnCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property CompoBtnCommand As ICommand
Get
If m_CmdCompoBtn Is Nothing Then
m_CmdCompoBtn = New Command(AddressOf CompoBtn)
End If
Return m_CmdCompoBtn
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub CompoBtn()
m_AddNewDoor(m_IniCompoName)
End Sub
#End Region ' CompoBtnCommand
#End Region 'Commands
End Class
+13
View File
@@ -0,0 +1,13 @@
<UserControl x:Class="CompoPanelView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ItemsControl ItemsSource="{Binding CompoBtnList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Name}" Command="{Binding CompoBtnCommand}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</UserControl>
+3
View File
@@ -0,0 +1,3 @@
Public Class CompoPanelView
End Class
+50
View File
@@ -0,0 +1,50 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
Public Class CompoPanelViewModel
Implements INotifyPropertyChanged
Private m_Door As Door
Public Property Door As Door
Get
Return m_Door
End Get
Set(value As Door)
m_Door = value
End Set
End Property
Private Shared m_CompoBtnList As New ObservableCollection(Of CompoBtn)
Public Shared ReadOnly Property CompoBtnList As ObservableCollection(Of CompoBtn)
Get
Return m_CompoBtnList
End Get
End Property
Sub New(ByRef Door As Door)
Me.m_Door = Door
' Lettura file ini per generare bottoni
Dim Index As Integer = 1
Dim CompoName As String = String.Empty
Dim CompoNameDDF As String = String.Empty
Dim nCompoName As Integer = 0
' ciclo sui Compo
While Index <> -1
CompoGetPrivateProfileNameGroup(ConstCompo.S_COMPO & Index, ConstCompo.K_NAME, CompoNameDDF, CompoName)
' se lo trovo
If CompoName = String.Empty Then
Index = -1
Else
m_CompoBtnList.Add(New CompoBtn(CompoName, ConstCompo.S_COMPO & Index, CompoNameDDF, AddressOf Door.AddNewCompo))
Index += 1
End If
End While
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
+42
View File
@@ -0,0 +1,42 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2015
'----------------------------------------------------------------------------
' File : ConstCompo.vb Data : 12.02.15 Versione : 1.6b3
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
'
'
'
' Modifiche : 12.02.15 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstCompo
Public Const COMPOINI_FILE_NAME As String = "Compo.ini"
Public Const S_COMPO As String = "Compo"
Public Const K_NAME As String = "Name"
Public Const K_COMBOBOX As String = "ComboBox"
Public Const K_TEXTBOX As String = "TextBox"
Public Const K_SPECIALTEXTBOX As String = "SpecialTextBox"
Public Const K_SIZE As String = "size"
Public Const K_WIDTH As String = "width"
Public Const K_HEIGHT As String = "height"
Public Const K_THICKNESS As String = "thickness"
Public Const K_SWING As String = "swing"
Public Const K_PROFILES As String = "profiles"
Public Const K_LOCKEDGE As String = "lockedge"
Public Const K_MACHINING As String = "machining"
Public Const K_OVERMATERAL As String = "overmaterial"
Public Const K_HINGEEDGE As String = "hingeedge"
Public Const K_TOP As String = "top"
Public Const K_BOTTOM As String = "bottom"
Public Const K_SPACE3 As String = " "
Public Const K_SPACE5 As String = " "
Public Const K_LIST As String = "List"
Public Const K_ON As String = "ON"
Public Const K_OFF As String = "OFF"
End Module
+41
View File
@@ -0,0 +1,41 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2015
'----------------------------------------------------------------------------
' File : ConstGen.vb Data : 12.02.15 Versione : 1.6b3
' Contenuto : Modulo costanti generali.
'
'
'
' Modifiche : 12.02.15 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Imports EgtUILib
Module ConstGen
' File con direttorio radice dei dati
Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
Public Const S_DATA As String = "Data"
Public Const K_DATAROOT As String = "DataRoot"
' File con dati di licenza
Public Const LIC_FILE_NAME As String = "EgtDOORCreator.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_KEY As String = "Key"
' File di log generale
Public Const GENLOG_FILE_NAME As String = "EgtDOORCreatorLog#.txt"
' File di log dei comandi
Public Const CMDLOG_FILE_NAME As String = "EgtDOORCreatorLog#.tua"
' Sottodirettorio di configurazione
Public Const CONF_DIR As String = "Config"
' Sottodirettorio delle risorse
Public Const RES_DIR As String = "Resources"
' Sottodirettorio temporaneo
Public Const TEMP_DIR As String = "Temp"
' Sottodirettorio di default per il salvataggio con nome
Public Const SAVE_DFL_NAMEDIR As String = "MyProjects"
End Module
+97
View File
@@ -0,0 +1,97 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2015
'----------------------------------------------------------------------------
' File : ConstIni.vb Data : 12.02.15 Versione : 1.6b3
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
'
'
'
' Modifiche : 12.02.15 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstIni
Public Const INI_FILE_NAME As String = "EgtDOORCreator.ini"
Public Const S_GENERAL As String = "General"
Public Const K_DEBUG As String = "Debug"
Public Const K_LICENCE As String = "Licence"
Public Const K_USERLEVEL As String = "UserLevel"
Public Const K_MAXINST As String = "MaxInstances"
Public Const K_INSTANCES As String = "Instances"
Public Const K_COMMANDLOG As String = "CommandLog"
Public Const K_MESSAGESDIR As String = "MessagesDir"
Public Const K_MESSAGES As String = "Messages"
Public Const K_WINPLACE As String = "WinPlace"
Public Const K_LASTNGEDIR As String = "LastNgeDir"
Public Const K_LASTNGEOBJDIR As String = "LastNgeObjDir"
Public Const K_LASTLUADIR As String = "LastLuaDir"
Public Const K_LASTIMPDIR As String = "LastImpDir"
Public Const K_LASTEXPDIR As String = "LastExpDir"
Public Const K_DRAW2D As String = "2DDraw"
Public Const K_DRAW3D As String = "3DDraw"
Public Const K_MODIFY As String = "Modify"
Public Const K_TRANSFORM As String = "Transform"
Public Const K_ONLYDRAW As String = "OnlyDraw"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
Public Const S_LUA As String = "Lua"
Public Const K_LIBSDIR As String = "LibsDir"
Public Const K_BASELIB As String = "BaseLib"
Public Const S_GEOMDB As String = "GeomDB"
Public Const K_DEFAULTFONT As String = "DefaultFont"
Public Const K_NFEFONTDIR As String = "NfeFontDir"
Public Const K_DEFAULTCOLOR As String = "DefaultColor"
Public Const K_SAVETYPE As String = "SaveType"
Public Const S_OPENGL As String = "OpenGL"
Public Const K_DOUBLEBUFFER As String = "DoubleBuffer"
Public Const K_COLORBITS As String = "ColorBits"
Public Const K_DEPTHBITS As String = "DepthBits"
Public Const K_DRIVER As String = "Driver"
Public Const S_SCENE As String = "Scene"
Public Const K_BACKTOP As String = "BackTop"
Public Const K_BACKBOTTOM As String = "BackBottom"
Public Const K_SHOWGFRAME As String = "ShowGFrame"
Public Const K_MARK As String = "Mark"
Public Const K_SELSURF As String = "SelSurf"
Public Const K_SHOWMODE As String = "ShowMode"
Public Const K_CURVEDIR As String = "CurveDir"
Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
Public Const K_ZOOMWIN As String = "ZoomWin"
Public Const K_DISTLINE As String = "DistLine"
Public Const K_MMUNITS As String = "MmUnits"
Public Const S_GRID As String = "Grid"
Public Const K_DRAWSHOWGRID As String = "DrawShowGrid"
Public Const K_MACHININGSHOWGRID As String = "MachiningShowGrid"
Public Const K_SHOWFRAME As String = "ShowFrame"
Public Const K_SNAPSTEP As String = "SnapStep"
Public Const K_SNAPSTEPINCH As String = "SnapStepInch"
Public Const K_MINLINESSTEP As String = "MinLineSStep"
Public Const K_MAJLINESSTEP As String = "MajLineSStep"
Public Const K_EXTSSTEP As String = "ExtSStep"
Public Const K_MINLNCOLOR As String = "MinLnColor"
Public Const K_MAJLNCOLOR As String = "MajLnColor"
Public Const S_DOORS As String = "Doors"
Public Const K_DDFENABLE As String = "DdfEnable"
Public Const K_DDFEXEC As String = "DdfExec"
Public Const K_DDFFUNCTION As String = "DdfFun"
Public Const K_DDFDIR As String = "DdfDir"
Public Const K_DDFDEFAULTDIR As String = "DdfDefaultDir"
Public Const K_DDFMACHEXEC As String = "DdfMachExec"
Public Const K_TABLESDIR As String = "TablesDir"
Public Const S_OPTIONS As String = "Options"
Public Const S_MRUDOORS As String = "MruDoors"
Public Const K_FILE As String = "File"
End Module
+11
View File
@@ -0,0 +1,11 @@
Module ConstMsg
Public Const MSG_EGTDOORCREATOR As Integer = 50000
Public Const MSG_MAINWINDOW As Integer = MSG_EGTDOORCREATOR
Public Const MSG_MISSINGKEYWD As Integer = 10100
Public Const MSG_ERROR As Integer = MSG_EGTDOORCREATOR + 100
Public Const MSG_EGTWPFLIB5 As Integer = 30000
Public Const MSG_EGTSAVEFILEDIALOG As Integer = MSG_EGTWPFLIB5
End Module
+306
View File
@@ -0,0 +1,306 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports System.Text.RegularExpressions
Friend Module DdfFile
Friend m_Door As New Door
Private FileContent As String()
#Region "Lettura ddf"
Public Function ReadDDF(sPath As String) As Boolean
If Not File.Exists(sPath) Then Return False
FileContent = File.ReadAllLines(sPath)
If FileContent.Count = 0 Then Return False
For LineIndex As Integer = 0 To FileContent.Count - 1
' size
If SearchKey(FileContent(LineIndex), K_SIZE) Then
LineIndex = GetSize(LineIndex + 1)
If LineIndex = -1 Then
MessageBox.Show("Errore in lettura DDF", "Errore", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End If
'' swing
'If SearchKey(FileContent(LineIndex), K_SWING) Then
' If Not GetProfiles(LineIndex + 1) Then
' MessageBox.Show("Errore in lettura DDF", "Errore", MessageBoxButton.OK, MessageBoxImage.Error)
' End If
'End If
' profiles
If SearchKey(FileContent(LineIndex), K_PROFILES) Then
LineIndex = GetProfiles(LineIndex + 1)
If LineIndex = -1 Then
MessageBox.Show("Errore in lettura DDF", "Errore", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End If
Next
Return True
End Function
Friend Function SearchKeyValue(sLine As String, sKey As String) As String
Return Regex.Match(sLine, "\s*" & sKey & "\s*:\s*(.*?\b)\s*$").Groups(1).Value
End Function
Friend Function SearchKey(sLine As String, sKey As String) As Boolean
If Not Regex.Match(sLine, "\s*(" & sKey & ")\s*:\s*$").Groups(1).Value = sKey Then Return False
Return True
End Function
'' Lettura di file DDF e scrittura su lista
'Public Function ReadDDF(ByRef DdfList As List(Of String)) As Boolean
' ' Path Compo.ini file
' Dim m_sCompoIniFile As String = String.Empty
' ' Path DdfFile
' Dim m_sDdfFile As New StreamReader("c:\EgtData\EgtDOORCreator\Myprojects\Prova1.ddf")
' Dim sLine As String = String.Empty
' ' Lettura e caricamento del file ddf su una lista
' Do
' sLine = m_sDdfFile.ReadLine()
' If Not sLine Is Nothing Then
' DdfList.Add(sLine)
' End If
' Loop Until sLine Is Nothing
' m_sDdfFile.Close()
' Return True
'End Function
' Cerco l'indice del paragrafo
Private Function DDFGetLeadIndex(ByRef DdfList As List(Of String), ByRef Lead As String) As Integer
Dim Index As Integer
For Index = 0 To DdfList.Count()
If LTrim(DdfList.Item(Index)) = DdfList.Item(Index) Then
Dim sItem() As String = DdfList.Item(Index).Split(":".ToCharArray)
If sItem(0) = Lead Then
Return Index
End If
End If
Next
Return -1
End Function
' carico valori di Size
Public Function GetSize(Index As Integer) As Integer
Dim Width As String = SearchKeyValue(FileContent(Index), K_WIDTH)
If String.IsNullOrEmpty(Width) Then
If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
Index += 1
Else
m_Door.Width = Width
Index += 1
End If
Dim Height As String = SearchKeyValue(FileContent(Index), K_HEIGHT)
If String.IsNullOrEmpty(Height) Then
If Not SearchKey(FileContent(Index), K_HEIGHT) Then Return -1
Index += 1
Else
m_Door.Height = Height
Index += 1
End If
Dim Thickness As String = SearchKeyValue(FileContent(Index), K_THICKNESS)
If String.IsNullOrEmpty(Thickness) Then
If Not SearchKey(FileContent(Index), K_THICKNESS) Then Return -1
Index += 1
Else
m_Door.Thickness = Thickness
Index += 1
End If
Return Index
End Function
' carico valori swing
Public Function DDFGetSwing(ByRef DdfList As List(Of String)) As Boolean
Dim Index As Integer = DDFGetLeadIndex(DdfList, K_SWING)
If Index <> -1 Then
Dim sItem() As String = DdfList.Item(Index).Split(":".ToCharArray)
m_Door.Swing = sItem(1)
Return True
Else
Return False
End If
End Function
Public Function ConvertStringToBoolean(sItem As String) As Boolean
If sItem = K_ON Then
Return True
Else
Return False
End If
End Function
' carico valori profiles
Public Function GetProfiles(Index As Integer) As Integer
' Lock
Dim LockEdgeType As String = SearchKeyValue(FileContent(Index), K_LOCKEDGE)
If String.IsNullOrEmpty(LockEdgeType) Then
If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
Index += 1
Else
m_Door.LockEdgeType = LockEdgeType
Index += 1
End If
Dim LockEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(LockEdgeMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.LockEdgeMachining = ConvertStringToBoolean(LockEdgeMachining)
Index += 1
End If
Dim LockEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(LockEdgeOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
m_Door.LockEdgeOverMaterial = LockEdgeOverMaterial
Index += 1
End If
' Hinge
Dim HingeEdgeType As String = SearchKeyValue(FileContent(Index), K_HINGEEDGE)
If String.IsNullOrEmpty(HingeEdgeType) Then
If Not SearchKey(FileContent(Index), K_HINGEEDGE) Then Return -1
Index += 1
Else
m_Door.HingeEdgeType = HingeEdgeType
Index += 1
End If
Dim HingeEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(HingeEdgeMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.HingeEdgeMachining = ConvertStringToBoolean(HingeEdgeMachining)
Index += 1
End If
Dim HingeEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(HingeEdgeOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
m_Door.HingeEdgeOverMaterial = HingeEdgeOverMaterial
Index += 1
End If
' Top
Dim TopType As String = SearchKeyValue(FileContent(Index), K_TOP)
If String.IsNullOrEmpty(TopType) Then
If Not SearchKey(FileContent(Index), K_TOP) Then Return -1
Index += 1
Else
m_Door.TopType = TopType
Index += 1
End If
Dim TopMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(TopMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.TopMachining = ConvertStringToBoolean(TopMachining)
Index += 1
End If
Dim TopOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(TopOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
m_Door.TopOverMaterial = TopOverMaterial
Index += 1
End If
' Bottom
Dim BottomType As String = SearchKeyValue(FileContent(Index), K_BOTTOM)
If String.IsNullOrEmpty(BottomType) Then
If Not SearchKey(FileContent(Index), K_BOTTOM) Then Return -1
Index += 1
Else
m_Door.BottomType = BottomType
Index += 1
End If
Dim BottomMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(BottomMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.BottomMachining = ConvertStringToBoolean(BottomMachining)
Index += 1
End If
Dim BottomOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(BottomOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
m_Door.BottomOverMaterial = BottomOverMaterial
Index += 1
End If
Return Index
End Function
' restituisce il nome della componenente
Public Function DDFGetCompoName(ByRef DdfList As List(Of String), ByRef LastIndex As Integer) As String
Dim CompoName As String = String.Empty
Dim Index As Integer
For Index = LastIndex To DdfList.Count()
If LTrim(DdfList.Item(Index)) = DdfList.Item(Index) Then
Dim sItem() As String = DdfList.Item(Index).Split(":".ToCharArray)
CompoName = sItem(0)
End If
Next
Return CompoName
End Function
#End Region ' Lettura ddf
'Genero la lista di parametri di ogni compo che vedo a video
Public Function GenerateCompolistDDF(Compo As Compo) As List(Of String)
Dim CompoListDDF As New List(Of String)
CompoListDDF.Add(Compo.NameDDF & ":")
'aggiungo le combobox
If Compo.ComboBox1Visibility = Visibility.Visible Then
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox1DDFName & ": " & If(Not Path.HasExtension(Compo.ComboBox1SelItem), Compo.ComboBox1ListDDF.Item(Compo.ComboBox1List.IndexOf(Compo.ComboBox1SelItem)), Compo.ComboBox1SelItem.Replace(Path.GetExtension(Compo.ComboBox1SelItem), "")))
End If
If Compo.ComboBox2Visibility = Visibility.Visible Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.ComboBox2DDFName & ": " & If(Not Path.HasExtension(Compo.ComboBox2SelItem), Compo.ComboBox2ListDDF.Item(Compo.ComboBox2List.IndexOf(Compo.ComboBox2SelItem)), Compo.ComboBox2SelItem.Replace(Path.GetExtension(Compo.ComboBox2SelItem), "")))
End If
If Compo.ComboBox3Visibility = Visibility.Visible Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.ComboBox3DDFName & ": " & If(Not Path.HasExtension(Compo.ComboBox3SelItem), Compo.ComboBox3ListDDF.Item(Compo.ComboBox3List.IndexOf(Compo.ComboBox3SelItem)), Compo.ComboBox3SelItem.Replace(Path.GetExtension(Compo.ComboBox3SelItem), "")))
End If
'aggiungo le textbox
Dim dVal As Double = 0
If Compo.TextBox1Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox1Value, dVal)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox1DDFName & ": " & DoubleToString(dVal, 3))
End If
If Compo.TextBox2Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox2Value, dVal)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox2DDFName & ": " & DoubleToString(dVal, 3))
End If
If Compo.TextBox3Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox3Value, dVal)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox3DDFName & ": " & DoubleToString(dVal, 3))
End If
If Compo.TextBox4Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox4Value, dVal)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox4DDFName & ": " & DoubleToString(dVal, 3))
End If
If Compo.TextBox5Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox5Value, dVal)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox5DDFName & ": " & DoubleToString(dVal, 3))
End If
If Compo.SpecialTextBox1Visibility = Visibility.Visible Then
StringToDouble(Compo.SpecialTextBox1Value, dVal)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.SpecialTextBox1DDFName & ": " & DoubleToString(dVal, 3))
End If
' aggiungo una riga vuota
CompoListDDF.Add("")
Return CompoListDDF
End Function
End Module
+646
View File
@@ -0,0 +1,646 @@
Imports System.ComponentModel
Public Class Compo
Implements INotifyPropertyChanged
#Region "GROUP"
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_NameDDF As String
Public Property NameDDF As String
Get
Return m_NameDDF
End Get
Set(value As String)
m_NameDDF = value
End Set
End Property
#Region "ComboBox"
#Region "ComboBox1"
Private m_ComboBox1Index As Integer
Public Property ComboBox1Index As Integer
Get
Return m_ComboBox1Index
End Get
Set(value As Integer)
m_ComboBox1Index = value
End Set
End Property
Private m_ComboBox1Name As String
Public Property ComboBox1Name As String
Get
Return m_ComboBox1Name
End Get
Set(value As String)
m_ComboBox1Name = value
End Set
End Property
Private m_ComboBox1List As List(Of String)
Public Property ComboBox1List As List(Of String)
Get
Return m_ComboBox1List
End Get
Set(value As List(Of String))
m_ComboBox1List = value
End Set
End Property
Private m_ComboBox1ListDDF As List(Of String)
Public Property ComboBox1ListDDF As List(Of String)
Get
Return m_ComboBox1ListDDF
End Get
Set(value As List(Of String))
m_ComboBox1ListDDF = value
End Set
End Property
Private m_ComboBox1SpecialList As List(Of String)
Public Property ComboBox1SpecialList As List(Of String)
Get
Return m_ComboBox1SpecialList
End Get
Set(value As List(Of String))
m_ComboBox1SpecialList = value
End Set
End Property
Private m_ComboBox1SelItem As String
Public Property ComboBox1SelItem As String
Get
Return m_ComboBox1SelItem
End Get
Set(value As String)
m_ComboBox1SelItem = value
Dim bFound As Boolean = False
If Not IsNothing(ComboBox1SpecialList) Then
For Index = 0 To m_ComboBox1SpecialList.Count() - 1
If m_ComboBox1SpecialList(Index) = m_ComboBox1SelItem Then
bFound = True
Exit For
End If
Next
If bFound Then
m_SpecialTextBox1Visibility = Visibility.Visible
Else
m_SpecialTextBox1Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("SpecialTextBox1Visibility")
End If
End Set
End Property
Private m_ComboBox1DDFName As String
Public Property ComboBox1DDFName As String
Get
Return m_ComboBox1DDFName
End Get
Set(value As String)
m_ComboBox1DDFName = value
End Set
End Property
Private m_ComboBox1Visibility As Visibility
Public Property ComboBox1Visibility As Visibility
Get
Return m_ComboBox1Visibility
End Get
Set(value As Visibility)
m_ComboBox1Visibility = value
End Set
End Property
#End Region ' ComboBox 1
#Region "ComboBox2"
Private m_ComboBox2Index As Integer
Public Property ComboBox2Index As Integer
Get
Return m_ComboBox2Index
End Get
Set(value As Integer)
m_ComboBox2Index = value
End Set
End Property
Private m_ComboBox2Name As String
Public Property ComboBox2Name As String
Get
Return m_ComboBox2Name
End Get
Set(value As String)
m_ComboBox2Name = value
End Set
End Property
Private m_ComboBox2List As List(Of String)
Public Property ComboBox2List As List(Of String)
Get
Return m_ComboBox2List
End Get
Set(value As List(Of String))
m_ComboBox2List = value
End Set
End Property
Private m_ComboBox2ListDDF As List(Of String)
Public Property ComboBox2ListDDF As List(Of String)
Get
Return m_ComboBox2ListDDF
End Get
Set(value As List(Of String))
m_ComboBox2ListDDF = value
End Set
End Property
Private m_ComboBox2SpecialList As List(Of String)
Public Property ComboBox2SpecialList As List(Of String)
Get
Return m_ComboBox2SpecialList
End Get
Set(value As List(Of String))
m_ComboBox2SpecialList = value
End Set
End Property
Private m_ComboBox2SelItem As String
Public Property ComboBox2SelItem As String
Get
Return m_ComboBox2SelItem
End Get
Set(value As String)
m_ComboBox2SelItem = value
Dim bFound As Boolean = False
If Not IsNothing(ComboBox2SpecialList) Then
For Index = 0 To m_ComboBox2SpecialList.Count() - 1
If m_ComboBox2SpecialList(Index) = m_ComboBox2SelItem Then
bFound = True
Exit For
End If
Next
If bFound Then
m_SpecialTextBox1Visibility = Visibility.Visible
Else
m_SpecialTextBox1Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("SpecialTextBox1Visibility")
End If
End Set
End Property
Private m_ComboBox2DDFName As String
Public Property ComboBox2DDFName As String
Get
Return m_ComboBox2DDFName
End Get
Set(value As String)
m_ComboBox2DDFName = value
End Set
End Property
Private m_ComboBox2Visibility As Visibility
Public Property ComboBox2Visibility As Visibility
Get
Return m_ComboBox2Visibility
End Get
Set(value As Visibility)
m_ComboBox2Visibility = value
End Set
End Property
#End Region ' ComboBox2
#Region "ComboBox3"
Private m_ComboBox3Index As Integer
Public Property ComboBox3Index As Integer
Get
Return m_ComboBox3Index
End Get
Set(value As Integer)
m_ComboBox3Index = value
End Set
End Property
Private m_ComboBox3Name As String
Public Property ComboBox3Name As String
Get
Return m_ComboBox3Name
End Get
Set(value As String)
m_ComboBox3Name = value
End Set
End Property
Private m_ComboBox3List As List(Of String)
Public Property ComboBox3List As List(Of String)
Get
Return m_ComboBox3List
End Get
Set(value As List(Of String))
m_ComboBox3List = value
End Set
End Property
Private m_ComboBox3ListDDF As List(Of String)
Public Property ComboBox3ListDDF As List(Of String)
Get
Return m_ComboBox3ListDDF
End Get
Set(value As List(Of String))
m_ComboBox3ListDDF = value
End Set
End Property
Private m_ComboBox3SpecialList As List(Of String)
Public Property ComboBox3SpecialList As List(Of String)
Get
Return m_ComboBox3SpecialList
End Get
Set(value As List(Of String))
m_ComboBox3SpecialList = value
End Set
End Property
Private m_ComboBox3SelItem As String
Public Property ComboBox3SelItem As String
Get
Return m_ComboBox3SelItem
End Get
Set(value As String)
m_ComboBox3SelItem = value
Dim bFound As Boolean = False
If Not IsNothing(ComboBox3SpecialList) Then
For Index = 0 To m_ComboBox3SpecialList.Count() - 1
If m_ComboBox3SpecialList(Index) = m_ComboBox3SelItem Then
bFound = True
Exit For
End If
Next
If bFound Then
m_SpecialTextBox1Visibility = Visibility.Visible
Else
m_SpecialTextBox1Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("SpecialTextBox1Visibility")
End If
End Set
End Property
Private m_ComboBox3DDFName As String
Public Property ComboBox3DDFName As String
Get
Return m_ComboBox3DDFName
End Get
Set(value As String)
m_ComboBox3DDFName = value
End Set
End Property
Private m_ComboBox3Visibility As Visibility
Public Property ComboBox3Visibility As Visibility
Get
Return m_ComboBox3Visibility
End Get
Set(value As Visibility)
m_ComboBox3Visibility = value
End Set
End Property
#End Region
#End Region ' ComboBox
#Region "TextBox"
#Region "TextBox1"
Private m_TextBox1Name As String
Public Property TextBox1Name As String
Get
Return m_TextBox1Name
End Get
Set(value As String)
m_TextBox1Name = value
End Set
End Property
Private m_TextBox1DDFName As String
Public Property TextBox1DDFName As String
Get
Return m_TextBox1DDFName
End Get
Set(value As String)
m_TextBox1DDFName = value
End Set
End Property
Private m_TextBox1Value As String
Public Property TextBox1Value As String
Get
Return m_TextBox1Value
End Get
Set(value As String)
m_TextBox1Value = value
End Set
End Property
Private m_TextBox1Visibility As Visibility
Public Property TextBox1Visibility As Visibility
Get
Return m_TextBox1Visibility
End Get
Set(value As Visibility)
m_TextBox1Visibility = value
End Set
End Property
#End Region
#Region "TextBox2"
Private m_TextBox2Name As String
Public Property TextBox2Name As String
Get
Return m_TextBox2Name
End Get
Set(value As String)
m_TextBox2Name = value
End Set
End Property
Private m_TextBox2DDFName As String
Public Property TextBox2DDFName As String
Get
Return m_TextBox2DDFName
End Get
Set(value As String)
m_TextBox2DDFName = value
End Set
End Property
Private m_TextBox2Value As String
Public Property TextBox2Value As String
Get
Return m_TextBox2Value
End Get
Set(value As String)
m_TextBox2Value = value
End Set
End Property
Private m_TextBox2Visibility As Visibility
Public Property TextBox2Visibility As Visibility
Get
Return m_TextBox2Visibility
End Get
Set(value As Visibility)
m_TextBox2Visibility = value
End Set
End Property
#End Region
#Region "TextBox3"
Private m_TextBox3Name As String
Public Property TextBox3Name As String
Get
Return m_TextBox3Name
End Get
Set(value As String)
m_TextBox3Name = value
End Set
End Property
Private m_TextBox3DDFName As String
Public Property TextBox3DDFName As String
Get
Return m_TextBox3DDFName
End Get
Set(value As String)
m_TextBox3DDFName = value
End Set
End Property
Private m_TextBox3Value As String
Public Property TextBox3Value As String
Get
Return m_TextBox3Value
End Get
Set(value As String)
m_TextBox3Value = value
End Set
End Property
Private m_TextBox3Visibility As Visibility
Public Property TextBox3Visibility As Visibility
Get
Return m_TextBox3Visibility
End Get
Set(value As Visibility)
m_TextBox3Visibility = value
End Set
End Property
#End Region
#Region "TextBox4"
Private m_TextBox4Name As String
Public Property TextBox4Name As String
Get
Return m_TextBox4Name
End Get
Set(value As String)
m_TextBox4Name = value
End Set
End Property
Private m_TextBox4DDFName As String
Public Property TextBox4DDFName As String
Get
Return m_TextBox4DDFName
End Get
Set(value As String)
m_TextBox4DDFName = value
End Set
End Property
Private m_TextBox4Value As String
Public Property TextBox4Value As String
Get
Return m_TextBox4Value
End Get
Set(value As String)
m_TextBox4Value = value
End Set
End Property
Private m_TextBox4Visibility As Visibility
Public Property TextBox4Visibility As Visibility
Get
Return m_TextBox4Visibility
End Get
Set(value As Visibility)
m_TextBox4Visibility = value
End Set
End Property
#End Region
#Region "TextBox5"
Private m_TextBox5Name As String
Public Property TextBox5Name As String
Get
Return m_TextBox5Name
End Get
Set(value As String)
m_TextBox5Name = value
End Set
End Property
Private m_TextBox5DDFName As String
Public Property TextBox5DDFName As String
Get
Return m_TextBox5DDFName
End Get
Set(value As String)
m_TextBox5DDFName = value
End Set
End Property
Private m_TextBox5Value As String
Public Property TextBox5Value As String
Get
Return m_TextBox5Value
End Get
Set(value As String)
m_TextBox5Value = value
End Set
End Property
Private m_TextBox5Visibility As Visibility
Public Property TextBox5Visibility As Visibility
Get
Return m_TextBox5Visibility
End Get
Set(value As Visibility)
m_TextBox5Visibility = value
End Set
End Property
#End Region
#Region "SpecialTextBox1"
Private m_SpecialTextBox1Name As String
Public Property SpecialTextBox1Name As String
Get
Return m_SpecialTextBox1Name
End Get
Set(value As String)
m_SpecialTextBox1Name = value
End Set
End Property
Private m_SpecialTextBox1DDFName As String
Public Property SpecialTextBox1DDFName As String
Get
Return m_SpecialTextBox1DDFName
End Get
Set(value As String)
m_SpecialTextBox1DDFName = value
End Set
End Property
Private m_SpecialTextBox1Value As String
Public Property SpecialTextBox1Value As String
Get
Return m_SpecialTextBox1Value
End Get
Set(value As String)
m_SpecialTextBox1Value = value
End Set
End Property
Private m_SpecialTextBox1Visibility As Visibility
Public Property SpecialTextBox1Visibility As Visibility
Get
Return m_SpecialTextBox1Visibility
End Get
Set(value As Visibility)
m_SpecialTextBox1Visibility = value
End Set
End Property
#End Region ' SpecialTextBox1
#End Region ' TextBox
#End Region ' Group
' Definizione comando
Private m_CmdApply As ICommand
Private m_CmdDelete As ICommand
#Region "COMMANDS"
#Region "ApplyCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property ApplyCommand As ICommand
Get
If m_CmdApply Is Nothing Then
m_CmdApply = New Command(AddressOf Apply)
End If
Return m_CmdApply
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Apply()
EgtDoorCreatorMap.m_Door.WriteDDF()
End Sub
#End Region ' ApplyCommand
#Region "DeleteCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property DeleteCommand As ICommand
Get
If m_CmdDelete Is Nothing Then
m_CmdDelete = New Command(AddressOf Delete)
End If
Return m_CmdDelete
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Delete()
EgtDoorCreatorMap.m_Door.RemoveCompo(Me)
End Sub
#End Region ' DeleteCommand
#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
+363
View File
@@ -0,0 +1,363 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports EgtUILib
' data ultima modifica 30/12/2016 ore 19:09
Public Class Door
Implements INotifyPropertyChanged
#Region "GENERAL"
#Region "Size"
Private m_SwingTypeList As List(Of String) = New List(Of String)({"LH", "RH", "LHA", "RHA", "LHI", "RHI", "LHRA", "RHRA", "LHRI", "RHRI"})
Public ReadOnly Property SwingTypeList As List(Of String)
Get
Return m_SwingTypeList
End Get
End Property
Private m_Height As String
Public Property Height As String
Get
Return m_Height
End Get
Set(value As String)
m_Height = value
End Set
End Property
Private m_Width As String
Public Property Width As String
Get
Return m_Width
End Get
Set(value As String)
m_Width = value
End Set
End Property
Private m_Thickness As String
Public Property Thickness As String
Get
Return m_Thickness
End Get
Set(value As String)
m_Thickness = value
End Set
End Property
Private m_Swing As String
Public Property Swing As String
Get
Return m_Swing
End Get
Set(value As String)
m_Swing = value
End Set
End Property
#End Region ' Size
#Region "TypeEdge"
Private m_EdgeTypeList As List(Of String) = New List(Of String)({"SQ", "B", "1B", "2B", "3B", "4B", "CV"})
Public ReadOnly Property EdgeTypeList As List(Of String)
Get
Return m_EdgeTypeList
End Get
End Property
Private m_LockEdgeType As String
Public Property LockEdgeType As String
Get
Return m_LockEdgeType
End Get
Set(value As String)
m_LockEdgeType = value
End Set
End Property
Private m_HingeEdgeType As String
Public Property HingeEdgeType As String
Get
Return m_HingeEdgeType
End Get
Set(value As String)
m_HingeEdgeType = value
End Set
End Property
Private m_TopType As String
Public Property TopType As String
Get
Return m_TopType
End Get
Set(value As String)
m_TopType = value
End Set
End Property
Private m_BottomType As String
Public Property BottomType As String
Get
Return m_BottomType
End Get
Set(value As String)
m_BottomType = value
End Set
End Property
#End Region
#Region "Machining"
Private m_TopMachining As Boolean
Public Property TopMachining As Boolean
Get
Return m_TopMachining
End Get
Set(value As Boolean)
m_TopMachining = value
End Set
End Property
Private m_LockEdgeMachining As Boolean
Public Property LockEdgeMachining As Boolean
Get
Return m_LockEdgeMachining
End Get
Set(value As Boolean)
m_LockEdgeMachining = value
End Set
End Property
Private m_HingeEdgeMachining As Boolean
Public Property HingeEdgeMachining As Boolean
Get
Return m_HingeEdgeMachining
End Get
Set(value As Boolean)
m_HingeEdgeMachining = value
End Set
End Property
Private m_BottomMachining As Boolean
Public Property BottomMachining As Boolean
Get
Return m_BottomMachining
End Get
Set(value As Boolean)
m_BottomMachining = value
End Set
End Property
#End Region
#Region "OverMaterial"
Private m_LockEdgeOverMaterial As String
Public Property LockEdgeOverMaterial As String
Get
Return m_LockEdgeOverMaterial
End Get
Set(value As String)
m_LockEdgeOverMaterial = value
End Set
End Property
Private m_HingeEdgeOverMaterial As String
Public Property HingeEdgeOverMaterial As String
Get
Return m_HingeEdgeOverMaterial
End Get
Set(value As String)
m_HingeEdgeOverMaterial = value
End Set
End Property
Private m_TopOverMaterial As String
Public Property TopOverMaterial As String
Get
Return m_TopOverMaterial
End Get
Set(value As String)
m_TopOverMaterial = value
End Set
End Property
Private m_BottomOverMaterial As String
Public Property BottomOverMaterial As String
Get
Return m_BottomOverMaterial
End Get
Set(value As String)
m_BottomOverMaterial = value
End Set
End Property
#End Region
#End Region ' General
Private m_CompoList As ObservableCollection(Of Compo)
Public Property CompoList As ObservableCollection(Of Compo)
Get
If IsNothing(m_CompoList) Then
m_CompoList = New ObservableCollection(Of Compo)
End If
Return m_CompoList
End Get
Set(value As ObservableCollection(Of Compo))
m_CompoList = value
End Set
End Property
'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini
Friend Sub AddNewCompo(IniCompoName As String)
' creo il nuovo compo
Dim NewCompo As New Compo
' lo modifico in base al tipo passatomi
CompoGetPrivateProfileNameGroup(IniCompoName, ConstCompo.K_NAME, NewCompo.NameDDF, NewCompo.Name)
If CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 1, NewCompo.ComboBox1DDFName, NewCompo.ComboBox1Name) Then
NewCompo.ComboBox1Index = 1
Else
Return
End If
Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 1 & ConstCompo.K_LIST, NewCompo.ComboBox1List, NewCompo.ComboBox1ListDDF)
Case ComboListResult.NOTFOUND
NewCompo.ComboBox1Visibility = Visibility.Collapsed
Case ComboListResult.FOUND
NewCompo.ComboBox1Visibility = Visibility.Visible
Case ComboListResult.MISTAKE
Return
End Select
If CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 2, NewCompo.ComboBox2DDFName, NewCompo.ComboBox2Name) Then
NewCompo.ComboBox2Index = 2
Else
NewCompo.ComboBox2Visibility = Visibility.Collapsed
End If
Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 2 & ConstCompo.K_LIST, NewCompo.ComboBox2List, NewCompo.ComboBox2ListDDF)
Case ComboListResult.NOTFOUND
NewCompo.ComboBox2Visibility = Visibility.Collapsed
Case ComboListResult.FOUND
NewCompo.ComboBox2Visibility = Visibility.Visible
Case ComboListResult.MISTAKE
Return
End Select
If CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 3, NewCompo.ComboBox3DDFName, NewCompo.ComboBox3Name) Then
NewCompo.ComboBox3Index = 3
Else
NewCompo.ComboBox3Visibility = Visibility.Collapsed
End If
Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 3 & ConstCompo.K_LIST, NewCompo.ComboBox3List, NewCompo.ComboBox3ListDDF)
Case ComboListResult.NOTFOUND
NewCompo.ComboBox3Visibility = Visibility.Collapsed
Case ComboListResult.FOUND
NewCompo.ComboBox3Visibility = Visibility.Visible
Case ComboListResult.MISTAKE
Return
End Select
' TextBox
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 1, NewCompo.TextBox1DDFName, NewCompo.TextBox1Name) Then
NewCompo.TextBox1Visibility = Visibility.Collapsed
End If
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 2, NewCompo.TextBox2DDFName, NewCompo.TextBox2Name) Then
NewCompo.TextBox2Visibility = Visibility.Collapsed
End If
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 3, NewCompo.TextBox3DDFName, NewCompo.TextBox3Name) Then
NewCompo.TextBox3Visibility = Visibility.Collapsed
End If
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 4, NewCompo.TextBox4DDFName, NewCompo.TextBox4Name) Then
NewCompo.TextBox4Visibility = Visibility.Collapsed
End If
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 5, NewCompo.TextBox5DDFName, NewCompo.TextBox5Name) Then
NewCompo.TextBox5Visibility = Visibility.Collapsed
End If
'gestione SpeciaTextBox
Dim nComboIndex As Integer = 0
Dim SpecialList As New List(Of String)
If CompoGetPrivateProfileSpecialTextBox(IniCompoName, ConstCompo.K_SPECIALTEXTBOX & 1, NewCompo.SpecialTextBox1DDFName, NewCompo.SpecialTextBox1Name, nComboIndex, SpecialList) Then
Select Case nComboIndex
Case 1
NewCompo.ComboBox1SpecialList = SpecialList
Case 2
NewCompo.ComboBox2SpecialList = SpecialList
Case 3
NewCompo.ComboBox3SpecialList = SpecialList
End Select
End If
' nascondo la SpecialTextBox
NewCompo.SpecialTextBox1Visibility = Visibility.Collapsed
' aggiungo il nuovo compo alla lista
CompoList.Add(NewCompo)
End Sub
Friend Sub RemoveCompo(CompoToRemove As Compo)
CompoList.Remove(CompoToRemove)
End Sub
Friend Sub WriteDDF()
'genero le stringhe che dovranno essere scritte nel DDF
Dim m_GeneralListDDF As New List(Of String)
Dim m_CompoListDDF As New List(Of List(Of String))
'Genero una lista di stringhe senza spaziature
Dim dVal As Double = 0
m_GeneralListDDF.Add(ConstCompo.K_SIZE & ":")
StringToDouble(Width, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 3))
StringToDouble(Height, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 3))
StringToDouble(Thickness, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 3))
' aggiungo una riga vuota per separare la lista successiva
m_GeneralListDDF.Add("")
m_GeneralListDDF.Add("" & ConstCompo.K_SWING & ": " & Swing)
' aggiungo una riga vuota per separare la lista successiva
m_GeneralListDDF.Add("")
m_GeneralListDDF.Add("" & ConstCompo.K_PROFILES & ":")
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & LockEdgeType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(LockEdgeMachining))
StringToDouble(LockEdgeOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & HingeEdgeType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(HingeEdgeMachining))
StringToDouble(HingeEdgeOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & TopType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(TopMachining))
StringToDouble(TopOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & BottomType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(BottomMachining))
StringToDouble(BottomOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
' aggiungo una riga vuota per separare la lista successiva
m_GeneralListDDF.Add("")
'per ogni compo della compolist devo stampare a video
For Each Item As Compo In CompoList
m_GeneralListDDF.AddRange(GenerateCompolistDDF(Item))
Next
File.WriteAllLines("c:\EgtData\EgtDOORCreator\MyProjects\Prova1.ddf", m_GeneralListDDF, Text.Encoding.UTF8)
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
+158
View File
@@ -0,0 +1,158 @@
<UserControl x:Class="DoorParametersView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!--General-->
<TextBlock Text="{Binding WidthMsg}"/>
<TextBox Grid.Column="1"
Text="{Binding Door.Width, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Grid.Row="1" Text="{Binding HeightMsg}"/>
<TextBox Grid.Column="1" Grid.Row="1"
Text="{Binding Door.Height, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="2" Text="{Binding ThicknessMsg}"/>
<TextBox Grid.Column="1" Grid.Row="2"
Text="{Binding Door.Thickness, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Grid.Row="3" Text="{Binding SwingMsg}"/>
<ComboBox Grid.Column="1" Grid.Row="3"
ItemsSource="{Binding Door.SwingTypeList}"
SelectedItem="{Binding Door.Swing}"/>
<!-- Profiles-->
<TextBlock Grid.Column="2" Text="{Binding LockedgeMsg}"/>
<ComboBox Grid.Column="3" ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.LockEdgeType}"/>
<TextBlock Grid.Column="2" Grid.Row="1"
Text="{Binding HingeedgeMsg}"/>
<ComboBox Grid.Column="3" Grid.Row="1"
ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.HingeEdgeType}"/>
<TextBlock Grid.Column="2" Grid.Row="2"
Text="{Binding TopMsg}"/>
<ComboBox Grid.Column="3" Grid.Row="2"
ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.TopType}"/>
<TextBlock Grid.Row="3" Grid.Column="2"
Text="{Binding BottomMsg}"/>
<ComboBox Grid.Column="3" Grid.Row="3"
ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.BottomType}"/>
<!--Machining-->
<CheckBox Grid.Column="4"
IsChecked="{Binding Door.LockEdgeMachining}"
/>
<CheckBox Grid.Column="4" Grid.Row="1"
IsChecked="{Binding Door.HingeEdgeMachining}"
/>
<CheckBox Grid.Column="4" Grid.Row="2"
IsChecked="{Binding Door.TopMachining}"
/>
<CheckBox Grid.Column="4" Grid.Row="3"
IsChecked="{Binding Door.BottomMachining}"
/>
<TextBox Grid.Column="5" Grid.Row="0"
Text="{Binding Door.LockEdgeOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Grid.Column="5" Grid.Row="1"
Text="{Binding Door.HingeEdgeOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Grid.Column="5" Grid.Row="2"
Text="{Binding Door.TopOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Grid.Column="5" Grid.Row="3"
Text="{Binding Door.BottomOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
<ItemsControl Grid.Row="1" ItemsSource="{Binding Door.CompoList}" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<GroupBox Header="{Binding Name}">
<StackPanel>
<UniformGrid Columns="2" Visibility="{Binding ComboBox1Visibility}">
<TextBlock Text="{Binding ComboBox1Name}" />
<ComboBox ItemsSource="{Binding ComboBox1List}"
SelectedItem="{Binding ComboBox1SelItem}"/>
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding ComboBox2Visibility}">
<TextBlock Text="{Binding ComboBox2Name}" />
<ComboBox ItemsSource="{Binding ComboBox2List}"
SelectedItem="{Binding ComboBox2SelItem}"/>
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding ComboBox3Visibility}">
<TextBlock Text="{Binding ComboBox3Name}" />
<ComboBox ItemsSource="{Binding ComboBox3List}"
SelectedItem="{Binding ComboBox3SelItem}"/>
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox1Visibility}">
<TextBlock Text="{Binding TextBox1Name}" />
<TextBox Text="{Binding TextBox1Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox2Visibility}">
<TextBlock Text="{Binding TextBox2Name}" />
<TextBox Text="{Binding TextBox2Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox3Visibility}">
<TextBlock Text="{Binding TextBox3Name}" />
<TextBox Text="{Binding TextBox3Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox4Visibility}">
<TextBlock Text="{Binding TextBox4Name}" />
<TextBox Text="{Binding TextBox4Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox5Visibility}">
<TextBlock Text="{Binding TextBox5Name}" />
<TextBox Text="{Binding TextBox5Value}" />
</UniformGrid>
<!--SpecialTextBox1 DataContextChanged=""-->
<UniformGrid Columns="2" Visibility="{Binding SpecialTextBox1Visibility}">
<TextBlock Text="{Binding SpecialTextBox1Name}" />
<TextBox Text="{Binding SpecialTextBox1Value}" />
</UniformGrid>
<UniformGrid Columns="2">
<Button Content="{Binding DataContext.ApplyBtnMsg, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Command="{Binding ApplyCommand}"/>
<Button Content="{Binding DataContext.DeleteBtnMsg, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Command="{Binding DeleteCommand}"/>
</UniformGrid>
</StackPanel>
</GroupBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
<!--<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>-->
</ItemsControl>
</Grid>
</UserControl>
@@ -0,0 +1,6 @@
Public Class DoorParametersView
Private Sub ComboBox_DataContextChanged(sender As Object, e As DependencyPropertyChangedEventArgs)
End Sub
End Class
+83
View File
@@ -0,0 +1,83 @@
Imports System.ComponentModel
Public Class DoorParametersViewModel
Implements INotifyPropertyChanged
Private m_Door As Door
Public Property Door As Door
Get
Return m_Door
End Get
Set(value As Door)
m_Door = value
End Set
End Property
#Region "Messages"
'General'
Public ReadOnly Property WidthMsg As String
Get
Return "Width"
End Get
End Property
Public ReadOnly Property HeightMsg As String
Get
Return "Height"
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return "Thickness"
End Get
End Property
Public ReadOnly Property SwingMsg As String
Get
Return "Swing"
End Get
End Property
'Profiles'
Public ReadOnly Property LockedgeMsg As String
Get
Return "Lockedge"
End Get
End Property
Public ReadOnly Property HingeedgeMsg As String
Get
Return "Hingeedge"
End Get
End Property
Public ReadOnly Property TopMsg As String
Get
Return "Top"
End Get
End Property
Public ReadOnly Property BottomMsg As String
Get
Return "Bottom"
End Get
End Property
Public ReadOnly Property ApplyBtnMsg As String
Get
Return "Apply"
End Get
End Property
Public ReadOnly Property DeleteBtnMsg As String
Get
Return "Delete"
End Get
End Property
#End Region
Sub New(ByRef Door As Door)
Me.m_Door = Door
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
+22
View File
@@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtDOORCreator", "EgtDOORCreator.vbproj", "{1BFAA89F-B93D-4A05-9055-CF63D76016BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1BFAA89F-B93D-4A05-9055-CF63D76016BC}.Debug|x86.ActiveCfg = Debug|x86
{1BFAA89F-B93D-4A05-9055-CF63D76016BC}.Debug|x86.Build.0 = Debug|x86
{1BFAA89F-B93D-4A05-9055-CF63D76016BC}.Release|x86.ActiveCfg = Release|x86
{1BFAA89F-B93D-4A05-9055-CF63D76016BC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+197
View File
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1BFAA89F-B93D-4A05-9055-CF63D76016BC}</ProjectGuid>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<OutputType>WinExe</OutputType>
<RootNamespace>EgtDOORCreator</RootNamespace>
<AssemblyName>EgtDOORCreator</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MyType>Custom</MyType>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Debug\</OutputPath>
<DocumentationFile>EgtDOORCreator.xml</DocumentationFile>
<NoWarn>
</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<WarningsAsErrors>
</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Release\</OutputPath>
<DocumentationFile>EgtDOORCreator.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>
</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<WarningsAsErrors>
</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\EgtCAM5.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib">
<HintPath>..\..\EgtProg\DllD32\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5">
<HintPath>..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="Application.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Command\Command.vb" />
<Compile Include="CompoPanel\CompoBtn.vb" />
<Compile Include="Constants\ConstCompo.vb" />
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="Constants\ConstMsg.vb" />
<Compile Include="DdfFile.vb" />
<Compile Include="DoorParameters\DoorParametersViewModel.vb" />
<Compile Include="DoorParameters\Compo.vb" />
<Compile Include="CompoPanel\CompoPanelView.xaml.vb">
<DependentUpon>CompoPanelView.xaml</DependentUpon>
</Compile>
<Compile Include="CompoPanel\CompoPanelViewModel.vb" />
<Compile Include="EgtDoorCreatorMap.vb" />
<Compile Include="Utility.vb" />
<Page Include="DoorParameters\DoorParametersView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EgtDOORCreatorDictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="Application.xaml.vb">
<DependentUpon>Application.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="DoorParameters\Door.vb" />
<Compile Include="DoorParameters\DoorParametersView.xaml.vb">
<DependentUpon>DoorParametersView.xaml</DependentUpon>
</Compile>
<Compile Include="IniFile.vb" />
<Compile Include="MainWindow\MainWindow.xaml.vb">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="CompoPanel\CompoPanelView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Import Include="System.Threading.Tasks" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Data" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Shapes" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Imaging" />
<Import Include="System.Windows.Navigation" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow\MainWindowModel.vb" />
<Compile Include="MainWindow\MainWindowViewModel.vb" />
<Compile Include="My Project\AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="My Project\MyExtensions\MyWpfExtension.vb">
<VBMyExtensionTemplateID>Microsoft.VisualBasic.WPF.MyExtension</VBMyExtensionTemplateID>
<VBMyExtensionTemplateVersion>1.0.0.0</VBMyExtensionTemplateVersion>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
</EmbeddedResource>
<None Include="My Project\app.manifest" />
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<AppDesigner Include="My Project\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Resource Include="Resources\EgtCAM5.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtDOORCreator\EgtDOORCreatorR32.exe
IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\EgtDOORCreator\EgtDOORCreatorD32.exe
</PostBuildEvent>
</PropertyGroup>
</Project>
+13
View File
@@ -0,0 +1,13 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--Colori predefiniti-->
<SolidColorBrush x:Key="EgaltechBlue1" Color="#FF4D84C4" />
<SolidColorBrush x:Key="EgaltechBlue2" Color="#FF7096CE" />
<SolidColorBrush x:Key="EgaltechBlue3" Color="#FF90ABD9" />
<SolidColorBrush x:Key="EgaltechBlue4" Color="#FFB2C3E4" />
<SolidColorBrush x:Key="EgaltechWhite" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="EgaltechGray" Color="#FF58585B" />
<SolidColorBrush x:Key="EgaltechLightGray" Color="LightGray" />
</ResourceDictionary>
+5
View File
@@ -0,0 +1,5 @@
Module EgtDoorCreatorMap
Friend m_Door As Door
End Module
+258
View File
@@ -0,0 +1,258 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Friend Module IniFile
Public Enum ComboListResult As Integer
MISTAKE = -1
NOTFOUND = 0
FOUND = 1
End Enum
' Path IniFile
Friend m_sIniFile As String = String.Empty
' Path Compo.ini file
Friend m_sCompoIniFile As String = String.Empty
' IniFile
Public Function GetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sIniFile)
End Function
Public Function GetPrivateProfileDouble(IpAppName As String, IpKeyName As String, nDefault As Integer) As Double
Return EgtUILib.GetPrivateProfileDouble(IpAppName, IpKeyName, nDefault, m_sIniFile)
End Function
Public Function GetPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer
Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sIniFile)
End Function
Public Function GetPrivateProfileColor(IpAppName As String, IpKeyName As String, ByRef Col As EgtUILib.EgtInterface.Color3d) As Boolean
Return EgtUILib.GetPrivateProfileColor(IpAppName, IpKeyName, Col, m_sIniFile)
End Function
Public Function GetPrivateProfileWinPos(IpAppName As String, IpKeyName As String, ByRef nFlag As Integer, ByRef nLeft As Integer, ByRef nTop As Integer, ByRef nWidth As Integer, ByRef nHeight As Integer) As Boolean
Return EgtUILib.GetPrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile)
End Function
Public Function GetPrivateProfileZoomWin(IpAppName As String, IpKeyName As String, ByRef bOutline As Boolean, ByRef Col As EgtUILib.EgtInterface.Color3d) As Boolean
Return EgtUILib.GetPrivateProfileZoomWin(IpAppName, IpKeyName, bOutline, Col, m_sIniFile)
End Function
Public Function GetPrivateProfileFloatingWinPos(lpAppName As String, lpKeyName As String, ByRef nState As String, ByRef nIndex As Integer, ByRef nLeft As Integer, ByRef nTop As Integer) As Boolean
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 4 Then
nState = sItems(0)
nIndex = CInt(sItems(1))
nLeft = CInt(sItems(2))
nTop = CInt(sItems(3))
Return True
End If
Return False
End Function
Public Function GetPrivateProfileLanguage(ByVal lpAppName As String, ByVal lpKeyName As String) As Language
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() = 2 Then
Return New Language(sItems(0), sItems(1))
End If
Return Nothing
End Function
Public Function WritePrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sIniFile)
End Function
Public Function WritePrivateProfileWinPos(IpAppName As String, IpKeyName As String, ByRef nFlag As Integer, ByRef nLeft As Integer, ByRef nTop As Integer, ByRef nWidth As Integer, ByRef nHeight As Integer) As Boolean
Return EgtUILib.WritePrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile)
End Function
' Compo
Public Function CompoGetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sCompoIniFile)
End Function
Public Function CompoGetPrivateProfileDouble(IpAppName As String, IpKeyName As String, nDefault As Integer) As Double
Return EgtUILib.GetPrivateProfileDouble(IpAppName, IpKeyName, nDefault, m_sCompoIniFile)
End Function
Public Function CompoGetPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer
Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sCompoIniFile)
End Function
'Funzione che gestisce il nome della componente
Public Function CompoGetPrivateProfileNameGroup(IpAppName As String, IpKeyName As String, ByRef NameDDF As String, ByRef Name As String) As Boolean
Dim sVal As String = String.Empty
CompoGetPrivateProfileString(IpAppName, IpKeyName, "", sVal)
Dim sItems() As String = sVal.Split("/".ToCharArray)
If sItems.Count() = 2 Then
If IsNumeric(sItems(1)) Then
Name = EgtMsg(CInt(sItems(1)))
Else
Name = sItems(1)
End If
NameDDF = sItems(0)
Else
NameDDF = sItems(0)
Name = sItems(0)
Return True
End If
Return False
End Function
' Funzione che legge valori TextBox
Public Function CompoGetPrivateProfileTextBox(IpAppName As String, IpKeyName As String, ByRef DDFName As String, ByRef Name As String) As Boolean
Dim sVal As String = String.Empty
CompoGetPrivateProfileString(IpAppName, IpKeyName, "", sVal)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 2 Then
DDFName = sItems(0)
If IsNumeric(sItems(1)) Then
Name = EgtMsg(CInt(sItems(1)))
Else
Name = DDFName
End If
Return True
End If
Return False
End Function
' Funzione che legge valori SpecialTextBox
Public Function CompoGetPrivateProfileSpecialTextBox(IpAppName As String, IpKeyName As String, ByRef DDFName As String, ByRef Name As String, ByRef ComboIndex As Integer, ByRef SelComboItemList As List(Of String)) As Boolean
Dim sVal As String = String.Empty
CompoGetPrivateProfileString(IpAppName, IpKeyName, "", sVal)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 2 Then
DDFName = sItems(0)
If IsNumeric(sItems(1)) Then
Name = (EgtMsg(CInt(sItems(1))))
Else
Name = DDFName
End If
If sItems.Count() >= 3 Then
ComboIndex = CInt(sItems(2))
SelComboItemList = New List(Of String)
For Index = 3 To sItems.Count() - 1
If IsNumeric(sItems(Index)) Then
SelComboItemList.Add(EgtMsg(CInt(sItems(Index))))
Else
SelComboItemList.Add(sItems(Index))
End If
Next
Return True
End If
End If
Return False
End Function
' Funzione che legge valori ComboBox
Public Function CompoGetPrivateProfileComboBox(IpAppName As String, IpKeyName As String, ByRef DDFName As String, ByRef Name As String) As Boolean
Dim sVal As String = String.Empty
CompoGetPrivateProfileString(IpAppName, IpKeyName, "", sVal)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 2 Then
DDFName = sItems(0)
If IsNumeric(sItems(1)) Then
Name = EgtMsg(CInt(sItems(1)))
Else
Name = DDFName
End If
Return True
End If
Return False
End Function
' Funzione che legge valori ComboBoxList
Public Function CompoGetPrivateProfileComboBoxList(IpAppName As String, IpKeyName As String, ByRef ComboList As List(Of String), ByRef ComboListDDF As List(Of String)) As Integer
Dim sVal As String = String.Empty
CompoGetPrivateProfileString(IpAppName, IpKeyName, "", sVal)
Dim sItems() As String = sVal.Split(",".ToCharArray)
Dim ListType As Integer = 0
Dim ListPath As String = String.Empty
If sItems.Count() >= 2 Then
ListType = CInt(sItems(0))
If ListType = 0 Then
ComboList = New List(Of String)
ComboListDDF = New List(Of String)
For Index = 1 To sItems.Count() - 1
Dim sItemsDDF() As String = sItems(Index).Split("/".ToCharArray)
If sItemsDDF.Count() = 2 Then
ComboListDDF.Add(sItemsDDF(0))
If IsNumeric(sItemsDDF(1)) Then
ComboList.Add(EgtMsg(CInt(sItemsDDF(1))))
Else
ComboList.Add(sItemsDDF(1))
End If
Else
ComboList.Add(sItemsDDF(0))
End If
Next
Else
If Directory.Exists(sItems(1)) Then
ListPath = sItems(1)
ComboList = New List(Of String)
OpenDirectory(ListPath, ComboList, ListPath & "\")
Else
MessageBox.Show(EgtMsg(ConstMsg.MSG_ERROR) & ListPath, EgtMsg(ConstMsg.MSG_ERROR + 1), MessageBoxButton.OK, MessageBoxImage.Error)
ListPath = String.Empty
ComboList = New List(Of String)
Return ComboListResult.Mistake
End If
End If
Return ComboListResult.Found
End If
Return ComboListResult.NotFound
End Function
Private Sub OpenDirectory(DirectoryPath As String, ByRef ComboList As List(Of String), ListPath As String)
Dim SubDir() As String = Directory.GetDirectories(DirectoryPath)
For Index = 0 To SubDir.Count - 1
OpenDirectory(SubDir(Index), ComboList, ListPath)
Next
Dim Files() As String = Directory.GetFiles(DirectoryPath)
For Index = 0 To Files.Count - 1
ComboList.Add(Files(Index).Replace(ListPath, ""))
Next
End Sub
End Module
' Classe che identifica una lingua del programma con nome e path del file dei messaggi
Public Class Language
Private m_sName As String
Private m_sFilePath As String
Public Property Name As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Public Property FilePath As String
Get
Return m_sFilePath
End Get
Set(value As String)
m_sFilePath = value
End Set
End Property
Sub New(sName As String, sFilePath As String)
Me.Name = sName
Me.FilePath = sFilePath
End Sub
End Class
+24
View File
@@ -0,0 +1,24 @@
<EgtWPFLib5:EgtCustomWindow x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}" Icon="/Resources/EgtCAM5.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}"
BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="2"
MinHeight="600" MinWidth="800" Height="768" Width="1366"
AboutBox="{Binding AboutBox}" WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="32">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<!--ContentPresenter that contains the DoorParameters-->
<ContentPresenter Grid.Column="0" Content="{Binding CompoPanel}"/>
<ContentPresenter Grid.Column="1" Content="{Binding DoorParameters}"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+3
View File
@@ -0,0 +1,3 @@
Class MainWindow
End Class
+207
View File
@@ -0,0 +1,207 @@
Imports System.Threading
Imports System.Math
Imports EgtUILib
Friend Class MainWindowModel
#Region "FIELDS"
' Riferimento alla porta corrente
Friend m_Door As Door
' Mutex che permette di controllare il numero massimo di istanze aperta contemporaneamente
Private m_objMutex As New Mutex
' Variabile che indica il numero di istanze aperte del programma
Friend m_nInstance As Integer = 0
' Path cartella Data
Friend m_sDataRoot As String = String.Empty
' Path cartella Config
Friend m_sConfigDir As String = String.Empty
' Path cartella Temp
Friend m_sTempDir As String = String.Empty
' Livello dell'utilizzatore
Friend m_nUserLevel As Integer = 1
' Livello della chiave inserita nel PC
Friend m_nKeyLevel As Integer = 0
' Opzioni attive sulla chiave
Friend m_nKeyOptions As UInteger = 0
Private m_nDebug As Integer = 0
#End Region
#Region "CONSTRUCTOR"
Sub New()
' Impostazione path radice per i dati
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
End If
' Impostazione direttorio di configurazione
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
' Impostazione direttorio per file temporanei
m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
' Impostazione path Ini file
IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
' Impostazione path CompoIni file
IniFile.m_sCompoIniFile = m_sConfigDir & "\" & COMPOINI_FILE_NAME
' Verifico indice di istanza
ManageIstance()
'' Imposto tipo di chiave
'EgtSetLockType(KEY_TYPE.HW)
'' Leggo e imposto chiave di protezione
'Dim sLicFileName As String = String.Empty
'GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
'Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
'Dim sKey As String = String.Empty
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
'EgtSetKey(sKey)
'' Recupero livello e opzioni della chiave
'Dim bKey As Boolean = EgtGetKeyLevel(3279, 16, 1, IniFile.m_nKeyLevel) And
' EgtGetKeyOptions(3279, 16, 1, IniFile.m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
Dim sLogFile As String = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.UserName & "\" & Environment.MachineName & " (" & m_nInstance.ToString() & ")" & vbLf &
My.Application.Info.Description.ToString() & " ver. " &
My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(m_nDebug, sLogFile, sLogMsg)
' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
Dim sMsgDir As String = String.Empty
If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
sMsgDir = m_sConfigDir
End If
' Leggo elenco lingue disponibili da file ini
Dim nIndex As Integer = 1
Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
While Not IsNothing(ReadLanguage)
'OptionModule.m_LanguageList.Add(ReadLanguage)
nIndex += 1
ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
End While
' Inizializzo OptionModule
'OptionModule.InitOptionModule()
' Leggo file messaggi
Dim sMsgName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgName)
Dim sMsgFilePath As String = sMsgDir & "\EgalTechEng.txt"
'For Each Language In OptionModule.m_LanguageList
' If Language.Name = sMsgName Then
' OptionModule.m_SelectedLanguage = Language
' sMsgFilePath = sMsgDir & "\" & Language.FilePath
' End If
'Next
If Not EgtLoadMessages(sMsgFilePath) Then
EgtOutLog("Error in EgtLoadMessages")
End If
' imposto dir di default per libreria Lua e lancio libreria di base
Dim sLuaLibsDir As String = String.Empty
GetPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir)
EgtSetLuaLibs(sLuaLibsDir)
Dim sLuaBaseLib As String = String.Empty
GetPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
EgtLuaRequire(sLuaBaseLib)
' Prova generazione porta
'NewDoor()
DdfFile.ReadDDF("c:\EgtData\EgtDOORCreator\Myprojects\Prova1.ddf")
m_Door = DdfFile.m_Door
End Sub
Public Sub NewDoor()
m_Door = New Door
EgtDoorCreatorMap.m_Door = Me.m_Door
' m_Door.Height = "15"
' m_Door.Thickness = "1"
' m_Door.Width = "9"
' m_Door.Swing = "LH"
' m_Door.TopType = "SQ"
' m_Door.BottomType = "SQ"
' m_Door.HingeEdgeType = "2B"
' m_Door.LockEdgeType = "SQ"
' m_Door.LockEdgeMachining = False
' m_Door.HingeEdgeMachining = False
' m_Door.TopMachining = False
' m_Door.BottomMachining = True
' m_Door.LockEdgeOverMaterial = "0.2"
' m_Door.HingeEdgeOverMaterial = "0.3"
' m_Door.TopOverMaterial = "0.4"
' m_Door.BottomOverMaterial = "0"
End Sub
#End Region
#Region "METHODS"
''' <summary>
''' Funzione che permette di gestire il numero di istanze del programma attive contemporaneamente
''' </summary>
Private Sub ManageIstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\EgtDOORCreator", bCreated)
Catch
bCreated = False
End Try
If bCreated Then
' Prima istanza
m_nInstance = 1
' Aggiorno stato istanze attive
WritePrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString)
Else
' Leggo il massimo numero di istanze ammesse
Dim nMaxInst As Integer = GetPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
nMaxInst = Max(1, Min(nMaxInst, 32))
' Cerco il primo indice di istanza libero (max 32)
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And m_nInstance <= m_nInstance
m_nInstance += 1
nMask *= 2
End While
' Se l'indice supera il massimo
If m_nInstance > nMaxInst Then
' porto in primo piano la prima istanza
Dim bFound As Boolean = False
' processi del programma a 32 bit
Dim localProc As Process() = Process.GetProcessesByName("EgtDOORCreatorR32")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.SHOWMAXIMIZED)
Exit For
End If
Next
' se non trovati processi a 32 bit provo a 64 bit
If Not bFound Then
localProc = Process.GetProcessesByName("EgtDOORCreatorR64")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.SHOWMAXIMIZED)
Exit For
End If
Next
End If
' esco dal programma
End
End If
' Aggiorno stato istanze attive
nTmp += (1 << (m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End If
End Sub
#End Region
End Class
+29
View File
@@ -0,0 +1,29 @@
Public Class MainWindowViewModel
' Modello del MainWindow (classe vera e propria)
Private m_MainWindowModel As New MainWindowModel
Private m_CompoPanel As CompoPanelView
Public ReadOnly Property CompoPanel As CompoPanelView
Get
If IsNothing(m_CompoPanel) Then
m_CompoPanel = New CompoPanelView
m_CompoPanel.DataContext = New CompoPanelViewModel(m_MainWindowModel.m_Door)
End If
Return m_CompoPanel
End Get
End Property
Private m_DoorParameters As DoorParametersView
Public ReadOnly Property DoorParameters As DoorParametersView
Get
If IsNothing(m_DoorParameters) Then
m_DoorParameters = New DoorParametersView
m_DoorParameters.DataContext = New DoorParametersViewModel(m_MainWindowModel.m_Door)
End If
Return m_DoorParameters
End Get
End Property
End Class
+76
View File
@@ -0,0 +1,76 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Globalization
Imports System.Resources
Imports System.Windows
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
#If PLATFORM = "x64" Then
#If DEBUG Then
<Assembly: AssemblyTitle("EgtDOORCreator Debug 64 bit")>
<Assembly: AssemblyDescription("EgtDOORCreatorD64.exe")>
#Else
<Assembly: AssemblyTitle("EgtDOORCreator Release 64 bit")>
<Assembly: AssemblyDescription("EgtDOORCreatorR64.exe")>
#End if
#Else
#If DEBUG Then
<Assembly: AssemblyTitle("EgtDOORCreator Debug 32 bit")>
<Assembly: AssemblyDescription("EgtDOORCreatorD32.exe")>
#Else
<Assembly: AssemblyTitle("EgtDOORCreator Release 32 bit")>
<Assembly: AssemblyDescription("EgtDOORCreatorR32.exe")>
#End If
#End If
<Assembly: AssemblyCompany("EgalTech s.r.l.")>
<Assembly: AssemblyProduct("EgtDOORCreator")>
<Assembly: AssemblyCopyright("Copyright © 2016-2016 by EgalTech s.r.l.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'In order to begin building localizable applications, set
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
'inside a <PropertyGroup>. For example, if you are using US english
'in your source files, set the <UICulture> to "en-US". Then uncomment the
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
'below to match the UICulture setting in the project file.
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
'1st parameter: where theme specific resource dictionaries are located
'(used if a resource is not found in the page,
' or application resource dictionaries)
'2nd parameter: where the generic resource dictionary is located
'(used if a resource is not found in the page,
'app, and any theme specific resource dictionaries)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("46e08d62-e763-405a-92ee-4a4cba211843")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.24.1")>
<Assembly: AssemblyFileVersion("1.6.24.1")>
+121
View File
@@ -0,0 +1,121 @@
#If _MyType <> "Empty" Then
Namespace My
''' <summary>
''' Module used to define the properties that are available in the My Namespace for WPF
''' </summary>
''' <remarks></remarks>
<Global.Microsoft.VisualBasic.HideModuleName()> _
Module MyWpfExtension
Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer)
Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User)
Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows)
Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log)
''' <summary>
''' Returns the application object for the running application
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Application() As Application
Get
Return CType(Global.System.Windows.Application.Current, Application)
End Get
End Property
''' <summary>
''' Returns information about the host computer.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
Get
Return s_Computer.GetInstance()
End Get
End Property
''' <summary>
''' Returns information for the current user. If you wish to run the application with the current
''' Windows user credentials, call My.User.InitializeWithWindowsUser().
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
Get
Return s_User.GetInstance()
End Get
End Property
''' <summary>
''' Returns the application log. The listeners can be configured by the application's configuration file.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
Get
Return s_Log.GetInstance()
End Get
End Property
''' <summary>
''' Returns the collection of Windows defined in the project.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Windows() As MyWindows
<Global.System.Diagnostics.DebuggerHidden()> _
Get
Return s_Windows.GetInstance()
End Get
End Property
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
<Global.Microsoft.VisualBasic.MyGroupCollection("System.Windows.Window", "Create__Instance__", "Dispose__Instance__", "My.MyWpfExtenstionModule.Windows")> _
Friend NotInheritable Class MyWindows
<Global.System.Diagnostics.DebuggerHidden()> _
Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T
If Instance Is Nothing Then
If s_WindowBeingCreated IsNot Nothing Then
If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then
Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.")
End If
Else
s_WindowBeingCreated = New Global.System.Collections.Hashtable()
End If
s_WindowBeingCreated.Add(GetType(T), Nothing)
Return New T()
s_WindowBeingCreated.Remove(GetType(T))
Else
Return Instance
End If
End Function
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.Diagnostics.DebuggerHidden()> _
Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
instance = Nothing
End Sub
<Global.System.Diagnostics.DebuggerHidden()> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Public Sub New()
MyBase.New()
End Sub
<Global.System.ThreadStatic()> Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function Equals(ByVal o As Object) As Boolean
Return MyBase.Equals(o)
End Function
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function GetHashCode() As Integer
Return MyBase.GetHashCode
End Function
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Friend Overloads Function [GetType]() As Global.System.Type
Return GetType(MyWindows)
End Function
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function ToString() As String
Return MyBase.ToString
End Function
End Class
End Module
End Namespace
Partial Class Application
Inherits Global.System.Windows.Application
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo
<Global.System.Diagnostics.DebuggerHidden()> _
Get
Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly())
End Get
End Property
End Class
#End If
+63
View File
@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("EgtDOORCreator.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
+117
View File
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+71
View File
@@ -0,0 +1,71 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.EgtDOORCreator.MySettings
Get
Return Global.EgtDOORCreator.MySettings.Default
End Get
End Property
End Module
End Namespace
+7
View File
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+58
View File
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Windows will automatically select the most compatible environment.-->
<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
<!-- If your application is designed to work with Windows 8.1, uncomment the following supportedOS node-->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>-->
</application>
</compatibility>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!-- <dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>-->
</asmv1:assembly>
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

+50
View File
@@ -0,0 +1,50 @@
Imports System.Collections.ObjectModel
Imports System.Globalization
Imports EgtUILib
Public Module Utility
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
Dim sFormat As String = "F" + Math.Abs(nNumDec).ToString()
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
If nNumDec > 0 Then
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
Else
Return sVal
End If
End Function
Friend Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
Return EgtLuaEvalNumExpr(sVal, dVal)
End Function
Friend Function LenToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
Return DoubleToString(EgtToUiUnits(dVal), nNumDec)
End Function
Friend Function StringToLen(ByVal sVal As String, ByRef dVal As Double) As Boolean
If EgtLuaEvalNumExpr(sVal, dVal) Then
dVal = EgtFromUiUnits(dVal)
Return True
Else
Return False
End If
End Function
'Converte il valore Boolean in una stringa ON/OFF (attributo machining)
Public Function ConvertBooleanToOnOff(bValue As Boolean) As String
If bValue Then
Return K_ON
Else
Return K_OFF
End If
End Function
Friend Sub UpdateUI()
' Costringo ad aggiornare UI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _
New Action(Function() nDummy = 0))
End Sub
End Module