ad38e4d3e1
This reverts commit 00a338c202.
54 lines
1.8 KiB
VB.net
54 lines
1.8 KiB
VB.net
Imports System.IO
|
|
|
|
Public Class SaveFileDialogV
|
|
|
|
Private m_SaveFileDialogVM As SaveFileDialogVM
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(Owner As Window, SaveFileDialogVM As SaveFileDialogVM)
|
|
' Funzione che interpreta l'xaml
|
|
InitializeComponent()
|
|
Me.Owner = Owner
|
|
Me.DataContext = SaveFileDialogVM
|
|
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
|
m_SaveFileDialogVM = SaveFileDialogVM
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
Private Sub SaveBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveBtn.Click
|
|
If m_SaveFileDialogVM.Save() Then
|
|
DialogResult = True
|
|
End If
|
|
End Sub
|
|
|
|
Public Overloads Function ShowDialog() As Boolean?
|
|
' inizializzo dialogo
|
|
m_SaveFileDialogVM.Initialize()
|
|
' pongo focus su testo
|
|
FilePath.Focus()
|
|
' mostro la finestra di dialogo
|
|
Return MyBase.ShowDialog()
|
|
End Function
|
|
|
|
End Class
|
|
|
|
''' <summary>
|
|
''' Class that represent a Converter that convert the complete file path in the file name and vice versa.
|
|
''' </summary>
|
|
Public Class FileNameConverter
|
|
Implements IValueConverter
|
|
|
|
Dim TempPath As String
|
|
|
|
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
|
|
TempPath = CStr(value)
|
|
Return Path.GetFileNameWithoutExtension(TempPath)
|
|
End Function
|
|
|
|
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
|
|
Return Path.GetDirectoryName(TempPath) & "\" & CStr(value) & Path.GetExtension(TempPath)
|
|
End Function
|
|
|
|
End Class |