diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 26ccca4..9a855c2 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -262,6 +262,8 @@ Class MainWindow End If ' Impostazione direttorio di configurazione m_sConfigDir = m_sDataRoot & "\" & CONF_DIR + ' imposto nella libreria il riferimento del file config + EgtWPFLib5.IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME ' Impostazione direttorio delle risorse m_sResourcesDir = m_sDataRoot & "\" & RES_DIR ' Impostazione direttorio per file temporanei @@ -293,7 +295,7 @@ Class MainWindow m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR End If ' Impostazione direttorio costruttori di utensili - if GetPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir, m_sIniFile) = 0 Then + If GetPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir, m_sIniFile) = 0 Then m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKERS_DFL_DIR End If ' Recupero nome macchina corrente @@ -316,10 +318,10 @@ Class MainWindow GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) EgtSetKey(sKey) Dim sNestKey As String = "" - EgtUILib.GetPrivateProfileString( S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile) - EgtSetNestKey( sNestKey) + EgtUILib.GetPrivateProfileString(S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile) + EgtSetNestKey(sNestKey) ' Verifico abilitazione nesting automatico - m_bAutoNest = Not String.IsNullOrWhiteSpace( sNestKey) + m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey) ' Recupero opzioni della chiave Dim bKey As Boolean = EgtGetKeyLevel(9423, 2304, 1, m_nKeyLevel) And EgtGetKeyOptions(9423, 2304, 1, m_nKeyOptions) @@ -383,9 +385,9 @@ Class MainWindow Me.WindowStartupLocation = Windows.WindowStartupLocation.Manual Me.Top = nTop Me.Left = nLeft - Me.Height = If( nHeight = 0, 768, nHeight) - Me.Width = If( nWidth = 0, 1366, nWidth) - WindowState = If( nFlag = 1, WindowState.Maximized, WindowState.Normal) + Me.Height = If(nHeight = 0, 768, nHeight) + Me.Width = If(nWidth = 0, 1366, nWidth) + WindowState = If(nFlag = 1, WindowState.Maximized, WindowState.Normal) m_dMWinScale = Math.Min(Me.Width / 1280, Me.Height / 832) ' Info su opzioni chiave EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString() & " " & bProd.ToString()) @@ -430,6 +432,7 @@ Class MainWindow End If End If + ' abilito il bottone per la gestione del comando di Check-Up-Start (posziona lama prelavorazione) If GetPrivateProfileInt(S_GENERAL, "Test", "0", m_sIniFile) = 0 Then m_CadCutPageUC.m_ProjectMgr.TestBtn.Visibility = Visibility.Collapsed Else @@ -555,8 +558,12 @@ Class MainWindow ' Lancio timer per aggiornamento interfaccia m_IdleTimer.Interval = TimeSpan.FromMilliseconds(100) m_IdleTimer.Start() + + ' inizilizzo End Sub +#Region "Selezione dei bottoni IN LAVORO, TAGLII DIRETTI, TAGLI CAD, CORNICI, MACCHINA, OPZIONI" + Private Sub WorkInProgressBtn_Click(sender As Object, e As RoutedEventArgs) Handles WorkInProgressBtn.Click m_CurrentProjectPageUC.m_SceneButtons.MeasureBtn.IsChecked = False ' disbilito Test @@ -874,6 +881,8 @@ Class MainWindow End Select End Sub +#End Region ' Selezione dei bottoni IN LAVORO, TAGLII DIRETTI, TAGLI CAD, CORNICI, MACCHINA, OPZIONI + Private Sub MainWindow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) Handles Me.PreviewMouseDown ' Se sto fotografando, impedisco tutte le operazioni If m_Camera.m_bBusy And Not m_CurrentProjectPageUC.m_SceneButtons.IsMouseOver Then @@ -977,6 +986,8 @@ Class MainWindow MainWindowExit() End Sub +#Region "Uscita dalle pagine RAW, CSV, SPLIT, SIMULATION, TAGLI DIRETTI, MACCHINA, MAINWINDOW" + Private Function ExitFromRaw() As Boolean ' Se non sono in definizione grezzo tutto ok If m_ActivePage <> Pages.RawPart Then Return True @@ -1071,6 +1082,8 @@ Class MainWindow m_objMutex.Close() End Sub +#End Region ' Uscita dalle pagine RAW, CSV, SPLIT, SIMULATION, TAGLI DIRETTI, MACCHINA, MAINWINDOW + Private Sub MainWindow_ContentRendered(sender As Object, e As EventArgs) Handles Me.ContentRendered ' Verifico presenza del collegamento al CN m_bNCLink = (GetPrivateProfileInt(S_GENERAL, K_CNLINK, 0, m_sIniFile) <> 0) And @@ -1081,6 +1094,11 @@ Class MainWindow m_ProdLineTimer.Interval = TimeSpan.FromMilliseconds(2000) m_ProdLineTimer.Start() End If + + ' seleziono il tipo di avvio + m_CurrentProjectPageUC.StartProgram() + ' aggiorno la grafica + EgtDraw() End Sub Friend Sub EgtWPFInit() @@ -1844,6 +1862,7 @@ Class MainWindow If Not IsNothing(ProjectMgrUC.m_VeinMatchingWnd) Then ProjectMgrUC.m_VeinMatchingWnd.IsEnabled = IsEnabled End Sub + ' spegne gli oggetti selezionati in fase di Check-Up-Start (bottone Test) Public Sub TestOff() ' deseleziono gli oggetti e spengo il bottone EgtDeselectObj(m_CadCutPageUC.m_NestPage.m_CurrSelectedCurv) diff --git a/OmagCUT.vbproj b/OmagCUT.vbproj index 0a556cc..2ac46aa 100644 --- a/OmagCUT.vbproj +++ b/OmagCUT.vbproj @@ -190,6 +190,9 @@ CadCutPageUC.xaml + + StartLauncheWDr.xaml + SlabIdWD.xaml @@ -411,6 +414,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/Project/CurrentProjectPageUC.xaml.vb b/Project/CurrentProjectPageUC.xaml.vb index 70f8be6..ecc9de6 100644 --- a/Project/CurrentProjectPageUC.xaml.vb +++ b/Project/CurrentProjectPageUC.xaml.vb @@ -2,6 +2,7 @@ Imports System.Windows.Interop Imports EgtUILib Imports EgtWPFLib +Imports EgtWPFLib5 Public Class CurrentProjectPageUC ' Dichiarazione eventi @@ -31,6 +32,8 @@ Public Class CurrentProjectPageUC FLATS = 1 FRAMES = 2 End Enum + ' elenco dei file di recente apertura + Friend m_MruFiles As New MruList Private Sub CurrentProjectPage_Initialized(sender As Object, e As EventArgs) @@ -64,6 +67,8 @@ Public Class CurrentProjectPageUC End Sub Private Sub CurrentProjectPage_Loaded(sender As Object, e As RoutedEventArgs) + ' Impostazioni MruLists: carico la lista degli ultimi file caricati/aperti + m_MruFiles.Init(S_MRUFILES, 8) If m_bFirst Then ' imposto colore di default Dim DefColor As New Color3d(0, 0, 0) @@ -167,20 +172,30 @@ Public Class CurrentProjectPageUC ' Inizializzo gestore lavorazioni EgtInitMachMgr(m_MainWindow.GetMachinesRootDir(), m_MainWindow.GetToolMakersDir()) m_bFirst = False + + ' ------------------ SELEZIONE AVVIO ----------------------------- + '' apro la finstra di selezione di avvio del programma + 'StartProgram() + ' ------------------ SELEZIONE AVVIO ----------------------------- + ' Se richiesto, carico ultimo progetto Dim bAutoLoadLast As Boolean = GetPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0, m_MainWindow.GetIniFile()) <> 0 - If bAutoLoadLast Then - m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile()) - Dim sPath As String = m_MainWindow.GetSaveDir() & "\" & m_nCurrProj.ToString("D4") & ".nge" - If Not LoadProject(sPath, False) Then - NewProject() - End If - EgtResetModified() - ' Altrimenti ne imposto uno nuovo - Else - m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile()) - NewProject() - End If + 'If bAutoLoadLast Then + ' m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile()) + ' Dim sPath As String = m_MainWindow.GetSaveDir() & "\" & m_nCurrProj.ToString("D4") & ".nge" + ' If Not LoadProject(sPath, False) Then + ' NewProject() + ' End If + ' EgtResetModified() + ' Altrimenti ne imposto uno nuovo + 'Else + ' m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile()) + ' NewProject() + 'End If + + ' creo nuovo progetto + NewProject() + ' Nascondo progress per fotografia PhotoProgress.Visibility = Windows.Visibility.Hidden ' Carico sottopagina opportuna @@ -193,9 +208,11 @@ Public Class CurrentProjectPageUC m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut m_MainWindow.FrameCutBtn.IsChecked = True End If + Else EgtSetCurrentContext(CurrentProjectScene.GetCtx()) End If + ' inibisco selezione diretta da Scene CurrentProjectScene.SetStatusNull() ' Imposto dati progetto @@ -207,7 +224,60 @@ Public Class CurrentProjectPageUC ' Visualizzo lama e lavorazione correnti ToolTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSaw MachiningTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSawing + End Sub + Public Sub StartProgram() + Dim MyStartLancherWD As New StartLauncherWD(m_MainWindow) + MyStartLancherWD.ShowDialog() + + ' Se richiesto, carico ultimo progetto + Dim bAutoLoadLast As Boolean = GetPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0, m_MainWindow.GetIniFile()) <> 0 + m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile()) + ' se ultimo progetto + If MyStartLancherWD.CurrSelection = 2 Then + bAutoLoadLast = True + + ' Stampo il numero di progetto con 4 decimali: 12 -> "0012" + Dim sPath As String = m_MainWindow.GetSaveDir() & "\" & m_nCurrProj.ToString("D4") & ".nge" + ' provo ad aprire l'ultimo progetto modificato + If Not LoadProject(sPath, False) Then + ' altrimenti apro un nuovo progetto + NewProject() + Else + ' salvo il nome del file caricato + m_MruFiles.Add(sPath) + End If + EgtResetModified() + + ' apro il file selezionato all'avvio + ElseIf MyStartLancherWD.CurrSelection = 3 Then + If Not LoadProject(MyStartLancherWD.SelPath, False) Then + ' altrimenti apro un nuovo progetto + NewProject() + Else + ' salvo il nome del file caricato + m_MruFiles.Add(MyStartLancherWD.SelPath) + End If + EgtResetModified() + + ' se nuovo progetto o naviga direttorio + ElseIf MyStartLancherWD.CurrSelection = 1 Or MyStartLancherWD.CurrSelection = 0 Then + bAutoLoadLast = False + NewProject() + End If + + '' Nascondo progress per fotografia + 'PhotoProgress.Visibility = Windows.Visibility.Hidden + '' Carico sottopagina opportuna + 'If GetProjectType() <> PRJ_TYPE.FRAMES Then + ' CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC) + ' m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut + ' m_MainWindow.CadCutBtn.IsChecked = True + 'Else + ' CurrentProjectPageGrid.Children.Add(m_MainWindow.m_FrameCutPageUC) + ' m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut + ' m_MainWindow.FrameCutBtn.IsChecked = True + 'End If End Sub Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseDownScene @@ -247,6 +317,7 @@ Public Class CurrentProjectPageUC End If End Sub + ' apri nuovo progetto Friend Function NewProject(Optional nTabInd As Integer = 1, Optional bRetainParkedParts As Boolean = False) As Boolean ' Salvo l'area totale dei pezzi @@ -369,6 +440,7 @@ Public Class CurrentProjectPageUC Return True End Function + ' carica ultimo progetto Friend Function LoadProject(ByVal sPath As String, Optional ByVal bUpdateIndex As Boolean = True) As Boolean ' Se richiesto, imposto nuovo indice di progetto If bUpdateIndex Then @@ -464,6 +536,7 @@ Public Class CurrentProjectPageUC Return True End Function + ' salva progetto Friend Function SaveProject() As Boolean ' Determino nome del progetto m_nCurrProj = Math.Abs(m_nCurrProj) diff --git a/Project/ProjectMgrUC.xaml.vb b/Project/ProjectMgrUC.xaml.vb index 0bce7cb..4e5dde2 100644 --- a/Project/ProjectMgrUC.xaml.vb +++ b/Project/ProjectMgrUC.xaml.vb @@ -36,6 +36,7 @@ Public Class ProjectMgrUC m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC m_CurrMachine = m_MainWindow.m_CurrentMachine m_CurrNcComm = m_MainWindow.m_CNCommunication + ' Se richiesto carico finestra per VeinMatching e ultimo intarsio If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.MAN_PHOTO) And GetPrivateProfileInt(S_VEINMATCHING, K_VEINMA_ENABLE, 0, m_MainWindow.GetIniFile()) <> 0 And @@ -155,6 +156,7 @@ Public Class ProjectMgrUC EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) If Not m_CurrProjPage.LoadProject(sCurrDir & "\" & sCurrFile) Then m_CurrProjPage.NewProject() + m_CurrProjPage.m_MruFiles.Remove(sCurrDir & "\" & sCurrFile) Else ' Verifico se file salvato con nome guardando il nome della cartella in cui si trova Dim sSaveNameDir As String = String.Empty @@ -171,6 +173,7 @@ Public Class ProjectMgrUC If sCurrDir <> m_MainWindow.GetSaveDir() And sCurrDir <> sSaveNameDir Then m_CurrProjPage.SetLoadPath(sCurrDir & "\" & sCurrFile) End If + m_CurrProjPage.m_MruFiles.Add(sCurrDir & "\" & sCurrFile) End If ' Verifico se andare nel CadCut o nel FrameCut Dim nPrjType As Integer = m_CurrProjPage.GetCurrentProjectType() diff --git a/Project/StartLauncheWDr.xaml b/Project/StartLauncheWDr.xaml new file mode 100644 index 0000000..fc6fb90 --- /dev/null +++ b/Project/StartLauncheWDr.xaml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Project/StartLauncheWDr.xaml.vb b/Project/StartLauncheWDr.xaml.vb new file mode 100644 index 0000000..320b02d --- /dev/null +++ b/Project/StartLauncheWDr.xaml.vb @@ -0,0 +1,77 @@ +Imports EgtUILib +Imports EgtWPFLib +Public Class StartLauncherWD + + Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) + + Public Enum MODE_LAUNCHER As Integer + OpenFolder = 0 + NewProject = 1 + LastProject = 2 + SelectedProject = 3 + End Enum + + Private m_CurrSelection As MODE_LAUNCHER + Public ReadOnly Property CurrSelection As MODE_LAUNCHER + Get + Return m_CurrSelection + End Get + End Property + + Private m_SelPath As String = String.Empty + Public ReadOnly Property SelPath As String + Get + Return m_SelPath + End Get + End Property + + Public Sub New(Owner As Window) + Me.Owner = Owner + InitializeComponent() + End Sub + + ' inizializzo la finestra + Private Sub StartLauncherWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized + ' carico la liste dei file recenti + FilesLsBx.ItemsSource = m_MainWindow.m_CurrentProjectPageUC.m_MruFiles.FileNames + ' posiziono la fistra in centro alla pagina + Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2 + Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2 + ' imopposto il messaggio di avvio + SlectLauncherTxbl.Text = "Seleziona modalità di avvio" + End Sub + + ' lancio l'apertura della pagina dei progetti + Private Sub OpenFolder_Click(sender As Object, e As RoutedEventArgs) Handles OpenFolder.Click + m_CurrSelection = MODE_LAUNCHER.OpenFolder + m_MainWindow.m_PrevActivePage = m_MainWindow.m_ActivePage + ' Passo alla pagina di apertura con preview + m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC) + m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_OpenPage) + m_MainWindow.m_ActivePage = MainWindow.Pages.Open + Me.Close() + End Sub + + ' creo un progetto nuovo + Private Sub NewProject_Click(sender As Object, e As RoutedEventArgs) Handles NewProject.Click + m_CurrSelection = MODE_LAUNCHER.NewProject + EgtZoom(ZM.ALL) + Me.Close() + End Sub + + ' Ultimo progetto + Private Sub LastProject_Click(sender As Object, e As RoutedEventArgs) Handles LastProject.Click + m_CurrSelection = MODE_LAUNCHER.LastProject + EgtZoom(ZM.ALL) + Me.Close() + End Sub + + ' quando viene rilasciato il mouse + Private Sub SelectProject_MouseUp(sender As Object, e As RoutedEventArgs) Handles FilesLsBx.MouseDoubleClick, FilesLsBx.TouchUp + m_SelPath = FilesLsBx.SelectedItem + m_CurrSelection = MODE_LAUNCHER.SelectedProject + EgtZoom(ZM.ALL) + Me.Close() + End Sub + +End Class