EgtCAM5 :
- Migliorie varie.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
<UserControl x:Class="InfoExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Expander Header="Properties">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:EgtCAM5.EgtCAM5">
|
||||
|
||||
<Expander Header="Properties" IsExpanded="{Binding IsEnabled}">
|
||||
<UniformGrid>
|
||||
<TextBox/>
|
||||
<TextBox Text="{Binding InfoBox}"/>
|
||||
</UniformGrid>
|
||||
</Expander>
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -1,6 +1,61 @@
|
||||
Namespace EgtCAM5
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class InfoExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
Private m_IsExpanded As Boolean
|
||||
Public Property IsEnabled As Boolean
|
||||
Get
|
||||
Return m_IsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsExpanded Then
|
||||
m_IsExpanded = value
|
||||
OnPropertyChanged("IsEnabled")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_InfoBox As String
|
||||
Public Property InfoBox As String
|
||||
Get
|
||||
Return m_InfoBox
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_InfoBox Then
|
||||
m_InfoBox = value
|
||||
OnPropertyChanged("InfoBox")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Sub UpdateObjDataInObjTree(ByVal nId As Integer)
|
||||
' recupero il tipo del nuovo oggetto
|
||||
Dim nType As Integer = EgtGetType(nId)
|
||||
' stampa dei dati dell'oggetto
|
||||
Dim sDump As String = String.Empty
|
||||
If nType = GDB_TY.NONE Then
|
||||
InfoBox = String.Empty
|
||||
ElseIf nType = GDB_TY.GROUP Then
|
||||
If EgtGroupDump(nId, sDump) Then
|
||||
InfoBox = sDump
|
||||
IsEnabled = True
|
||||
Else
|
||||
InfoBox = String.Empty
|
||||
IsEnabled = False
|
||||
End If
|
||||
Else
|
||||
If EgtGeoObjDump(nId, sDump) Then
|
||||
InfoBox = sDump
|
||||
IsEnabled = True
|
||||
Else
|
||||
InfoBox = String.Empty
|
||||
IsEnabled = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -15,10 +15,13 @@
|
||||
</StackPanel.Style>
|
||||
<TextBlock Text="{Binding TextBlock}"/>
|
||||
<TextBox Text="{Binding TextBox}"/>
|
||||
<CheckBox Content="{Binding CheckBoxText}" IsChecked="{Binding IsChecked}"/>
|
||||
<ComboBox ItemsSource="{Binding ComboItemsList}" SelectedIndex="{Binding ComboSelectedIndex}"/>
|
||||
<CheckBox Content="{Binding CheckBoxText}" IsChecked="{Binding IsChecked}"
|
||||
Visibility="{Binding CheckVisibility}"/>
|
||||
<ComboBox ItemsSource="{Binding ComboItemsList}" SelectedIndex="{Binding ComboSelectedIndex}"
|
||||
Visibility="{Binding ComboVisibility}"/>
|
||||
<UniformGrid>
|
||||
<Button Command="{Binding}" Visibility="{Binding ShowVisibility}" Content="Show" Style="{StaticResource EgtCAM5_Button}"/>
|
||||
<Button Command="{Binding}" Visibility="{Binding ShowVisibility}" Content="Show"
|
||||
Style="{StaticResource EgtCAM5_Button}"/>
|
||||
<Button Command="{Binding DoneCommand}" Content="Done" Style="{StaticResource EgtCAM5_Button}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -102,6 +102,19 @@ Namespace EgtCAM5
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_CheckVisibility As Visibility
|
||||
Public Property CheckVisibility As Visibility
|
||||
Get
|
||||
Return m_CheckVisibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
If value <> m_CheckVisibility Then
|
||||
m_CheckVisibility = value
|
||||
OnPropertyChanged("CheckVisibility")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' ComboBox fields
|
||||
Private m_ComboItemsList As ObservableCollection(Of String)
|
||||
Public Property ComboItemsList As ObservableCollection(Of String)
|
||||
@@ -128,13 +141,26 @@ Namespace EgtCAM5
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ComboVisibility As Visibility
|
||||
Public Property ComboVisibility As Visibility
|
||||
Get
|
||||
Return m_ComboVisibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
If value <> m_ComboVisibility Then
|
||||
m_ComboVisibility = value
|
||||
OnPropertyChanged("ComboVisibility")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Buttons fields
|
||||
Private m_ShowBtnVisibility As Boolean
|
||||
Public Property ShowBtnVisibility As Boolean
|
||||
Private m_ShowBtnVisibility As Visibility
|
||||
Public Property ShowBtnVisibility As Visibility
|
||||
Get
|
||||
Return m_ShowBtnVisibility
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
Set(value As Visibility)
|
||||
m_ShowBtnVisibility = value
|
||||
OnPropertyChanged("ShowBtnVisibility")
|
||||
End Set
|
||||
@@ -248,12 +274,14 @@ Namespace EgtCAM5
|
||||
TextBox = ""
|
||||
If PrepareInputBoxParam.sCheckLabel <> "" Then
|
||||
CheckBoxText = PrepareInputBoxParam.sCheckLabel
|
||||
CheckVisibility = Visibility.Visible
|
||||
End If
|
||||
If PrepareInputBoxParam.bShowCombo Then
|
||||
ComboItemsList.Clear()
|
||||
ComboVisibility = Visibility.Visible
|
||||
End If
|
||||
If PrepareInputBoxParam.bShowBtn Then
|
||||
ShowBtnVisibility = True
|
||||
ShowBtnVisibility = Visibility.Visible
|
||||
End If
|
||||
FocusTextBox = True
|
||||
End Sub
|
||||
@@ -261,6 +289,9 @@ Namespace EgtCAM5
|
||||
|
||||
Private Sub ResetInputBox()
|
||||
Title = "Drawing Parameters"
|
||||
CheckVisibility = Visibility.Hidden
|
||||
ComboVisibility = Visibility.Hidden
|
||||
ShowBtnVisibility = Visibility.Hidden
|
||||
IsExpanded = False
|
||||
IsEnabled = False
|
||||
End Sub
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class LayerTreeViewItem
|
||||
Inherits TreeViewItemBase
|
||||
@@ -26,7 +27,16 @@ Public Class LayerTreeViewItem
|
||||
Return m_OnOff
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_OnOff = value
|
||||
If m_OnOff <> value Then
|
||||
m_OnOff = value
|
||||
' eseguo operazione
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, Id)
|
||||
If value Then
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SHOW)
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.HIDE)
|
||||
End If
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -53,7 +63,7 @@ Public Class LayerTreeViewItem
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(Id As Integer, Name As String, Image As String, CurrColor As System.Drawing.Color)
|
||||
Sub New(Id As Integer, Name As String, Image As String, CurrColor As Color3d)
|
||||
MyBase.New(Name)
|
||||
Me.m_Id = Id
|
||||
Me.PictureString = Image
|
||||
|
||||
+15
-3
@@ -1,8 +1,15 @@
|
||||
<UserControl x:Class="ManageLayerExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:local="clr-namespace:EgtCAM5">
|
||||
<Expander Header="Layers">
|
||||
<Expander>
|
||||
<Expander.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding HeaderName}" Margin="0,0,5,0"/>
|
||||
<Ellipse Height="10" Width="10" Fill="{Binding HeaderColor}" />
|
||||
</StackPanel>
|
||||
</Expander.Header>
|
||||
<StackPanel>
|
||||
|
||||
<TextBox/>
|
||||
@@ -14,6 +21,11 @@
|
||||
</UniformGrid>
|
||||
<TreeView Name="LayerTreeView" MaxHeight="600"
|
||||
ItemsSource="{Binding Path=LayerList}">
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="MouseDoubleClick">
|
||||
<interactivity:InvokeCommandAction Command="{Binding TreeViewDoubleClickCommand}"/>
|
||||
</interactivity:EventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
<TreeView.Resources>
|
||||
<!--Modifico DataTemplate del ToolItem per poter inserire immagine e testo-->
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:LayerTreeViewItem}" ItemsSource="{Binding Items}">
|
||||
@@ -25,9 +37,9 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding OnOff}" Height="15" Width="15" Margin="0,0,5,0"/>
|
||||
<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}" Grid.Column="0" IsChecked="{Binding OnOff}" Height="15" Width="15" Margin="0,0,5,0"/>
|
||||
<Image Grid.Column="1" Source="{Binding PictureString}" Height="15" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Name}"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Name}" Margin="0,0,5,0"/>
|
||||
<Ellipse Grid.Column="3" Height="10" Width="10" Fill="{Binding LayerColor}" />
|
||||
|
||||
</Grid>
|
||||
|
||||
+80
-56
@@ -5,13 +5,38 @@ Imports EgtCAM5.IniFile
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class ManageLayerExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
#Region "Fields & Properties"
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
' Expander Header Properties
|
||||
Private m_HeaderName As String
|
||||
Public Property HeaderName As String
|
||||
Get
|
||||
Return m_HeaderName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_HeaderName = value
|
||||
OnPropertyChanged("HeaderName")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_HeaderColor As SolidColorBrush
|
||||
Public Property HeaderColor As SolidColorBrush
|
||||
Get
|
||||
Return m_HeaderColor
|
||||
End Get
|
||||
Set(value As SolidColorBrush)
|
||||
m_HeaderColor = value
|
||||
OnPropertyChanged("HeaderColor")
|
||||
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
|
||||
|
||||
' Lista dei layer
|
||||
Private m_LayerList As New ObservableCollection(Of LayerTreeViewItem)
|
||||
@@ -26,6 +51,8 @@ Namespace EgtCAM5
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
Application.Msn.Register(Application.LOADOBJTREE, Sub()
|
||||
LoadObjTree()
|
||||
@@ -42,7 +69,19 @@ Namespace EgtCAM5
|
||||
Application.Msn.Register(Application.UPDATEOBJTREE, Sub()
|
||||
UpdateObjTree()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEHEADERNAME, Sub(HeaderName As String)
|
||||
Me.HeaderName = HeaderName
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEHEADERCOLOR, Sub(HeaderColor As Color3d)
|
||||
Me.HeaderColor = New SolidColorBrush(Color.FromArgb(HeaderColor.A, HeaderColor.R, HeaderColor.G, HeaderColor.B))
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJTREEOLDID, Sub(ObjTreeOldId As Integer)
|
||||
Me.m_nObjTreeOldId = ObjTreeOldId
|
||||
End Sub)
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructor
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewPartCommand"
|
||||
@@ -133,11 +172,44 @@ Namespace EgtCAM5
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' NewLayerCommand
|
||||
#End Region ' LayerColorCommand
|
||||
|
||||
#Region "TreeViewDoubleClickCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewDoubleClick Is Nothing Then
|
||||
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick, AddressOf CanTreeViewDoubleClick)
|
||||
End If
|
||||
Return m_cmdTreeViewDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewDoubleClick(ByVal param As Object)
|
||||
If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Returns always true.
|
||||
''' </summary>
|
||||
Private Function CanTreeViewDoubleClick(ByVal param As Object) As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' TreeViewDoubleClickCommand
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
#Region "Methods"
|
||||
#Region "METHODS"
|
||||
|
||||
Private WithEvents ObjTreeTimer As New System.Windows.Threading.DispatcherTimer
|
||||
Private m_nObjTreeOldId As Integer = GDB_ID.NULL
|
||||
@@ -214,9 +286,9 @@ Namespace EgtCAM5
|
||||
End If
|
||||
' inserisco il nodo nell'albero
|
||||
Dim CurrColor As Color3d
|
||||
EgtGetColor(nGroupId, CurrColor)
|
||||
EgtGetCalcColor(nGroupId, CurrColor)
|
||||
Dim sImage As String = TypeToImageInObjTree(GDB_TY.GROUP, nGroupType)
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nGroupId, sText, sImage, CurrColor.ToColor())
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nGroupId, sText, sImage, CurrColor)
|
||||
PrevNodColl.Add(CurrNod)
|
||||
CurrNodColl = CurrNod.Items
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
@@ -250,9 +322,9 @@ Namespace EgtCAM5
|
||||
sText = sTitle + " " + nId.ToString
|
||||
End If
|
||||
Dim CurrColor As Color3d
|
||||
EgtGetColor(nGroupId, CurrColor)
|
||||
EgtGetCalcColor(nGroupId, CurrColor)
|
||||
Dim sImage As String = TypeToImageInObjTree(nType, nDepth)
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nId, sText, sImage, CurrColor.ToColor())
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nId, sText, sImage, CurrColor)
|
||||
CurrNodColl.Add(CurrNod)
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nId, nStat)
|
||||
@@ -306,25 +378,6 @@ Namespace EgtCAM5
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Private Sub ObjTree_AfterCheck(ByVal sender As Object, ByVal e As TreeViewEventArgs) Handles TreeView1.AfterCheck
|
||||
' ' verifico che il check derivi da azione utente
|
||||
' If e.Action = TreeViewAction.Unknown Then
|
||||
' Return
|
||||
' End If
|
||||
' ' recupero l'Id del nuovo oggetto
|
||||
' Dim nId As Integer
|
||||
' If Not Int32.TryParse(e.Node.Name, nId) Then
|
||||
' Return
|
||||
' End If
|
||||
' ' eseguo operazione
|
||||
' m_Controller.SetLastInteger(nId)
|
||||
' If e.Node.Checked Then
|
||||
' m_Controller.ExecuteCommand(CMD.SHOW)
|
||||
' Else
|
||||
' m_Controller.ExecuteCommand(CMD.HIDE)
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
'Private Sub ObjTree_AfterSelect(ByVal sender As Object, ByVal e As TreeViewEventArgs) Handles TreeView1.AfterSelect
|
||||
' ' verifico che il select derivi da azione utente
|
||||
' If e.Action = TreeViewAction.Unknown Then
|
||||
@@ -372,13 +425,6 @@ Namespace EgtCAM5
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
'Private Sub ObjTree_MouseDoubleClick(ByVal sender As Object, e As MouseEventArgs) Handles TreeView1.MouseDoubleClick
|
||||
' If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeOldId)
|
||||
' m_Controller.ExecuteCommand(CMD.SETCURRPARTLAYER)
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
Private Sub UpdateObjInObjTree(ByVal nId As Integer)
|
||||
' ripristino eventuale vecchio oggetto selezionato
|
||||
RevertOldIdInObjTree()
|
||||
@@ -394,28 +440,6 @@ Namespace EgtCAM5
|
||||
ObjTreeTimer.Start()
|
||||
End Sub
|
||||
|
||||
'Private Sub UpdateObjDataInObjTree(ByVal nId As Integer)
|
||||
' ' recupero il tipo del nuovo oggetto
|
||||
' Dim nType As Integer = EgtGetType(nId)
|
||||
' ' stampa dei dati dell'oggetto
|
||||
' Dim sDump As String = String.Empty
|
||||
' If nType = GDB_TY.NONE Then
|
||||
' tBoxInfo.Text = String.Empty
|
||||
' ElseIf nType = GDB_TY.GROUP Then
|
||||
' If EgtGroupDump(nId, sDump) Then
|
||||
' tBoxInfo.Text = sDump
|
||||
' Else
|
||||
' tBoxInfo.Text = String.Empty
|
||||
' End If
|
||||
' Else
|
||||
' If EgtGeoObjDump(nId, sDump) Then
|
||||
' tBoxInfo.Text = sDump
|
||||
' Else
|
||||
' tBoxInfo.Text = String.Empty
|
||||
' End If
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
Private Function RevertOldIdInObjTree() As Integer
|
||||
' salvo il vecchio Id
|
||||
Dim nOldId As Integer = m_nObjTreeOldId
|
||||
@@ -484,7 +508,7 @@ Namespace EgtCAM5
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
#End Region
|
||||
#End Region ' Methods
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user