diff --git a/OmagCUT.vbproj b/OmagCUT.vbproj index 2ac46aa..e5b23b7 100644 --- a/OmagCUT.vbproj +++ b/OmagCUT.vbproj @@ -190,6 +190,9 @@ CadCutPageUC.xaml + + CicloStartWD.xaml + StartLauncheWDr.xaml @@ -414,6 +417,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/OmagCUTDictionary.xaml b/OmagCUTDictionary.xaml index abdff73..c369963 100644 --- a/OmagCUTDictionary.xaml +++ b/OmagCUTDictionary.xaml @@ -921,7 +921,16 @@ - + + + + + + + + diff --git a/Options/OptionsPageUC.xaml b/Options/OptionsPageUC.xaml index 0bb9231..8b4f91c 100644 --- a/Options/OptionsPageUC.xaml +++ b/Options/OptionsPageUC.xaml @@ -537,28 +537,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/Options/OptionsPageUC.xaml.vb b/Options/OptionsPageUC.xaml.vb index 3a19837..aa5d221 100644 --- a/Options/OptionsPageUC.xaml.vb +++ b/Options/OptionsPageUC.xaml.vb @@ -9,6 +9,8 @@ Public Class OptionsPageUC Private UnitsList() As String = {"inch", "mm"} Private ThemesList() As String = {"Classic", "Dark"} + Private StartLauncherList() As String = {"Last Project", "New Project", "Open Folder", "Show Window"} + Private Sub OptionsPageUC_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized ' Associazione della lista linguaggi alla combobox @@ -28,6 +30,11 @@ Public Class OptionsPageUC ThemesCmBx.SelectedIndex = GetPrivateProfileInt(S_GENERAL, K_THEME, 0, m_MainWindow.GetIniFile()) Themes_StartUp() + ' Carico la lista con il tipo di avvio + StartLauncherCmBx.ItemsSource = StartLauncherList + ' 0-New, 1-Last, 2-Open, 3-Window + StartLauncherCmBx.SelectedIndex = GetPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0, m_MainWindow.GetIniFile()) + ' Rendo invisibile il GroupBox dei Temi la versione corrente ' ThemesGpBx.Visibility = Windows.Visibility.Collapsed @@ -102,7 +109,7 @@ Public Class OptionsPageUC ToleranceEMsgTxBl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 21) AffondamentoMsgTxBl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 27) LarghezzaMsgTxBl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 28) - + StartLauncherGpBx.Header = "Avvio Programma" End Sub Private Sub UpdateSlabDxf() @@ -304,6 +311,11 @@ Public Class OptionsPageUC WritePrivateProfileString(S_GENERAL, K_MESSAGES, m_MainWindow.m_CurrLanguage.LanguageName, m_MainWindow.GetIniFile()) End Sub + Private Sub StartLauncherCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles StartLauncherCmBx.SelectionChanged + Dim nIndex As Integer = StartLauncherCmBx.SelectedIndex + WritePrivateProfileString(S_GENERAL, K_AUTOLOADLASTPROJ, StartLauncherCmBx.SelectedIndex, m_MainWindow.GetIniFile()) + End Sub + Private Sub UnitsOfMeasureCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles UnitsOfMeasureCmBx.SelectionChanged Dim bMM As Boolean = (UnitsOfMeasureCmBx.SelectedIndex <> 0) EgtSetUiUnits(bMM) diff --git a/Project/CicloStartWD.xaml b/Project/CicloStartWD.xaml new file mode 100644 index 0000000..45f2209 --- /dev/null +++ b/Project/CicloStartWD.xaml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Project/CicloStartWD.xaml.vb b/Project/CicloStartWD.xaml.vb new file mode 100644 index 0000000..c6e9195 --- /dev/null +++ b/Project/CicloStartWD.xaml.vb @@ -0,0 +1,38 @@ +Imports EgtUILib +Imports EgtWPFLib +Imports System.IO +Imports System.Collections.ObjectModel +Imports System.ComponentModel +Class CicloStartWD + + Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) + + 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 + ' 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 + CicloStartTxbl.Text = "Avvio Ciclo-Start" + End Sub + + ' creo un progetto nuovo + Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click + Me.Close() + End Sub + + ' Ultimo progetto + Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click + ' Aspetto e lo avvio + System.Threading.Thread.Sleep(300) + ' avvio il ciclo start della macchina + m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart() + Me.Close() + End Sub + +End Class diff --git a/Project/CurrentProjectPageUC.xaml.vb b/Project/CurrentProjectPageUC.xaml.vb index ecc9de6..962c173 100644 --- a/Project/CurrentProjectPageUC.xaml.vb +++ b/Project/CurrentProjectPageUC.xaml.vb @@ -173,13 +173,8 @@ Public Class CurrentProjectPageUC 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 + '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" @@ -193,7 +188,7 @@ Public Class CurrentProjectPageUC ' NewProject() 'End If - ' creo nuovo progetto + ' creo nuovo progetto (non è possibile avviare il programma senza un progetto) NewProject() ' Nascondo progress per fotografia @@ -227,16 +222,20 @@ Public Class CurrentProjectPageUC End Sub Public Sub StartProgram() + ' leggo il tipo di avvio del programma: 0-New, 1-Last, 2-Open, 3-Window + Dim nStart As Integer = GetPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0, m_MainWindow.GetIniFile()) + Dim MyStartLancherWD As New StartLauncherWD(m_MainWindow) - MyStartLancherWD.ShowDialog() + ' mostro la finestra di avvio solo se configirato (= 3) + If nStart = 3 Then + MyStartLancherWD.ShowDialog() + Else + MyStartLancherWD.CurrSelection = nStart + End If - ' 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 - + ' se ultimo progetto (= 0) + If MyStartLancherWD.CurrSelection = 0 Then ' 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 @@ -249,8 +248,8 @@ Public Class CurrentProjectPageUC End If EgtResetModified() - ' apro il file selezionato all'avvio - ElseIf MyStartLancherWD.CurrSelection = 3 Then + ' seleziono file da finestra di avvio (= 4) + ElseIf MyStartLancherWD.CurrSelection = 4 Then If Not LoadProject(MyStartLancherWD.SelPath, False) Then ' altrimenti apro un nuovo progetto NewProject() @@ -260,9 +259,8 @@ Public Class CurrentProjectPageUC End If EgtResetModified() - ' se nuovo progetto o naviga direttorio + ' se nuovo progetto (= 1) o naviga direttorio (= 2) ElseIf MyStartLancherWD.CurrSelection = 1 Or MyStartLancherWD.CurrSelection = 0 Then - bAutoLoadLast = False NewProject() End If @@ -588,6 +586,8 @@ Public Class CurrentProjectPageUC SetProjectMaterial() ' Eseguo If Not SaveFile(sPath) Then Return False + ' aggiungo il file all'elenco dei file recenti + m_MruFiles.Add(sPath) ' Dichiaro progetto non modificato EgtResetModified() ' Salvo eventuale VeinMatching @@ -641,6 +641,8 @@ Public Class CurrentProjectPageUC If Not SaveFile(sPath) Then Return False End If + ' aggiungo il file all'elenco dei file recenti + m_MruFiles.Add(sPath) ' Dichiaro progetto non modificato EgtResetModified() Return True diff --git a/Project/ProjectMgrUC.xaml.vb b/Project/ProjectMgrUC.xaml.vb index 4e5dde2..e168811 100644 --- a/Project/ProjectMgrUC.xaml.vb +++ b/Project/ProjectMgrUC.xaml.vb @@ -299,7 +299,6 @@ Public Class ProjectMgrUC ptMid.z = (ptEnd.z + ptStart.z) / 2 + dDiam / 2 '--------------------------- Imposto la posizione della macchina ---------------------------- - ' Recupero la posizione macchina Dim dL1, dL2, dL3, dR1, dR2 As Double If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return @@ -315,7 +314,6 @@ Public Class ProjectMgrUC EgtGetCalcPositions(ptMid, dC1, dB1, nStat, dX, dY, dZ) '--------------------------- Comunico i movimenti in origine macchina al CN ---------------------------------------- - ExecuteComandCNC(ptMid, dC1, dB1) Return End If @@ -437,8 +435,18 @@ Public Class ProjectMgrUC ' se abilitato e non è restart, lancio eventuale lua post-trasmissione If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.SIMPLESTATISTICS) And nPhaseRestart = 0 Then m_MainWindow.ExecSentProgScript(False) + ''-------------------Avvio il Ciclo-Start------------------------- + 'Dim MyCicloStartWD As New CicloStartWD(m_MainWindow) + 'MyCicloStartWD.ShowDialog() + ''-------------------Avvio il Ciclo-Start------------------------- End If End If + + '-------------------Avvio il Ciclo-Start------------------------- + Dim MyCicloStartWD As New CicloStartWD(m_MainWindow) + MyCicloStartWD.ShowDialog() + '-------------------Avvio il Ciclo-Start------------------------- + ' Altrimenti linea di produzione Else ' Verifico non sia già stato trasmesso @@ -481,12 +489,12 @@ Public Class ProjectMgrUC GetPrivateProfileInt(S_RAWPART, K_SLABID, 0, m_MainWindow.GetIniFile()) <> 0) If bSlabId Then Dim sBlock As String = "" - GetPrivateProfileString( S_RAWPART, K_BLOCKNAME, "", sBlock, m_MainWindow.GetIniFile()) - Dim nSlabNbr As Integer = GetPrivateProfileInt( S_RAWPART, K_SLABNBR, 0, m_MainWindow.GetIniFile()) + GetPrivateProfileString(S_RAWPART, K_BLOCKNAME, "", sBlock, m_MainWindow.GetIniFile()) + Dim nSlabNbr As Integer = GetPrivateProfileInt(S_RAWPART, K_SLABNBR, 0, m_MainWindow.GetIniFile()) nSlabNbr += 1 Dim sSlabNbr As String = nSlabNbr.ToString() - WritePrivateProfileString( S_RAWPART, K_SLABNBR, sSlabNbr, m_MainWindow.GetIniFile()) - Utility.SetBlockAndSlabNbr( sBlock, sSlabNbr) + WritePrivateProfileString(S_RAWPART, K_SLABNBR, sSlabNbr, m_MainWindow.GetIniFile()) + Utility.SetBlockAndSlabNbr(sBlock, sSlabNbr) End If ' Salvo il progetto m_CurrProjPage.SaveProject() @@ -514,6 +522,7 @@ Public Class ProjectMgrUC If AskTransm.m_nPressedBtn <> 1 Then Return End If End If + ' Se non collegato alla macchina If Not m_MainWindow.m_bNCLink Then m_CurrProjPage.SetWarningMessage(EgtMsg(90316)) 'Non connesso alla macchina @@ -528,6 +537,7 @@ Public Class ProjectMgrUC m_MainWindow.ExecSentProgScript(False, bAlreadySent) Return End If + ' Leggo variabile relativa al programma 1 (standard E80021) m_CurrNcComm.m_CN.n_DReadELS_handle = 0 m_CurrNcComm.m_CN.ReadEls_Add_Parameter(m_CurrMachine.sVarProg1, 1) @@ -601,6 +611,7 @@ Public Class ProjectMgrUC Else m_CurrProjPage.SetErrorMessage(EgtMsg(90318)) 'La macchina non accetta il programma CN End If + End If #End If End Sub diff --git a/Project/StartLauncheWDr.xaml b/Project/StartLauncheWDr.xaml index fc6fb90..83530c4 100644 --- a/Project/StartLauncheWDr.xaml +++ b/Project/StartLauncheWDr.xaml @@ -4,7 +4,7 @@ xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib" FontFamily="{DynamicResource OmagCut_Font}" ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent" - Title="SaveNameWD" Height="300" Width="426.5" ShowInTaskbar="False"> + Title="SaveNameWD" Height="350" Width="426.5" ShowInTaskbar="False"> @@ -14,19 +14,21 @@ - + + + - + + Style="{DynamicResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/> @@ -39,32 +41,33 @@ - - - - - - + + + + + + + + + - - - - + diff --git a/Project/StartLauncheWDr.xaml.vb b/Project/StartLauncheWDr.xaml.vb index 320b02d..f1af65d 100644 --- a/Project/StartLauncheWDr.xaml.vb +++ b/Project/StartLauncheWDr.xaml.vb @@ -1,21 +1,30 @@ Imports EgtUILib Imports EgtWPFLib +Imports System.IO +Imports System.Collections.ObjectModel +Imports System.ComponentModel Public Class StartLauncherWD Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) + ' lista dei file recenti da visualizzare + Private m_RecentFileList As New ObservableCollection(Of FileNameLsBxItem) - Public Enum MODE_LAUNCHER As Integer - OpenFolder = 0 - NewProject = 1 - LastProject = 2 - SelectedProject = 3 + Public Enum MODE_LAUNCHER + LastProject + OpenFolder + NewProject + ShowWindow + SelectedProject End Enum Private m_CurrSelection As MODE_LAUNCHER - Public ReadOnly Property CurrSelection As MODE_LAUNCHER + Public Property CurrSelection As MODE_LAUNCHER Get Return m_CurrSelection End Get + Set(value As MODE_LAUNCHER) + m_CurrSelection = value + End Set End Property Private m_SelPath As String = String.Empty @@ -30,15 +39,70 @@ Public Class StartLauncherWD InitializeComponent() End Sub + '--------------------------- lista dei file recenti ----------------------------------------------------------------------- + Private Class FileNameLsBxItem + Implements INotifyPropertyChanged + + Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + + Private m_sDate As String + Private m_sName As String + + Public Property sDate As String + Get + Return m_sDate + End Get + Set(value As String) + m_sDate = value + End Set + End Property + + Public Property Name As String + Get + Return m_sName + End Get + Set(value As String) + If value <> m_sName Then + m_sName = value + NotifyPropertyChanged("Name") + End If + End Set + End Property + + Public ReadOnly Property GraphicName As String + Get + ' recupero il nome del file con estensione, altrimenti -> Path.GetFileNameWithoutExtension(m_sName) + Return Path.GetFileNameWithoutExtension(m_sName) + End Get + End Property + + + Sub New(Name As String, dDate As Date) + Me.m_sName = Name + Me.m_sDate = dDate.ToString + End Sub + + Public Sub NotifyPropertyChanged(propName As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + End Sub + + End Class + '--------------------------- lista dei file recenti ----------------------------------------------------------------------- + ' inizializzo la finestra Private Sub StartLauncherWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized + FilesLsBx.ItemsSource = m_RecentFileList ' carico la liste dei file recenti - FilesLsBx.ItemsSource = m_MainWindow.m_CurrentProjectPageUC.m_MruFiles.FileNames + For Each ItemFile In m_MainWindow.m_CurrentProjectPageUC.m_MruFiles.FileNames + m_RecentFileList.Add(New FileNameLsBxItem(ItemFile, File.GetLastAccessTime(ItemFile))) + Next ' 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" + FileName.Text = "Progetti recenti" + DataFile.Text = "Ultima apertura" End Sub ' lancio l'apertura della pagina dei progetti @@ -68,7 +132,8 @@ Public Class StartLauncherWD ' quando viene rilasciato il mouse Private Sub SelectProject_MouseUp(sender As Object, e As RoutedEventArgs) Handles FilesLsBx.MouseDoubleClick, FilesLsBx.TouchUp - m_SelPath = FilesLsBx.SelectedItem + ' recupero il nome selezionato + m_SelPath = FilesLsBx.SelectedItem.Name m_CurrSelection = MODE_LAUNCHER.SelectedProject EgtZoom(ZM.ALL) Me.Close()