From 8e9a3cdb737261e067cb445c579a11b9e85ea34f Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Fri, 3 Nov 2023 12:21:15 +0100 Subject: [PATCH] Calcolo del tempo di esecizione operazioni --- MachinePanel/MyMachinePanelVM.vb | 45 +++++++++++++++++++++----------- Utility/OmagOFFICEMap.vb | 17 ++++++++++++ 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/MachinePanel/MyMachinePanelVM.vb b/MachinePanel/MyMachinePanelVM.vb index dce43e5..b38e97b 100644 --- a/MachinePanel/MyMachinePanelVM.vb +++ b/MachinePanel/MyMachinePanelVM.vb @@ -210,9 +210,15 @@ Public Class MyMachinePanelVM MessageBox.Show(EgtMsg(MSG_MACHININGDBERRORS + 8), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error) Return End If + + EgtOutLog("Call function: Creazione oggetto MachDbWindowVM") + TimeSpanInit() Dim MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx(), "Stone", OmagOFFICEMap.refMainWindowVM.MainWindowM.nUserLevel > 5) ' Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM) + EgtOutLog(TimeSpanEnd()) + EgtOutLog("Call function: Aggiorna oggetto MachDbWindowVM") + TimeSpanInit() MachDbWindowVM.bPersonalInterface = True ' Collegata allo stile della GroupBox @@ -248,31 +254,40 @@ Public Class MyMachinePanelVM MachDbWindowVM.OpacityIsChecked = 0.25 'Definisco lo stile della DataGrid - 'MachDbWindowVM.HeaderVisibility = DataGridHeadersVisibility.Column - 'MachDbWindowVM.BackgroundDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#484D55"), Brush) - 'MachDbWindowVM.BackGroundHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#484D55"), Brush) - 'MachDbWindowVM.ForegroundHeader = Brushes.White - 'MachDbWindowVM.BorderBrushHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush) - 'MachDbWindowVM.BorderThicknessHeader = 0.0 - 'MachDbWindowVM.FontWeightHeader = FontWeights.Bold - 'MachDbWindowVM.BorderBrushDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush) - 'MachDbWindowVM.BackgroundDataGridRow = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush) - 'MachDbWindowVM.ForegroundDataGridRow = Brushes.White - 'MachDbWindowVM.BorderBrushDataGridRow = Brushes.DarkGray - 'MachDbWindowVM.BorderThicknessDataGridRow = "0 0 0 1" - 'MachDbWindowVM.BorderBrushDataGridCell = Brushes.DarkGray - 'MachDbWindowVM.BorderThicknessDataGridCell = "0 0 1 0" + MachDbWindowVM.HeaderVisibility = DataGridHeadersVisibility.Column + MachDbWindowVM.BackgroundDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#484D55"), Brush) + MachDbWindowVM.BackGroundHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#484D55"), Brush) + MachDbWindowVM.ForegroundHeader = Brushes.White + MachDbWindowVM.BorderBrushHeader = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush) + MachDbWindowVM.BorderThicknessHeader = 0.0 + MachDbWindowVM.FontWeightHeader = FontWeights.Bold + MachDbWindowVM.BorderBrushDataGrid = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush) + MachDbWindowVM.BackgroundDataGridRow = DirectCast(New System.Windows.Media.BrushConverter().ConvertFromString("#1C1D22"), Brush) + MachDbWindowVM.ForegroundDataGridRow = Brushes.White + MachDbWindowVM.BorderBrushDataGridRow = Brushes.DarkGray + MachDbWindowVM.BorderThicknessDataGridRow = "0 0 0 1" + MachDbWindowVM.BorderBrushDataGridCell = Brushes.DarkGray + MachDbWindowVM.BorderThicknessDataGridCell = "0 0 1 0" + EgtOutLog(TimeSpanEnd()) + + EgtOutLog("Call function: Creazione oggetto MachDbWindowV") + TimeSpanInit() Dim MachDbWindowV As New MyMachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM) - + EgtOutLog(TimeSpanEnd()) If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then + EgtOutLog("Call function: Visualizzazione oggetto MachDbWindowV") + TimeSpanInit() MachDbWindowV.Height = 768 MachDbWindowV.Width = 1024 MachDbWindowV.ShowDialog() + EgtOutLog(TimeSpanEnd()) Else Exit Sub End If + + ' Verifico che gli utensili delle lavorazioni correnti siano attrezzati (necessario perchè potrei aver cambiato gli utensili delle lavorazioni) ' e che le lavorazioni correnti siano compatibili con materiale e spessore ' Lama diff --git a/Utility/OmagOFFICEMap.vb b/Utility/OmagOFFICEMap.vb index 9b5b188..324239f 100644 --- a/Utility/OmagOFFICEMap.vb +++ b/Utility/OmagOFFICEMap.vb @@ -4,6 +4,23 @@ Imports EgtUILib Module OmagOFFICEMap + Friend StopWatch As Stopwatch + + Friend Sub TimeSpanInit() + StopWatch = New Stopwatch + StopWatch.Start() + End Sub + + Friend Function TimeSpanEnd() As String + Dim sTime As String = "" + If Not IsNothing(StopWatch) Then + StopWatch.Stop() + Dim ts As TimeSpan = StopWatch.Elapsed + sTime = String.Format("{0:00}:{1:00}:{2:00}.{3:000}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds) + End If + Return sTime + End Function + Private m_refMainWindowVM As MainWindowVM Private m_refTopCommandBarVM As TopCommandBarVM Private m_refProjectVM As ProjectVM