Files
OmagCUT/SaveNameWD.xaml.vb
T
Dario Sassi 9d5b45d5a7 OmagCUT 1.6o4 :
- prima versione della lavorazione delle cornici
- piccole migliorie varie.
2016-04-06 06:39:23 +00:00

62 lines
2.4 KiB
VB.net

Imports System.IO
Imports EgtUILib
Imports EgtWPFLib
Public Class SaveNameWD
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = Application.Current.MainWindow
Sub New(Owner As Window)
Me.Owner = Owner
InitializeComponent()
End Sub
Private Sub SaveNameWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
If m_MainWindow.m_ActivePage <> MainWindow.Pages.DirectCut Then
SaveNameTxbl.Text = EgtMsg(MSG_CADCUTPAGEUC + 7) 'Nuovo nome del progetto
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", SaveNameTxBx.Text, m_MainWindow.GetIniFile())
Else
SaveNameTxbl.Text = EgtMsg(MSG_DIRECTCUTPAGEUC + 45) 'Nuovo nome della dima
End If
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
Dim sPath As String = String.Empty
If m_MainWindow.m_ActivePage <> MainWindow.Pages.DirectCut Then
' Creo path completa con nome inserito
sPath = m_MainWindow.GetNamedSaveDir() & "\" & SaveNameTxBx.Text & ".nge"
Else
sPath = m_MainWindow.GetCopyTemplateDir() & "\" & SaveNameTxBx.Text & ".dxf"
End If
' Verifico se il nome inserito è già utilizzato
If File.Exists(sPath) Then
Dim ConfirmWD As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_EGTMSGBOX + 6), EgtMsgBox.Buttons.OK_CANCEL, EgtMsgBox.Icons.NULL)
Select Case ConfirmWD.DialogResult
Case 0 'Cancel
' Esco
Return
End Select
End If
If m_MainWindow.m_ActivePage <> MainWindow.Pages.DirectCut Then
' Aggiorno file Ini
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, SaveNameTxBx.Text, m_MainWindow.GetIniFile())
' Eseguo salvataggio
m_MainWindow.m_CurrentProjectPageUC.SaveNamedProject()
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
' Se cornici, ripristino visualizzazione lavorazioni
If m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut Then
ShowAllCurrPhaseMachinings()
End If
Else
EgtExportDxf(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_COPYTEMPLATE), sPath)
End If
EgtDraw()
Close()
End Sub
End Class