Files
OmagCUT/SaveNameWD.xaml.vb
T
Emmanuele Sassi 1f33c844b7 OmagCUT :
- Aggiunta spianatura.
- Aggiunta verifica nome già presente in salva con nome.
2016-03-09 18:44:19 +00:00

44 lines
1.6 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
SaveNameTxbl.Text = "Nome del progetto da salvare"
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", SaveNameTxBx.Text, m_MainWindow.GetIniFile())
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
' Creo path completa con nome inserito
Dim sPath As String = m_MainWindow.GetSaveNameDir() & "\" & SaveNameTxBx.Text & ".nge"
' 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
' Aggiorno file Ini
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, SaveNameTxBx.Text, m_MainWindow.GetIniFile())
' Eseguo salvataggio
m_MainWindow.m_CurrentProjectPageUC.SaveNameProject()
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
EgtDraw()
Close()
End Sub
End Class