Merge commit '9d8188521ee7a863e3b03c70b946db435c667e6b'

This commit is contained in:
Dario Sassi
2025-12-03 11:40:55 +01:00
11 changed files with 255 additions and 26 deletions
+1 -3
View File
@@ -1,7 +1,5 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports EgtUILib
Imports EgtUILib.EgtInterface
' Classe che definisce un elemento di base del TreeView
Public Class TreeViewItemBase
@@ -34,7 +32,7 @@ Public Class TreeViewItemBase
End Property
Friend m_isExpanded As Boolean
Public Property IsExpanded As Boolean
Public Property IsExpanded As Boolean
Get
Return m_isExpanded
End Get
+11
View File
@@ -164,6 +164,10 @@
<Compile Include="DataGridMultiselectManaging\IListItemConverter.vb" />
<Compile Include="DataGridMultiselectManaging\MultiSelectorBehaviours.vb" />
<Compile Include="DataGridMultiselectManaging\TwoListSynchronizer.vb" />
<Compile Include="ExecuteWindow\ExecuteWindowV.xaml.vb">
<DependentUpon>ExecuteWindowV.xaml</DependentUpon>
</Compile>
<Compile Include="ExecuteWindow\ExecuteWindowVM.vb" />
<Compile Include="LeftTray\LeftTrayV.xaml.vb">
<DependentUpon>LeftTrayV.xaml</DependentUpon>
</Compile>
@@ -466,6 +470,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ExecuteWindow\ExecuteWindowV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LeftTray\LeftTrayV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -1051,6 +1059,9 @@
<ItemGroup>
<Resource Include="Resources\DrawPanel\BiArc.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ExecuteWindow\reload.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtCAM5\EgtCAM5R32.exe
+1 -1
View File
@@ -6,7 +6,7 @@
<StackPanel Orientation="Horizontal">
<Button Command="{Binding ExecCommand}" ToolTip="{Binding ExecToolTip}"
Style="{StaticResource GridViewPanelButton}" ContextMenuService.Placement="Bottom">
Style="{StaticResource GridViewPanelButton}" ContextMenuService.Placement="Bottom">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding MruScriptNames}" ItemContainerStyle="{StaticResource MruScriptItem}">
</ContextMenu>
+7 -2
View File
@@ -65,8 +65,13 @@ Public Class ExecutePanelVM
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Exec(ByVal param As Object)
Map.refProjectVM.PreExecScript(True)
Map.refProjectVM.ExecScript(String.Empty)
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
Dim ExecuteWindow As New ExecuteWindowV(Application.Current.MainWindow, New ExecuteWindowVM)
ExecuteWindow.ShowDialog()
Else
Map.refProjectVM.PreExecScript(True)
Map.refProjectVM.ExecScript(String.Empty)
End If
End Sub
#End Region ' ExecCommand
+39
View File
@@ -0,0 +1,39 @@
<EgtWPFLib5:EgtCustomWindow x:Class="ExecuteWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtCAM5="clr-namespace:EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="Execute Window"
Height="500" Width="400"
IsResizable="True"
IsMinimizable="True"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False"
TitleBarHeight="32"
PreviewKeyDown="EgtCustomWindow_PreviewKeyDown"
CloseCommand="{Binding Close_Command,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding sScriptText}"
Style="{StaticResource ExecuteWindow_TextBox}"/>
<Button Grid.Row="1"
Grid.ColumnSpan="2"
Content="{Binding OkMsg}"
Command="{Binding Ok_Command}"
Style="{StaticResource EgtCAM5_InputButton}"/>
<Button Grid.Column="1"
Command="{Binding Reload_Command}"
IsEnabled="{Binding bReload_IsEnable}"
Style="{StaticResource ExecuteWindow_Button}">
<Image Source="/Resources/ExecuteWindow/reload.png" Stretch="Uniform"/>
</Button>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+32
View File
@@ -0,0 +1,32 @@
Public Class ExecuteWindowV
#Region "FIELDS & PROPERTIES"
Private WithEvents m_ExecuteWindowVM As ExecuteWindowVM
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New(Owner As Window, ExecuteWindowVM As ExecuteWindowVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = ExecuteWindowVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_ExecuteWindowVM = ExecuteWindowVM
End Sub
#End Region ' Constructor
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ExecuteWindowVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
Private Sub EgtCustomWindow_PreviewKeyDown(sender As Object, e As KeyEventArgs)
If e.Key = Key.Escape Then
Me.Close()
End If
End Sub
End Class
+125
View File
@@ -0,0 +1,125 @@
Imports System.Text
Imports EgtUILib
Imports System.IO
Public Class ExecuteWindowVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
' Evento per chiusura finestra
Public Event m_CloseWindow(bDialogResult As Boolean)
Private ReadOnly scriptFilePath As String = IO.Path.Combine(IniFile.m_sTempDir, $"tmpLua.lua")
Private m_sScriptText As String
Public Property sScriptText As String
Get
Return m_sScriptText
End Get
Set(value As String)
m_sScriptText = value
NotifyPropertyChanged(NameOf(sScriptText))
End Set
End Property
Private Sub SetScriptFile(value As String)
m_sScriptText = value
NotifyPropertyChanged(NameOf(sScriptText))
End Sub
Private m_bReload_IsEnable As Boolean = File.Exists(scriptFilePath)
Public ReadOnly Property bReload_IsEnable As Boolean
Get
Return m_bReload_IsEnable
End Get
End Property
#Region "Messages"
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(20041)
End Get
End Property
Public ReadOnly Property SaveMsg As String
Get
Return EgtMsg(6453)
End Get
End Property
#End Region ' Messages
' Definizione Comandi
Private m_cmdOk As ICommand
Private m_cmdReload As ICommand
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New()
End Sub
#End Region ' Constructor
#Region "METHODS"
Private Sub SaveScript(sPathFileScript As String, sScriptText As String)
If String.IsNullOrWhiteSpace(sPathFileScript) OrElse String.IsNullOrWhiteSpace(sScriptText) Then Return
File.WriteAllText(sPathFileScript, sScriptText, Encoding.UTF8)
End Sub
Private Function ReadScript(sPathFileScript As String) As String
If String.IsNullOrWhiteSpace(sPathFileScript) Then Return String.Empty
Return File.ReadAllText(sPathFileScript)
End Function
#End Region ' Methods
#Region "COMMANDS"
#Region "Ok_Command"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
' Salva il file script
SaveScript(scriptFilePath, m_sScriptText)
' Esegue il file script
EgtLuaExecFile(scriptFilePath)
' Chiudo finestra
RaiseEvent m_CloseWindow(True)
End Sub
#End Region ' Ok_Command
#Region "Reload_Command"
Public ReadOnly Property Reload_Command As ICommand
Get
If m_cmdReload Is Nothing Then
m_cmdReload = New Command(AddressOf Reload)
End If
Return m_cmdReload
End Get
End Property
Public Sub Reload()
If File.Exists(scriptFilePath) Then
SetScriptFile(ReadScript(scriptFilePath))
End If
End Sub
#End Region ' Reload_Command
#End Region ' Commands
End Class
@@ -19,11 +19,11 @@ Public Class LayerTreeViewItem
''' </summary>
Public Overrides Property IsSelected As Boolean
Get
Return m_IsSelected
Return m_isSelected
End Get
Set(value As Boolean)
If (value <> m_IsSelected) Then
m_IsSelected = value
If (value <> m_isSelected) Then
m_isSelected = value
If value Then
' recupero l'Id del nuovo oggetto selezionato
Map.refManageLayerExpanderVM.IsRightClickedLayerTreeItem(False)
@@ -1,6 +1,5 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtCAM5.IniFile
Public Class ManageLayerExpanderVM
Inherits ViewModelBase
@@ -30,22 +29,6 @@ Public Class ManageLayerExpanderVM
End Set
End Property
' Definizione comandi
Private m_cmdNewPart As ICommand
Private m_cmdNewLayer As ICommand
Private m_cmdLayerColor As ICommand
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdTreeViewMouseUp As ICommand
Private m_cmdTreeViewMouseRightButton As ICommand
Private m_cmdSelect As ICommand
Private m_cmdDeselect As ICommand
Private m_cmdName As ICommand
Private m_cmdInfo As ICommand
Private m_cmdRelocate As ICommand
Private m_cmdCopy As ICommand
Private m_cmdDelete As ICommand
Private m_cmdSave As ICommand
' Lista dei layer
Private m_LayerList As New ObservableCollection(Of LayerTreeViewItem)
Public Property LayerList As ObservableCollection(Of LayerTreeViewItem)
@@ -54,6 +37,7 @@ Public Class ManageLayerExpanderVM
End Get
Set(value As ObservableCollection(Of LayerTreeViewItem))
m_LayerList = value
OnPropertyChanged("LayerList")
End Set
End Property
@@ -131,6 +115,22 @@ Public Class ManageLayerExpanderVM
#End Region
' Definizione comandi
Private m_cmdNewPart As ICommand
Private m_cmdNewLayer As ICommand
Private m_cmdLayerColor As ICommand
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdTreeViewMouseUp As ICommand
Private m_cmdTreeViewMouseRightButton As ICommand
Private m_cmdSelect As ICommand
Private m_cmdDeselect As ICommand
Private m_cmdName As ICommand
Private m_cmdInfo As ICommand
Private m_cmdRelocate As ICommand
Private m_cmdCopy As ICommand
Private m_cmdDelete As ICommand
Private m_cmdSave As ICommand
#End Region
#Region "CONSTRUCTOR"
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

+19
View File
@@ -600,6 +600,19 @@
<Setter Property="Width" Value="30"/>
</Style>
<Style x:Key="ExecuteOkWindow_InputButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="60"/>
<Setter Property="Margin" Value="0,5,0,5"/>
</Style>
<Style x:Key="ExecuteWindow_Button" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30"/>
<Setter Property="Margin" Value="2,5,5,5"/>
</Style>
<Style x:Key="DrawOptionPanel_ToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
</Style>
@@ -770,6 +783,12 @@
</Style.Triggers>
</Style>
<Style x:Key="ExecuteWindow_TextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="AcceptsReturn" Value="True"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style x:Key="ToggleButtonTabStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>