EgtCAM5 :
- aggiunta finestra per gestione lavorazioni travi.
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="BeamMachiningsWindowV"
|
||||
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}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="32"
|
||||
Width="332" Height="300"
|
||||
IsResizable="True"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
|
||||
CloseCommand="{Binding Close_Command,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
|
||||
|
||||
<Grid Margin="5,5,5,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TabControl ItemsSource="{Binding MachiningList}"
|
||||
SelectedItem="{Binding SelMachining}"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
Margin="5,0,5,0"
|
||||
Style="{StaticResource TabControl_OnlyHeaders}"/>
|
||||
|
||||
<DataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding TableRowList}"
|
||||
SelectedIndex="{Binding SelRowIndex}"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserSortColumns="False"
|
||||
CanUserResizeColumns="False"
|
||||
CanUserResizeRows="False"
|
||||
CanUserReorderColumns="False"
|
||||
SelectionMode="Single"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
||||
Margin="0,0,0,5">
|
||||
|
||||
<DataGrid.Columns>
|
||||
|
||||
<!--Colonna On-->
|
||||
<DataGridCheckBoxColumn Width="Auto" Binding="{Binding OnPar}">
|
||||
<DataGridCheckBoxColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.OnHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
|
||||
</DataGridCheckBoxColumn.Header>
|
||||
</DataGridCheckBoxColumn>
|
||||
|
||||
<!--Colonna Name-->
|
||||
<DataGridTemplateColumn Width="1*">
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.NameHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox IsEditable="False"
|
||||
SelectedItem="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||
ItemsSource="{Binding Path=NamesList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!--Colonna Style-->
|
||||
<DataGridTemplateColumn Width="1*">
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.TypeHdr,RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox IsEditable="False"
|
||||
SelectedItem="{Binding Type,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||
ItemsSource="{Binding Path=TypeList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Type,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
<Grid Grid.Row="2"
|
||||
Margin="0,0,0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Content="^"
|
||||
Command="{Binding MoveRowUp_Command}"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
<Button Content="v"
|
||||
Command="{Binding MoveRowDown_Command}"
|
||||
Grid.Column="1"
|
||||
Margin="2.5,0,2.5,0"
|
||||
Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
<Button Content="{Binding AddRowMsg}"
|
||||
Command="{Binding AddRow_Command}"
|
||||
Grid.Column="2"
|
||||
Margin="2.5,0,2.5,0"
|
||||
Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
<Button Content="{Binding DeleteRowMsg}"
|
||||
Command="{Binding DeleteRow_Command}"
|
||||
Grid.Column="3"
|
||||
Margin="2.5,0,2.5,0"
|
||||
Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
<Button Content="{Binding SaveMsg}"
|
||||
Command="{Binding Save_Command}"
|
||||
Grid.Column="4"
|
||||
Margin="2.5,0,0,0"
|
||||
Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -0,0 +1,18 @@
|
||||
Public Class BeamMachiningsWindowV
|
||||
|
||||
Private WithEvents m_BeamMachiningsWindowVM As BeamMachiningsWindowVM
|
||||
|
||||
Sub New(Owner As Window, BeamMachiningsWindowVM As BeamMachiningsWindowVM)
|
||||
MyBase.New(Owner)
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
Me.DataContext = BeamMachiningsWindowVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_BeamMachiningsWindowVM = BeamMachiningsWindowVM
|
||||
End Sub
|
||||
|
||||
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_BeamMachiningsWindowVM.m_CloseWindow
|
||||
Me.DialogResult = bDialogResult
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,513 @@
|
||||
Imports System.IO
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class BeamMachiningsWindowVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private Const ONCONST As String = "On"
|
||||
Private Const NAME As String = "Name"
|
||||
Private Const TYPE As String = "Type"
|
||||
Friend Const DATETIME As String = "%DATE_TIME%"
|
||||
Friend Const TABLENAME As String = "%TABLE_NAME%"
|
||||
Private Const BEAMTABLETEMPLATE_FILE As String = "BeamTableTemplate.ini"
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Private m_MachiningList As New ObservableCollection(Of String)({"Cut", "Drill", "Milling", "Pocketing", "Sawing"})
|
||||
Public ReadOnly Property MachiningList As ObservableCollection(Of String)
|
||||
Get
|
||||
Return m_MachiningList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelMachining As String
|
||||
Public Property SelMachining As String
|
||||
Get
|
||||
Return m_SelMachining
|
||||
End Get
|
||||
Set(value As String)
|
||||
' verifico se pagina precedente modificata
|
||||
Dim TableModified As Boolean = False
|
||||
For Each Line In m_TableRowList
|
||||
If Line.IsModified Then
|
||||
TableModified = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' se modificata, chiedo se salvare
|
||||
If TableModified Then
|
||||
Select Case MessageBox.Show(EgtMsg(9007), EgtMsg(9006), MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
|
||||
Case MessageBoxResult.Yes
|
||||
Save()
|
||||
Case MessageBoxResult.No
|
||||
' non devo fare nulla
|
||||
End Select
|
||||
End If
|
||||
m_SelMachining = value
|
||||
LoadMachiningList()
|
||||
LoadTypeList()
|
||||
ReadTableFile()
|
||||
NotifyPropertyChanged("SelMachining")
|
||||
End Set
|
||||
End Property
|
||||
Private Sub SetSelMachining(value As String)
|
||||
m_SelMachining = value
|
||||
LoadMachiningList()
|
||||
LoadTypeList()
|
||||
ReadTableFile()
|
||||
NotifyPropertyChanged("SelMachining")
|
||||
End Sub
|
||||
|
||||
Private m_TableRowList As ObservableCollection(Of GridLine)
|
||||
Public Property TableRowList As ObservableCollection(Of GridLine)
|
||||
Get
|
||||
Return m_TableRowList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of GridLine))
|
||||
m_TableRowList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SelRowIndex As Integer = 0
|
||||
Public Property SelRowIndex As Integer
|
||||
Get
|
||||
Return m_SelRowIndex
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelRowIndex = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return EgtMsg(9000)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property OnHdr As String
|
||||
Get
|
||||
Return EgtMsg(9001)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property NameHdr As String
|
||||
Get
|
||||
Return EgtMsg(9002)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property TypeHdr As String
|
||||
Get
|
||||
Return EgtMsg(9003)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AddRowMsg As String
|
||||
Get
|
||||
Return EgtMsg(9004)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DeleteRowMsg As String
|
||||
Get
|
||||
Return EgtMsg(9005)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property SaveMsg As String
|
||||
Get
|
||||
Return EgtMsg(9006)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdMoveRowUp As ICommand
|
||||
Private m_cmdMoveRowDown As ICommand
|
||||
Private m_cmdAddRow As ICommand
|
||||
Private m_cmdDeleteRow As ICommand
|
||||
Private m_cmdSave As ICommand
|
||||
Private m_cmdClose As ICommand
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
' Carico file delle lavorazioni
|
||||
|
||||
' Seleziono il primo
|
||||
If m_MachiningList.Count > 0 Then
|
||||
SetSelMachining(m_MachiningList(0))
|
||||
End If
|
||||
NotifyPropertyChanged("MachiningList")
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Function LoadMachiningList() As Boolean
|
||||
Dim MachiningType As MCH_MY = MCH_MY.NONE
|
||||
Select Case SelMachining
|
||||
Case "Cut"
|
||||
MachiningType = MCH_MY.MILLING
|
||||
Case "Drill"
|
||||
MachiningType = MCH_MY.DRILLING
|
||||
Case "Milling"
|
||||
MachiningType = MCH_MY.MILLING
|
||||
Case "Pocketing"
|
||||
MachiningType = MCH_MY.POCKETING
|
||||
Case "Sawing"
|
||||
MachiningType = MCH_MY.MORTISING
|
||||
End Select
|
||||
Dim MachiningList As New List(Of String)
|
||||
LoadMachiningListByType(MachiningList, MachiningType)
|
||||
GridLine.SetNamesList(New ObservableCollection(Of String)(MachiningList))
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function LoadTypeList() As Boolean
|
||||
Dim FilePath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Beam" & "\MachiningTypes.ini"
|
||||
Dim TypeList As New List(Of String)
|
||||
Dim Index As Integer = 1
|
||||
Dim Type As String = ""
|
||||
While EgtUILib.GetPrivateProfileString(SelMachining, Index.ToString, "", Type, FilePath) > 0
|
||||
TypeList.Add(Type)
|
||||
Index += 1
|
||||
End While
|
||||
GridLine.SetTypeList(New ObservableCollection(Of String)(TypeList))
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function ReadTableFile() As Boolean
|
||||
' svuoto la lista
|
||||
m_TableRowList = New ObservableCollection(Of GridLine)
|
||||
Dim FilePath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Beam" & "\" & SelMachining & "Data.lua"
|
||||
If Not File.Exists(FilePath) Then Return False
|
||||
Dim FileContent As String() = File.ReadAllLines(FilePath)
|
||||
Dim FoundTableName As Boolean = False
|
||||
For LineIndex As Integer = 0 To FileContent.Count - 1
|
||||
If FileContent(LineIndex).Contains(SelMachining & "Data") Then
|
||||
FoundTableName = True
|
||||
End If
|
||||
Dim Open As Integer = CountCharacter(FileContent(LineIndex), "{"c)
|
||||
Dim Close As Integer = CountCharacter(FileContent(LineIndex), "}"c)
|
||||
If Close > Open Then
|
||||
If FoundTableName Then
|
||||
FoundTableName = False
|
||||
End If
|
||||
End If
|
||||
If FoundTableName Then
|
||||
Dim sOn As String = SearchKey(FileContent(LineIndex), ONCONST)
|
||||
Dim sName As String = SearchKey(FileContent(LineIndex), NAME)
|
||||
Dim sType As String = SearchKey(FileContent(LineIndex), TYPE)
|
||||
If Not String.IsNullOrWhiteSpace(sOn) AndAlso Not String.IsNullOrWhiteSpace(sName) AndAlso Not String.IsNullOrWhiteSpace(sType) Then
|
||||
If String.Compare(sOn, "true", True) = 0 Then
|
||||
TableRowList.Add(New GridLine(True, sName, sType))
|
||||
ElseIf String.Compare(sOn, "false", True) = 0 Then
|
||||
TableRowList.Add(New GridLine(False, sName, sType))
|
||||
Else
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
NotifyPropertyChanged("TableRowList")
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function WriteTableFile() As Boolean
|
||||
' inizio routine di scrittura
|
||||
Dim FileContent As String() = File.ReadAllLines(IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Beam" & "\" & BEAMTABLETEMPLATE_FILE)
|
||||
Dim NewTableFileContent As New List(Of String)
|
||||
Dim bBeamTable As Boolean = False
|
||||
For LineIndex As Integer = 0 To FileContent.Count - 1
|
||||
Dim sCurrLine As String = FileContent(LineIndex)
|
||||
sCurrLine = sCurrLine.Replace(DATETIME, System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"))
|
||||
sCurrLine = sCurrLine.Replace(TABLENAME, SelMachining & "Data")
|
||||
|
||||
If sCurrLine.Contains(SelMachining & "Data") AndAlso sCurrLine.Contains("=") Then
|
||||
bBeamTable = True
|
||||
NewTableFileContent.Add(sCurrLine)
|
||||
PrintActiveMachiningList(NewTableFileContent)
|
||||
End If
|
||||
|
||||
If Not bBeamTable Then
|
||||
NewTableFileContent.Add(sCurrLine)
|
||||
Else
|
||||
bBeamTable = False
|
||||
End If
|
||||
Next
|
||||
Dim FilePath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\" & "Beam" & "\" & SelMachining & "Data.lua"
|
||||
File.WriteAllLines(FilePath, NewTableFileContent, Text.Encoding.UTF8)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub PrintActiveMachiningList(NewTableFileContent As List(Of String))
|
||||
For Index As Integer = 0 To m_TableRowList.Count - 1
|
||||
If String.IsNullOrEmpty(m_TableRowList(Index).Name) Then Continue For
|
||||
Dim CurrentLine As String = " { On = " & If(m_TableRowList(Index).OnPar, "true", "false") & ", Name = '" & m_TableRowList(Index).Name & "', Type = '" & m_TableRowList(Index).Type & "'}"
|
||||
If Index < m_TableRowList.Count - 1 Then
|
||||
CurrentLine &= ","
|
||||
End If
|
||||
NewTableFileContent.Add(CurrentLine)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "MoveRowUp"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property MoveRowUp_Command As ICommand
|
||||
Get
|
||||
If m_cmdMoveRowUp Is Nothing Then
|
||||
m_cmdMoveRowUp = New Command(AddressOf MoveRowUp)
|
||||
End If
|
||||
Return m_cmdMoveRowUp
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub MoveRowUp()
|
||||
If SelRowIndex > 0 Then
|
||||
m_TableRowList.Move(SelRowIndex, SelRowIndex - 1)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveRowUp
|
||||
|
||||
#Region "MoveRowDown"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property MoveRowDown_Command As ICommand
|
||||
Get
|
||||
If m_cmdMoveRowDown Is Nothing Then
|
||||
m_cmdMoveRowDown = New Command(AddressOf MoveRowDown)
|
||||
End If
|
||||
Return m_cmdMoveRowDown
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub MoveRowDown()
|
||||
If SelRowIndex < m_TableRowList.Count - 1 Then
|
||||
m_TableRowList.Move(SelRowIndex, SelRowIndex + 1)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveRowDown
|
||||
|
||||
#Region "AddRow"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property AddRow_Command As ICommand
|
||||
Get
|
||||
If m_cmdAddRow Is Nothing Then
|
||||
m_cmdAddRow = New Command(AddressOf AddRow)
|
||||
End If
|
||||
Return m_cmdAddRow
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub AddRow()
|
||||
m_TableRowList.Insert(SelRowIndex + 1, New GridLine(False, "", ""))
|
||||
End Sub
|
||||
|
||||
#End Region ' AddRow
|
||||
|
||||
#Region "DeleteRow"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property DeleteRow_Command As ICommand
|
||||
Get
|
||||
If m_cmdDeleteRow Is Nothing Then
|
||||
m_cmdDeleteRow = New Command(AddressOf DeleteRow)
|
||||
End If
|
||||
Return m_cmdDeleteRow
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub DeleteRow()
|
||||
m_TableRowList.RemoveAt(SelRowIndex)
|
||||
End Sub
|
||||
|
||||
#End Region ' DeleteRow
|
||||
|
||||
#Region "Save"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Save_Command As ICommand
|
||||
Get
|
||||
If m_cmdSave Is Nothing Then
|
||||
m_cmdSave = New Command(AddressOf Save)
|
||||
End If
|
||||
Return m_cmdSave
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub Save()
|
||||
' scrivo il file
|
||||
WriteTableFile()
|
||||
' resetto le modifiche
|
||||
For Each Line In m_TableRowList
|
||||
Line.ResetIsModified()
|
||||
Next
|
||||
End Sub
|
||||
|
||||
#End Region ' Save
|
||||
|
||||
#Region "Close"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Close_Command As ICommand
|
||||
Get
|
||||
If m_cmdClose Is Nothing Then
|
||||
m_cmdClose = New Command(AddressOf Close)
|
||||
End If
|
||||
Return m_cmdClose
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub Close()
|
||||
' verifico se pagina precedente modificata
|
||||
Dim TableModified As Boolean = False
|
||||
For Each Line In m_TableRowList
|
||||
If Line.IsModified Then
|
||||
TableModified = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' se modificata, chiedo se salvare
|
||||
If TableModified Then
|
||||
Select Case MessageBox.Show(EgtMsg(9007), EgtMsg(9006), MessageBoxButton.YesNo, MessageBoxImage.Question)
|
||||
Case MessageBoxResult.Yes
|
||||
Save()
|
||||
Case MessageBoxResult.No
|
||||
' non devo fare nulla
|
||||
End Select
|
||||
End If
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End Sub
|
||||
|
||||
#End Region ' Close
|
||||
|
||||
#End Region ' COMMANDS
|
||||
|
||||
End Class
|
||||
|
||||
Public Class GridLine
|
||||
Inherits VMBase
|
||||
|
||||
Friend ReadOnly Property IsModified As Boolean
|
||||
Get
|
||||
Return m_IsOnModified Or m_IsNameModified Or m_IsTypeModified
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub ResetIsModified()
|
||||
m_IsOnModified = False
|
||||
m_IsNameModified = False
|
||||
m_IsTypeModified = False
|
||||
End Sub
|
||||
|
||||
Private m_IsOnModified As Boolean = False
|
||||
Private m_On As Boolean
|
||||
Public Property OnPar As Boolean
|
||||
Get
|
||||
Return m_On
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_On = value
|
||||
m_IsOnModified = True
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Shared m_NamesList As ObservableCollection(Of String)
|
||||
Public ReadOnly Property NamesList As ObservableCollection(Of String)
|
||||
Get
|
||||
Return m_NamesList
|
||||
End Get
|
||||
End Property
|
||||
Friend Shared Sub SetNamesList(NamesList As ObservableCollection(Of String))
|
||||
m_NamesList = NamesList
|
||||
End Sub
|
||||
|
||||
Private m_IsNameModified As Boolean = False
|
||||
Private m_Name As String
|
||||
Public Property Name As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Name = value
|
||||
m_IsNameModified = True
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Shared m_TypeList As ObservableCollection(Of String)
|
||||
Public ReadOnly Property TypeList As ObservableCollection(Of String)
|
||||
Get
|
||||
Return m_TypeList
|
||||
End Get
|
||||
End Property
|
||||
Friend Shared Sub SetTypeList(TypeList As ObservableCollection(Of String))
|
||||
m_TypeList = TypeList
|
||||
End Sub
|
||||
|
||||
Private m_IsTypeModified As Boolean = False
|
||||
Private m_Type As String
|
||||
Public Property Type As String
|
||||
Get
|
||||
Return m_Type
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Type = value
|
||||
m_IsTypeModified = True
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(bOnPar As Boolean, sName As String, sType As String)
|
||||
m_On = bOnPar
|
||||
m_Name = sName
|
||||
m_Type = sType
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -147,6 +147,10 @@
|
||||
<Compile Include="Base\TabViewModel.vb" />
|
||||
<Compile Include="Base\TreeView\TreeViewItemBase.vb" />
|
||||
<Compile Include="Base\ViewModelBase.vb" />
|
||||
<Compile Include="BeamMachiningsWindow\BeamMachiningsWindowV.xaml.vb">
|
||||
<DependentUpon>BeamMachiningsWindowV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BeamMachiningsWindow\BeamMachiningsWindowVM.vb" />
|
||||
<Compile Include="Special-Beam\Beam.vb" />
|
||||
<Compile Include="Command\Command.vb" />
|
||||
<Compile Include="Command\RelayCommand.vb" />
|
||||
@@ -338,6 +342,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="BeamMachiningsWindow\BeamMachiningsWindowV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="EstimationsDetailsWnd\EstimationsDetailsWndV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -70,5 +70,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.1.7.6")>
|
||||
<Assembly: AssemblyFileVersion("2.1.7.6")>
|
||||
<Assembly: AssemblyVersion("2.1.7.7")>
|
||||
<Assembly: AssemblyFileVersion("2.1.7.7")>
|
||||
|
||||
@@ -3,6 +3,8 @@ Imports EgtUILib
|
||||
|
||||
Public Class BeamPanelVM
|
||||
|
||||
Friend Const BEAM_MACHININGS As String = "BeamMachinings"
|
||||
|
||||
Private m_ButtonList As New List(Of ButtonItem)
|
||||
Public ReadOnly Property ButtonList As List(Of ButtonItem)
|
||||
Get
|
||||
|
||||
@@ -74,6 +74,13 @@ Public Class ButtonItem
|
||||
''' </summary>
|
||||
Public Sub LuaExec(ByVal param As Object)
|
||||
If String.IsNullOrWhiteSpace(m_sLuaCmdPath) Then Return
|
||||
' se trovo costante di apertura file lavorazioni travi
|
||||
If m_sLuaCmdPath = BeamPanelVM.BEAM_MACHININGS Then
|
||||
' apro finestra di gestione lavorazioni travi
|
||||
Dim BeamMachiningsWindowV As New BeamMachiningsWindowV(Application.Current.MainWindow, New BeamMachiningsWindowVM)
|
||||
BeamMachiningsWindowV.ShowDialog()
|
||||
Return
|
||||
End If
|
||||
If Not File.Exists(m_sLuaCmdPath) Then Return
|
||||
If Not Path.GetExtension(m_sLuaCmdPath).ToLower = ".lua" Then Return
|
||||
' eseguo file Lua
|
||||
|
||||
@@ -1015,5 +1015,39 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- ______________________________________________________________________________________________________________________________________________ -->
|
||||
|
||||
<!-- TabControl that have only Headers and no Pages -->
|
||||
|
||||
<Style x:Key="TabControl_OnlyHeaders" TargetType="{x:Type TabControl}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabControl}">
|
||||
<Grid KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabPanel
|
||||
Name="HeaderPanel"
|
||||
Grid.Row="0"
|
||||
Panel.ZIndex="1"
|
||||
Margin="0,0,4,-1"
|
||||
IsItemsHost="True"
|
||||
KeyboardNavigation.TabIndex="1"
|
||||
Background="Transparent" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
+5
-1
@@ -209,7 +209,11 @@ Public Module IniFile
|
||||
Dim sImagePath As String = If(sItems.Count() >= 2, sItems(1), "")
|
||||
Dim sToolTip As String = If(sItems.Count() >= 3, sItems(2), "")
|
||||
If Not String.IsNullOrWhiteSpace(sBaseDir) Then
|
||||
If Not String.IsNullOrWhiteSpace(sLuaPath) Then sLuaPath = IniFile.m_sBeamDirPath & "\" & sLuaPath
|
||||
If Not String.IsNullOrWhiteSpace(sLuaPath) Then
|
||||
If sLuaPath.Contains(".lua") Then
|
||||
sLuaPath = IniFile.m_sBeamDirPath & "\" & sLuaPath
|
||||
End If
|
||||
End If
|
||||
If Not String.IsNullOrWhiteSpace(sImagePath) Then sImagePath = IniFile.m_sBeamDirPath & "\" & sImagePath
|
||||
End If
|
||||
ReadedButtonItem = New ButtonItem(sLuaPath, sImagePath, sToolTip)
|
||||
|
||||
Reference in New Issue
Block a user