diff --git a/AboutBoxWindow/AboutBoxView.xaml.vb b/AboutBoxWindow/AboutBoxView.xaml.vb
index 1cab8fb..60844cd 100644
--- a/AboutBoxWindow/AboutBoxView.xaml.vb
+++ b/AboutBoxWindow/AboutBoxView.xaml.vb
@@ -17,17 +17,18 @@ Public Class AboutBoxView
End Sub
Private Sub AboutBoxView_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
- Me.Owner = Application.Current.MainWindow
- Me.Owner = Owner
+ 'Me.Owner = Application.Current.MainWindow
+ 'Me.Owner = Owner
Me.Top = Owner.Top + (Owner.Height / 2 - Me.Height / 2)
Me.Left = Owner.Left + (Owner.Width / 2 - Me.Width / 2)
End Sub
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
- Me.Close()
+ Me.Visibility = Windows.Visibility.Hidden
End Sub
Private Sub AboutBoxWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
+ Me.Owner = Application.Current.MainWindow
DescriptionLbl.Text = My.Application.Info.Description.ToString()
VersionLbl.Text = "Version : " & My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
diff --git a/AttachedBehaviours/AutomaticCloseExpander.vb b/AttachedBehaviours/AutomaticCloseExpander.vb
new file mode 100644
index 0000000..fc44883
--- /dev/null
+++ b/AttachedBehaviours/AutomaticCloseExpander.vb
@@ -0,0 +1,151 @@
+'----------------------------------------------------------------------------
+' EgalTech 2016-2016
+'----------------------------------------------------------------------------
+' File : AutomaticCloseExpander.vb Data : 8.9.16 Versione : 1
+' Content : AutomatiCloseExpander Behavior (see detailed description below)
+'
+' Created by : Emmanuele Sassi
+' Edited by :
+'
+' Changes :
+'
+'----------------------------------------------------------------------------
+'
+' Behavior description: permit to close other Expander when one is about to expand if they have to use more space than how many the StackPanel offers.
+' Control that can use this behavior: StackPanel
+' Internal structure of the control that can use it (example):
+'
+'
+'
+'
+'
+'
+'
+'
+'
+'
+'
+'
+' IMPORTANT: The behavior have to be added at the end of the StackPanel to function correctly
+' Needed library: System.Windows.Interactivity
+
+Imports System.Windows.Interactivity
+
+Public Class AutomaticCloseExpander
+ Inherits Behavior(Of StackPanel)
+
+ Private ExpanderList As New List(Of Expander)
+ Private OtherControlList As New List(Of FrameworkElement)
+
+ Protected Overrides Sub OnAttached()
+ MyBase.OnAttached()
+ For Each StackPanelChildren In Me.AssociatedObject.Children
+ If TypeOf StackPanelChildren Is Expander Then
+ Dim CurrExpander As Expander = DirectCast(StackPanelChildren, Expander)
+ ExpanderList.Add(CurrExpander)
+ AddHandler CurrExpander.Expanded, AddressOf Expander_Expanded
+ Else
+ Dim OtherControl As FrameworkElement = DirectCast(StackPanelChildren, FrameworkElement)
+ OtherControlList.Add(OtherControl)
+ End If
+ Next
+ End Sub
+
+ Private Sub Expander_Expanded(sender As Object, e As System.Windows.RoutedEventArgs)
+ Dim SelectedExpander As Expander = DirectCast(sender, Expander)
+ If Me.AssociatedObject.Orientation = Orientation.Vertical Then
+ VerticalVerifyDimension(SelectedExpander)
+ Else
+ HorizontalVerifyDimension(SelectedExpander)
+ End If
+ End Sub
+
+ Private Sub VerticalVerifyDimension(SelectedExpander As Expander)
+ Dim TotalDimension As Double = 0
+ 'Aggiungo la dimensione di tutti gli Header
+ For Each Expander In ExpanderList
+ If Expander IsNot SelectedExpander Then
+ If Not Expander.IsExpanded Then
+ TotalDimension += Expander.ActualHeight
+ Else
+ Dim ExpanderContent As FrameworkElement = DirectCast(Expander.Content, FrameworkElement)
+ ExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ TotalDimension += (Expander.ActualHeight - ExpanderContent.DesiredSize.Height)
+ End If
+ Else
+ TotalDimension += Expander.ActualHeight
+ End If
+ Next
+ ' Aggiungo la dimensione dei controlli fissi (non Expander)
+ For Each OtherControl In OtherControlList
+ TotalDimension += OtherControl.ActualHeight
+ Next
+ ' Aggiungo la dimensione del contenuto dell'expander selezionato
+ Dim SelectedContent As FrameworkElement = DirectCast(SelectedExpander.Content, FrameworkElement)
+ SelectedContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ TotalDimension += SelectedContent.DesiredSize.Height
+ ' Verifico per tutti gli expander (tranne quello selezionato) a partire dal primo se sono espansi e nel caso se la loro dimensione totale li fa stare nello spazio disponibile
+ Dim Index As Integer = 0
+ For Index = 0 To ExpanderList.Count - 1
+ If ExpanderList(Index) IsNot SelectedExpander Then
+ If ExpanderList(Index).IsExpanded Then
+ Dim ExpanderContent As FrameworkElement = DirectCast(ExpanderList(Index).Content, FrameworkElement)
+ TotalDimension += ExpanderContent.ActualHeight
+ If TotalDimension > Me.AssociatedObject.MaxHeight Then
+ Exit For
+ End If
+ End If
+ End If
+ Next
+ For CancelIndex = Index To ExpanderList.Count - 1
+ If ExpanderList(CancelIndex) IsNot SelectedExpander Then
+ ExpanderList(CancelIndex).IsExpanded = False
+ End If
+ Next
+ End Sub
+
+ Private Sub HorizontalVerifyDimension(SelectedExpander As Expander)
+ Dim TotalDimension As Double = 0
+ 'Aggiungo la dimensione di tutti gli Header
+ For Each Expander In ExpanderList
+ If Expander IsNot SelectedExpander Then
+ If Not Expander.IsExpanded Then
+ TotalDimension += Expander.ActualWidth
+ Else
+ Dim ExpanderContent As FrameworkElement = DirectCast(Expander.Content, FrameworkElement)
+ ExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ TotalDimension += (Expander.ActualWidth - ExpanderContent.DesiredSize.Width)
+ End If
+ Else
+ TotalDimension += Expander.ActualWidth
+ End If
+ Next
+ ' Aggiungo la dimensione dei controlli fissi (non Expander)
+ For Each OtherControl In OtherControlList
+ TotalDimension += OtherControl.ActualWidth
+ Next
+ ' Aggiungo la dimensione del contenuto dell'expander selezionato
+ Dim SelectedContent As FrameworkElement = DirectCast(SelectedExpander.Content, FrameworkElement)
+ SelectedContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ TotalDimension += SelectedContent.DesiredSize.Width
+ ' Verifico per tutti gli expander (tranne quello selezionato) a partire dal primo se sono espansi e nel caso se la loro dimensione totale li fa stare nello spazio disponibile
+ Dim Index As Integer = 0
+ For Index = 0 To ExpanderList.Count - 1
+ If ExpanderList(Index) IsNot SelectedExpander Then
+ If ExpanderList(Index).IsExpanded Then
+ Dim ExpanderContent As FrameworkElement = DirectCast(ExpanderList(Index).Content, FrameworkElement)
+ TotalDimension += ExpanderContent.ActualWidth
+ If TotalDimension > Me.AssociatedObject.ActualWidth Then
+ Exit For
+ End If
+ End If
+ End If
+ Next
+ For CancelIndex = Index To ExpanderList.Count - 1
+ If ExpanderList(CancelIndex) IsNot SelectedExpander Then
+ ExpanderList(CancelIndex).IsExpanded = False
+ End If
+ Next
+ End Sub
+
+End Class
diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj
index 501985e..3e495bd 100644
--- a/EgtCAM5.vbproj
+++ b/EgtCAM5.vbproj
@@ -117,6 +117,7 @@
AboutBoxView.xaml
+
diff --git a/MainWindow/MainWindowViewModel.vb b/MainWindow/MainWindowViewModel.vb
index 4cbd19a..7737ecb 100644
--- a/MainWindow/MainWindowViewModel.vb
+++ b/MainWindow/MainWindowViewModel.vb
@@ -48,8 +48,12 @@ Namespace EgtCAM5
End Property
Private m_AboutBox As Window
+ Private bFirstAboutBox As Boolean = True
Public ReadOnly Property AboutBox As Window
Get
+ If bFirstAboutBox Then
+ m_AboutBox = New AboutBoxView
+ End If
Return New AboutBoxView
End Get
End Property
diff --git a/ProjectPage/DrawPanel/DrawPanelView.xaml b/ProjectPage/DrawPanel/DrawPanelView.xaml
index d767e2a..a14a7b0 100644
--- a/ProjectPage/DrawPanel/DrawPanelView.xaml
+++ b/ProjectPage/DrawPanel/DrawPanelView.xaml
@@ -1,16 +1,13 @@
+ 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:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
+ xmlns:EgtCAM5="clr-namespace:EgtCAM5">
-
-
-
-
-
-
-
+
-
+
@@ -56,7 +53,7 @@
-
+
@@ -85,7 +82,7 @@
-
+
@@ -129,7 +126,7 @@
-
+
@@ -157,5 +154,9 @@
-
+
+
+
+
+
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
index c78b61a..67c0437 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml
@@ -3,11 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
- xmlns:local="clr-namespace:EgtCAM5"
+ xmlns:EgtCAM5="clr-namespace:EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
-
+ 012
@@ -25,9 +25,9 @@
-
+
-
+
@@ -39,7 +39,7 @@
-
+
@@ -64,9 +64,10 @@
-
-
-
+
+
@@ -86,7 +87,7 @@
IsSynchronizedWithCurrentItem="True">
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
+
+
+
+
diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb
index e0ba793..28c25cd 100644
--- a/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb
+++ b/ProjectPage/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb
@@ -1,4 +1,6 @@
-Imports EgtUILib
+Imports System.IO
+Imports EgtUILib
+
Namespace EgtCAM5
Public Class SimulationExpanderViewModel
@@ -259,6 +261,7 @@ Namespace EgtCAM5
Private m_cmdStep As ICommand
Private m_cmdPlayPause As ICommand
Private m_cmdStop As ICommand
+ Private m_cmdGenerate As ICommand
#End Region
@@ -422,6 +425,39 @@ Namespace EgtCAM5
#End Region ' StopCommand
+#Region "GenerateCommand"
+
+ '''
+ ''' Returns a command that create a new tool.
+ '''
+ Public ReadOnly Property GenerateCommand As ICommand
+ Get
+ If m_cmdGenerate Is Nothing Then
+ m_cmdGenerate = New RelayCommand(AddressOf Generate, AddressOf CanGenerate)
+ End If
+ Return m_cmdGenerate
+ End Get
+ End Property
+
+ '''
+ ''' Creata the new tool. This method is invoked by the NewCommand.
+ '''
+ Public Sub Generate(ByVal param As Object)
+ Dim sInfo As String = "EgtCAM5"
+ Dim sCurrFilePath As String = String.Empty
+ EgtGetCurrFilePath(sCurrFilePath)
+ EgtGenerate(Path.ChangeExtension(sCurrFilePath, ".cnc"), sInfo)
+ End Sub
+
+ '''
+ ''' Returns true if the selected treeviewitem is valid for new tool creation.
+ '''
+ Private Function CanGenerate(ByVal param As Object) As Boolean
+ Return True
+ End Function
+
+#End Region ' GenerateCommand
+
#End Region
#Region "METHODS"
diff --git a/ProjectPage/OptionPanel/OptionPanelView.xaml b/ProjectPage/OptionPanel/OptionPanelView.xaml
index ac878e0..ce79874 100644
--- a/ProjectPage/OptionPanel/OptionPanelView.xaml
+++ b/ProjectPage/OptionPanel/OptionPanelView.xaml
@@ -1,9 +1,10 @@
-
+
diff --git a/ProjectPage/OptionPanel/OptionPanelView.xaml.vb b/ProjectPage/OptionPanel/OptionPanelView.xaml.vb
index b165729..7ac40e0 100644
--- a/ProjectPage/OptionPanel/OptionPanelView.xaml.vb
+++ b/ProjectPage/OptionPanel/OptionPanelView.xaml.vb
@@ -1,3 +1,7 @@
-Public Class DrawOptionPanelView
+Public Class OptionPanelView
+
+ Private Sub Me_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
+ Dim x = ciao.MaxHeight
+ End Sub
End Class
diff --git a/ToolsDbWindow/ToolTreeView2.vb b/ToolsDbWindow/ToolTreeView2.vb
index 4eea397..c0b4509 100644
--- a/ToolsDbWindow/ToolTreeView2.vb
+++ b/ToolsDbWindow/ToolTreeView2.vb
@@ -903,7 +903,7 @@ Public Class ToolTreeViewItem
EgtTdbSetCurrToolParam(MCH_TP.TCPOS, TcPos)
End Sub
- Private Sub WriteToolName()
+ Public Sub WriteToolName()
EgtTdbSetCurrToolParam(MCH_TP.NAME, NamePar)
End Sub
@@ -1156,7 +1156,7 @@ Public Class ToolTreeViewItem
End Get
End Property
- Private Sub IsModifiedReset()
+ Public Sub IsModifiedReset()
m_IsModifiedCorr = False
m_IsModifiedExit = False
m_IsModifiedCornRad = False
diff --git a/ToolsDbWindow/ToolsDbViewModel.vb b/ToolsDbWindow/ToolsDbViewModel.vb
index 2488708..a5a87f3 100644
--- a/ToolsDbWindow/ToolsDbViewModel.vb
+++ b/ToolsDbWindow/ToolsDbViewModel.vb
@@ -386,8 +386,12 @@ Namespace EgtCAM5
ToolFamily.Items.Add(NewToolItem)
EgtTdbSaveCurrTool()
NewToolItem.NewTool = True
+ ' Reimposto l'utensile vecchio nel Db per deselezionarlo e fare le verifiche correttamente
+ EgtTdbSetCurrTool(ToolCopied.Name)
+ ToolCopied.IsSelected = False
+ ToolCopied.NotifyPropertyChanged("IsSelected")
NewToolItem.IsSelected = True
- NewToolItem.NotifyPropertyChanged("IsSelected")
+ 'NewToolItem.NotifyPropertyChanged("IsSelected")
Exit For
End If
Next
@@ -406,7 +410,8 @@ Namespace EgtCAM5
' Verifico se sia selezionato un utensile
ElseIf TypeOf param Is ToolTreeViewItem Then
' Verifico che i parametri dell'utensile siano validi
- Return DirectCast(param, ToolTreeViewItem).IsValid
+ Dim SelectedTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
+ Return SelectedTool.IsValid And Not SelectedTool.IsModified
Else
Return False
End If
@@ -433,14 +438,16 @@ Namespace EgtCAM5
'''
Public Sub Save(ByVal param As Object)
Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
- CurrTool.m_Name = CurrTool.m_Name.Trim()
CurrTool.WriteToolParam()
+ CurrTool.m_Name = CurrTool.m_Name.Trim()
+ CurrTool.WriteToolName()
If IsUUID(Path.GetFileNameWithoutExtension(CurrTool.m_Draw)) Then
CurrTool.SaveToolDraw()
End If
EgtTdbSaveCurrTool()
EgtTdbSave()
CurrTool.NewTool = False
+ CurrTool.IsModifiedReset()
End Sub
'''
@@ -451,7 +458,7 @@ Namespace EgtCAM5
If TypeOf param Is ToolTreeViewItem Then
Dim Tool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
' Verifico che i parametri dell'utensile siano validi
- Return (Tool.IsValid And Tool.IsModified) Or Tool.NewTool
+ Return (Tool.IsValid And (Tool.IsModified Or Tool.NewTool))
Else
Return False
End If