diff --git a/Icarus/AttachedProperties/TreeViewItemHelper.vb b/Icarus/AttachedProperties/TreeViewItemHelper.vb
index d058a2b..7875310 100644
--- a/Icarus/AttachedProperties/TreeViewItemHelper.vb
+++ b/Icarus/AttachedProperties/TreeViewItemHelper.vb
@@ -72,13 +72,15 @@ Public Module TreeViewItemHelper
Dim treeViewItem As TreeViewItem = VisualUpwardSearch(Of TreeViewItem)(TryCast(e.OriginalSource, DependencyObject))
If treeViewItem IsNot Nothing Then
treeViewItem.IsSelected = True
- Dim Tree As TreeView = VisualUpwardSearch(Of TreeView)(TryCast(treeViewItem, DependencyObject))
- If Not IsNothing(Tree) Then
- Dim myTransform As GeneralTransform = treeViewItem.TransformToAncestor(Tree)
+ If Not IsNothing(treeViewItem.ContextMenu) Then
+ Dim Tree As TreeView = VisualUpwardSearch(Of TreeView)(TryCast(treeViewItem, DependencyObject))
+ If Not IsNothing(Tree) Then
+ Dim myTransform As GeneralTransform = treeViewItem.TransformToAncestor(Tree)
- Dim myOffset As Point = myTransform.Transform(New Point(0, 0))
- treeViewItem.ContextMenu.HorizontalOffset = -treeViewItem.ActualWidth + (-myOffset.X) + Tree.ActualWidth - 3
- treeViewItem.ContextMenu.VerticalOffset = -3
+ Dim myOffset As Point = myTransform.Transform(New Point(0, 0))
+ treeViewItem.ContextMenu.HorizontalOffset = -treeViewItem.ActualWidth + (-myOffset.X) + Tree.ActualWidth - 3
+ treeViewItem.ContextMenu.VerticalOffset = -3
+ End If
End If
e.Handled = True
End If
diff --git a/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml b/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml
index 41f88e6..e90d3eb 100644
--- a/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml
+++ b/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml
@@ -1,23 +1,25 @@
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
+ xmlns:local="clr-namespace:Icarus"
+ Title="{Binding sTitle}"
+ Height="500"
+ Width="800"
+ WindowStartupLocation="CenterOwner"
+ Style="{StaticResource Dialog_Window}">
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SelectedItem="{Binding ItemSelected}"
+ ColumnHeaderStyle="{StaticResource EgtManageFile_DataGridColumnHeader}">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -300,25 +334,12 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
@@ -330,10 +351,12 @@
-
+
-
+
@@ -358,52 +381,46 @@
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml.vb b/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml.vb
index e8fc25e..d295cb3 100644
--- a/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml.vb
+++ b/Icarus/EgtManageFileDialog/EgtManageFileDialogV.xaml.vb
@@ -8,6 +8,9 @@ Public Class EgtManageFileDialogV
Private Shadows DialogResult As DialogResult
+ '''
+ ''' Stringa che specifica il titolo da mostrare
+ '''
Public Overloads Property Title As String
Get
Return m_EgtManageFileDialogVM.sTitle
diff --git a/Icarus/EgtManageFileDialog/EgtManageFileDialogVM.vb b/Icarus/EgtManageFileDialog/EgtManageFileDialogVM.vb
index 086d67d..81fae4d 100644
--- a/Icarus/EgtManageFileDialog/EgtManageFileDialogVM.vb
+++ b/Icarus/EgtManageFileDialog/EgtManageFileDialogVM.vb
@@ -37,6 +37,175 @@ Public Class EgtManageFileDialogVM
End Set
End Property
+ Private m_nMode As Integer
+ Public Property nMode As Integer
+ Get
+ Return m_nMode
+ End Get
+ Set(value As Integer)
+ m_nMode = value
+ End Set
+ End Property
+
+ Private m_RootList As New ObservableCollection(Of EgtDirectory)
+ Public Property RootList As ObservableCollection(Of EgtDirectory)
+ Get
+ Return m_RootList
+ End Get
+ Set(value As ObservableCollection(Of EgtDirectory))
+ m_RootList = value
+ End Set
+ End Property
+ 'Public ReadOnly Property RootList_View As CollectionView
+ ' Get
+ ' Return m_RootList_View
+ ' End Get
+ 'End Property
+
+ Public m_SelTreeItem As EgtDirectory
+ Public Property SelTreeItem As EgtDirectory
+ Get
+ Return m_SelTreeItem
+ End Get
+ Set(value As EgtDirectory)
+ m_SelTreeItem = value
+ NotifyPropertyChanged(NameOf(SelTreeItem))
+ End Set
+ End Property
+ Friend Sub UpdateSelTreeItem(Item As EgtDirectory)
+ m_SelTreeItem = Item
+ NotifyPropertyChanged(NameOf(SelTreeItem))
+ End Sub
+
+ Public m_ItemSelected As EgtDirectory
+ Public Property ItemSelected As EgtDirectory
+ Get
+ Return m_ItemSelected
+ End Get
+ Set(value As EgtDirectory)
+ m_ItemSelected = value
+ Dim Item As EgtItem = TryCast(m_ItemSelected, EgtItem)
+ If Not IsNothing(Item) Then
+ sSaveFileName = Item.sName
+ Else
+ Dim Folder As EgtFolder = TryCast(m_ItemSelected, EgtFolder)
+ If Not IsNothing(Folder) Then
+ sSaveFileName = Folder.sName
+ End If
+ End If
+ End Set
+ End Property
+ Friend Sub SetItemSelected(value As EgtDirectory)
+ m_ItemSelected = value
+ NotifyPropertyChanged(NameOf(ItemSelected))
+ End Sub
+
+ Private m_sSelPath As String
+ Public Overloads Property sSelPath As String
+ Get
+ Return m_sSelPath
+ End Get
+ Set(value As String)
+ m_sSelPath = value
+ NotifyPropertyChanged(NameOf(sSelPath))
+ End Set
+ End Property
+
+ Private m_sSaveFileName As String
+ Public Property sSaveFileName As String
+ Get
+ Return m_sSaveFileName
+ End Get
+ Set(value As String)
+ m_sSaveFileName = value
+ NotifyPropertyChanged(NameOf(sSaveFileName))
+ End Set
+ End Property
+
+ Private m_FilterList As ObservableCollection(Of EgtExstension)
+ Public Property FilterList As ObservableCollection(Of EgtExstension)
+ Get
+ Return m_FilterList
+ End Get
+ Set(value As ObservableCollection(Of EgtExstension))
+ m_FilterList = value
+ End Set
+ End Property
+
+ Private m_SelFilter As EgtExstension
+ Public Property SelFilter As EgtExstension
+ Get
+ Return m_SelFilter
+ End Get
+ Set(value As EgtExstension)
+ m_SelFilter = value
+ Dim CurrItem As EgtFolder = TryCast(m_SelTreeItem, EgtFolder)
+ If Not IsNothing(CurrItem) Then
+ CollectionViewSource.GetDefaultView(CurrItem.FolderList).Refresh()
+ End If
+ End Set
+ End Property
+
+ ' Lista modalita' di visualizzazione
+ Private m_ViewModeList As ObservableCollection(Of IdNameStruct)
+ Public Property ViewModeList As ObservableCollection(Of IdNameStruct)
+ Get
+ Return m_ViewModeList
+ End Get
+ Set(value As ObservableCollection(Of IdNameStruct))
+ m_ViewModeList = value
+ End Set
+ End Property
+
+ Private m_SelViewMode As IdNameStruct
+ Public Property SelViewMode As IdNameStruct
+ Get
+ Return m_SelViewMode
+ End Get
+ Set(value As IdNameStruct)
+ m_SelViewMode = value
+ Select Case m_SelViewMode.Id
+ Case VisualizationType.SCHEDULETEMPLATE
+ m_nSelTab = VisualizationContainerType.LISTBOX
+ nTaskStatus = 0
+ Case VisualizationType.DETAILSTEMPLATE
+ m_nSelTab = VisualizationContainerType.DATAGRID
+ Case VisualizationType.BOXINGTEMPLATE
+ m_nSelTab = VisualizationContainerType.LISTBOX
+ nTaskStatus = 1
+ Case VisualizationType.CONTENTTEMPLATE
+ m_nSelTab = VisualizationContainerType.LISTBOX
+ nTaskStatus = 2
+ End Select
+ NotifyPropertyChanged(NameOf(nSelTab))
+ End Set
+ End Property
+
+ ' indice di selezione del TabControl che cambia la ListBox/DataGrid
+ Private m_nSelTab As Integer
+ Public Property nSelTab As Integer
+ Get
+ Return m_nSelTab
+ End Get
+ Set(value As Integer)
+ m_nSelTab = value
+ End Set
+ End Property
+
+#Region "Initial data from window opening"
+
+ ' indice del filtro estensione impostato durante creazione finestra
+ Private m_nFilterIndex As Integer
+ Public Property nFilterIndex As Integer
+ Get
+ Return m_nFilterIndex
+ End Get
+ Set(value As Integer)
+ m_nFilterIndex = value
+ End Set
+ End Property
+
+ ' lista delle estensioni impostata durante creazione finestra
Private m_sFilter As String
Public Property sFilter As String
Get
@@ -48,16 +217,17 @@ Public Class EgtManageFileDialogVM
Dim FilterListSplit As String() = sFilter.Split("|"c)
For i As Integer = 0 To FilterListSplit.Count - 1
If i Mod 2 = 0 Then
- Dim strExstension As New EgtExstension() With {.sNameExstension = FilterListSplit(i) & FilterListSplit(i + 1), .sExstension = FilterListSplit(i + 1)}
- m_ListFilter.Add(strExstension)
- m_SelExstension.sNameExstension = m_ListFilter(0).sNameExstension
- m_SelExstension.sExstension = m_ListFilter(0).sExstension
+ Dim strExstension As New EgtExstension() With {.sNameExstension = FilterListSplit(i), .sExstension = FilterListSplit(i + 1)}
+ m_FilterList.Add(strExstension)
+ m_SelFilter.sNameExstension = m_FilterList(0).sNameExstension
+ m_SelFilter.sExstension = m_FilterList(0).sExstension
End If
Next
End If
End Set
End Property
+ ' Path della cartella iniziale impostata durante creazione finestra
Private m_sInitialDirectory As String
Public Property sInitialDirectory As String
Get
@@ -66,12 +236,10 @@ Public Class EgtManageFileDialogVM
Set(value As String)
m_sInitialDirectory = value
m_sSaveFileName = "New.icrs"
- m_sUrl_Msg = m_sInitialDirectory
- m_sFileNameMsg = FileName_Msg
+ m_sSelPath = m_sInitialDirectory
Dim DirectoryStart As String() = m_sInitialDirectory.Split("\"c)
For i As Integer = 0 To m_RootList.Count - 1
- m_RootList(i).sIconSource = "\Resources\EgtDialog\Root.png"
If m_RootList(i).sName.Trim("\") = DirectoryStart(0) Then
m_RootList(i).IsExpanded = True
Dim CurrItem As EgtFolder = TryCast(m_RootList(i), EgtFolder)
@@ -96,6 +264,7 @@ Public Class EgtManageFileDialogVM
End Set
End Property
+ ' Nome del file iniziale impostato durante creazione finestra
Private m_sFileName As String
Public Property sFileName As String
Get
@@ -107,38 +276,7 @@ Public Class EgtManageFileDialogVM
End Set
End Property
- Private m_sUrl_Msg As String
- Public Overloads Property sUrl_Msg As String
- Get
- Return m_sUrl_Msg
- End Get
- Set(value As String)
- m_sUrl_Msg = value
- NotifyPropertyChanged(NameOf(sUrl_Msg))
- End Set
- End Property
-
- Private m_sSaveFileName As String
- Public Property sSaveFileName As String
- Get
- Return m_sSaveFileName
- End Get
- Set(value As String)
- m_sSaveFileName = value
- NotifyPropertyChanged(NameOf(sSaveFileName))
- End Set
- End Property
-
- Private m_sFileNameMsg As String
- Public Property sFileNameMsg As String
- Get
- Return m_sFileNameMsg
- End Get
- Set(value As String)
- m_sFileNameMsg = value
- NotifyPropertyChanged(NameOf(sFileNameMsg))
- End Set
- End Property
+#End Region ' Initial data from window opening
Private m_nTaskStatus As Integer
Public Property nTaskStatus As String
@@ -151,175 +289,8 @@ Public Class EgtManageFileDialogVM
End Set
End Property
- Private m_nFilterIndex As Integer
- Public Property nFilterIndex As Integer
- Get
- Return m_nFilterIndex
- End Get
- Set(value As Integer)
- m_nFilterIndex = value
- End Set
- End Property
-
- Private m_nMode As Integer
- Public Property nMode As Integer
- Get
- Return m_nMode
- End Get
- Set(value As Integer)
- m_nMode = value
- End Set
- End Property
-
- Private m_nSelectView As Integer
- Public Property nSelectView As Integer
- Get
- Return m_nSelectView
- End Get
- Set(value As Integer)
- m_nSelectView = value
- End Set
- End Property
-
- Private m_ListFilter As ObservableCollection(Of EgtExstension)
- Public Property ListFilter As ObservableCollection(Of EgtExstension)
- Get
- Return m_ListFilter
- End Get
- Set(value As ObservableCollection(Of EgtExstension))
- m_ListFilter = value
- End Set
- End Property
-
- Private m_RootList As New ObservableCollection(Of EgtDirectory)
- Public Property RootList As ObservableCollection(Of EgtDirectory)
- Get
- Return m_RootList
- End Get
- Set(value As ObservableCollection(Of EgtDirectory))
- m_RootList = value
- End Set
- End Property
-
- Private m_VisualizationList As ObservableCollection(Of IdNameStruct)
- Public Property VisualizationList As ObservableCollection(Of IdNameStruct)
- Get
- Return m_VisualizationList
- End Get
- Set(value As ObservableCollection(Of IdNameStruct))
- m_VisualizationList = value
- End Set
- End Property
-
- Private m_SelVisualization As IdNameStruct
- Public Property SelVisualization As IdNameStruct
- Get
- Return m_SelVisualization
- End Get
- Set(value As IdNameStruct)
- m_SelVisualization = value
- Select Case m_SelVisualization.Id
- Case VisualizationType.SCHEDULETEMPLATE
- m_nSelectView = VisualizationContainerType.LISTBOX
- nTaskStatus = 0
- m_UVision_Visibility = Visibility.Visible
- Case VisualizationType.DETAILSTEMPLATE
- m_nSelectView = VisualizationContainerType.DATAGRID
- m_UVision_Visibility = Visibility.Collapsed
- Case VisualizationType.BOXINGTEMPLATE
- m_nSelectView = VisualizationContainerType.LISTBOX
- nTaskStatus = 1
- m_UVision_Visibility = Visibility.Collapsed
- Case VisualizationType.CONTENTTEMPLATE
- m_nSelectView = VisualizationContainerType.LISTBOX
- nTaskStatus = 2
- m_UVision_Visibility = Visibility.Collapsed
- End Select
- NotifyPropertyChanged(NameOf(nSelectView))
- NotifyPropertyChanged(NameOf(UVision_Visibility))
- End Set
- End Property
-
- Private m_UVision_Visibility As Visibility
- Public Property UVision_Visibility As Visibility
- Get
- Return m_UVision_Visibility
- End Get
- Set(value As Visibility)
- m_UVision_Visibility = value
- End Set
- End Property
-
- Private m_SelExstension As EgtExstension
- Public Property SelExstension As EgtExstension
- Get
- Return m_SelExstension
- End Get
- Set(value As EgtExstension)
- m_SelExstension = value
- Dim CurrItem As EgtFolder = TryCast(m_SelTreeItem, EgtFolder)
- If Not IsNothing(CurrItem) Then
- CollectionViewSource.GetDefaultView(CurrItem.FolderList).Refresh()
- End If
- End Set
- End Property
-
- Public m_SelTreeItem As EgtDirectory
- Public Property SelTreeItem As EgtDirectory
- Get
- Return m_SelTreeItem
- End Get
- Set(value As EgtDirectory)
- m_SelTreeItem = value
- NotifyPropertyChanged(NameOf(SelTreeItem))
- End Set
- End Property
-
- Friend Sub UpdateSelRoot(Item As EgtDirectory)
- m_SelTreeItem = Item
- NotifyPropertyChanged(NameOf(SelTreeItem))
- End Sub
-
- 'Comandi
- Private m_cmdCancel As ICommand
- Private m_cmdOk As ICommand
- Private m_cmdGoBack As ICommand
- Private m_cmdDoubleClick As ICommand
- Friend Event m_CloseWindow(bDialogResult As MessageBoxResult)
-
-#End Region ' FIELDS & PROPERTIES
-
-#Region "CONTRUCTORS"
-
- Sub New()
- m_RootList.Clear()
- EgtDirectory.refUpdateSelRoot = AddressOf UpdateSelRoot
- Dim drives As DriveInfo() = DriveInfo.GetDrives().Where(Function(d) d.IsReady).ToArray()
-
- m_ListFilter = New ObservableCollection(Of EgtExstension)
-
- For i As Integer = 0 To drives.Count() - 1
- Dim directory As New EgtFolder(drives(i).RootDirectory, Nothing, Me)
- 'AddHandler directory.PropertyChanged, AddressOf Directory_PropertyChanged
- m_RootList.Add(directory)
- Next
-
- m_SelExstension = New EgtExstension()
- SetVisualizzationList()
-
- m_SelVisualization.Id = VisualizationType.SCHEDULETEMPLATE
- m_nSelectView = VisualizationContainerType.LISTBOX
- nTaskStatus = 0
- m_UVision_Visibility = Visibility.Visible
-
- NotifyPropertyChanged(NameOf(RootList))
- NotifyPropertyChanged(NameOf(ListFilter))
- NotifyPropertyChanged(NameOf(VisualizationList))
- End Sub
-
-#End Region ' CONTRUCTORS
-
#Region "Messages"
+
Public ReadOnly Property Name_Msg As String
Get
Return EgtMsg(15060)
@@ -350,18 +321,6 @@ Public Class EgtManageFileDialogVM
End Get
End Property
- Public ReadOnly Property FileName_Msg As String
- Get
- Return EgtMsg(15065)
- End Get
- End Property
-
- Public ReadOnly Property FolderName_Msg As String
- Get
- Return EgtMsg(15066)
- End Get
- End Property
-
Public ReadOnly Property Schedule_Msg As String
Get
Return EgtMsg(15067)
@@ -392,29 +351,85 @@ Public Class EgtManageFileDialogVM
End Get
End Property
+ Public ReadOnly Property FileName_Msg As String
+ Get
+ Return If(m_nMode = ModeTypes.FILE, EgtMsg(15065), EgtMsg(15066)) ' File Name Folder Name
+ End Get
+ End Property
+
#End Region
+ 'Comandi
+ Private m_cmdCancel As ICommand
+ Private m_cmdOk As ICommand
+ Private m_cmdGoBack As ICommand
+ Private m_cmdDoubleClick As ICommand
+ Friend Event m_CloseWindow(bDialogResult As MessageBoxResult)
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONTRUCTORS"
+
+ Sub New()
+ m_RootList.Clear()
+ EgtDirectory.refUpdateSelRoot = AddressOf UpdateSelTreeItem
+ Dim drives As DriveInfo() = DriveInfo.GetDrives().Where(Function(d) d.IsReady).ToArray()
+
+ m_FilterList = New ObservableCollection(Of EgtExstension)
+
+ EgtFolder.SetEgtManageFileDialogVM(Me)
+
+ For i As Integer = 0 To drives.Count() - 1
+ Dim directory As New EgtFolder(drives(i).RootDirectory, Nothing, "\Resources\EgtDialog\Root.png")
+ m_RootList.Add(directory)
+ Next
+
+ m_SelFilter = New EgtExstension()
+ SetVisualizzationList()
+
+ m_SelViewMode.Id = VisualizationType.SCHEDULETEMPLATE
+ m_nSelTab = VisualizationContainerType.LISTBOX
+ nTaskStatus = 0
+
+ 'm_RootList_ViewSource = New CollectionViewSource() With {.Source = m_RootList}
+ 'm_RootList_View = m_RootList_ViewSource.View
+ 'm_RootList_View.Filter = AddressOf RootListFilter
+
+ NotifyPropertyChanged(NameOf(RootList))
+ NotifyPropertyChanged(NameOf(FilterList))
+ NotifyPropertyChanged(NameOf(ViewModeList))
+ NotifyPropertyChanged(NameOf(FileName_Msg))
+
+ End Sub
+
+#End Region ' CONTRUCTORS
+
+
#Region "METHODS"
+ Private Function RootListFilter(CurrItem As Object) As Boolean
+ Return TypeOf CurrItem Is EgtFolder
+ End Function
+
'''
''' Inizializza la ComboBox per la scelta dei template
'''
Private Sub SetVisualizzationList()
- m_VisualizationList = New ObservableCollection(Of IdNameStruct)
+ m_ViewModeList = New ObservableCollection(Of IdNameStruct)
Dim ItemVisualization As New IdNameStruct With {
.Id = 0,
.Name = Schedule_Msg
}
- m_VisualizationList.Add(ItemVisualization)
+ m_ViewModeList.Add(ItemVisualization)
ItemVisualization.Id = 1
ItemVisualization.Name = Details_Msg
- m_VisualizationList.Add(ItemVisualization)
+ m_ViewModeList.Add(ItemVisualization)
ItemVisualization.Id = 2
ItemVisualization.Name = Boxing_Msg
- m_VisualizationList.Add(ItemVisualization)
+ m_ViewModeList.Add(ItemVisualization)
ItemVisualization.Id = 3
ItemVisualization.Name = Content_Msg
- m_VisualizationList.Add(ItemVisualization)
+ m_ViewModeList.Add(ItemVisualization)
End Sub
Private Sub Directory_PropertyChanged(sender As Object, e As PropertyChangedEventArgs)
@@ -423,16 +438,12 @@ Public Class EgtManageFileDialogVM
End If
End Sub
- Public Sub MouseDoubleClick()
- m_SelTreeItem.m_ItemSelected.IsExpanded = True
- m_SelTreeItem.m_ItemSelected.IsSelected = True
- End Sub
-
#End Region
#Region "COMMANDS"
#Region "Command Ok"
+
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
@@ -443,21 +454,22 @@ Public Class EgtManageFileDialogVM
End Property
Public Sub Ok()
- Dim CurrItem As EgtItem = TryCast(m_SelTreeItem.m_ItemSelected, EgtItem)
+ Dim CurrItem As EgtItem = TryCast(m_ItemSelected, EgtItem)
If nMode = ModeTypes.FILE Then
If Not IsNothing(CurrItem) Then
- m_sFileName = m_SelTreeItem.InfoDir.FullName & "\" & CurrItem.sName
+ m_sFileName = m_SelTreeItem.sFullName
Else
- m_sFileName = m_SelTreeItem.InfoDir.FullName & "\" & m_sSaveFileName
+ m_sFileName = m_SelTreeItem.sFullName & "\" & m_sSaveFileName
End If
ElseIf nMode = ModeTypes.FOLDER Then
- m_sFileName = m_SelTreeItem.InfoDir.FullName
+ m_sFileName = m_SelTreeItem.sFullName
End If
RaiseEvent m_CloseWindow(DialogResult.OK)
End Sub
#End Region 'Command Ok
-#Region "Command GoBack"
+#Region "GoBack"
+
Public ReadOnly Property GoBack_Command As ICommand
Get
If m_cmdGoBack Is Nothing Then
@@ -468,16 +480,20 @@ Public Class EgtManageFileDialogVM
End Property
Public Sub GoBack()
- If Not IsNothing(m_SelTreeItem.m_ParentFolder) Then
- m_SelTreeItem = m_SelTreeItem.m_ParentFolder
- m_SelTreeItem.IsSelected = True
- m_sUrl_Msg = m_SelTreeItem.InfoDir.FullName
- NotifyPropertyChanged(NameOf(sUrl_Msg))
+ If Not IsNothing(m_SelTreeItem) AndAlso Not IsNothing(m_SelTreeItem.m_ParentFolder) Then
+ If TypeOf m_SelTreeItem.m_ParentFolder Is EgtFolder Then
+ Dim CurrParentFolder As EgtFolder = DirectCast(m_SelTreeItem.m_ParentFolder, EgtFolder)
+ CurrParentFolder.SetIsSelected(True, False)
+ End If
+ m_sSelPath = DirectCast(m_SelTreeItem, EgtFolder).sFullName
+ NotifyPropertyChanged(NameOf(sSelPath))
End If
End Sub
-#End Region 'Command GoBack
+
+#End Region 'GoBack
#Region "Command Cancel"
+
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdCancel Is Nothing Then
@@ -490,9 +506,11 @@ Public Class EgtManageFileDialogVM
Public Sub Cancel()
RaiseEvent m_CloseWindow(DialogResult.Cancel)
End Sub
+
#End Region 'Command Cancel
-#Region "Command DoubleClick"
+#Region "DoubleClick"
+
Public ReadOnly Property DoubleClick_Command As ICommand
Get
If m_cmdDoubleClick Is Nothing Then
@@ -501,7 +519,18 @@ Public Class EgtManageFileDialogVM
Return m_cmdDoubleClick
End Get
End Property
-#End Region 'Command DoubleClick
+
+ Public Sub MouseDoubleClick()
+ m_ItemSelected.IsExpanded = True
+ If TypeOf m_ItemSelected Is EgtFolder Then
+ Dim CurrItemSelected As EgtFolder = DirectCast(m_ItemSelected, EgtFolder)
+ CurrItemSelected.SetIsSelected(True, True)
+ Else
+ m_ItemSelected.IsSelected = True
+ End If
+ End Sub
+
+#End Region 'DoubleClick
#End Region ' COMMANDS
@@ -534,7 +563,7 @@ Public Class EgtExstension
End Class
-Public Class EgtDirectory
+Public MustInherit Class EgtDirectory
Inherits VMBase
#Region "FIELDS & PROPERTIES"
@@ -542,87 +571,36 @@ Public Class EgtDirectory
Friend Shared refUpdateSelRoot As Action(Of EgtDirectory)
Friend Shared m_refEgtManageFileDialogVM As EgtManageFileDialogVM
+ Friend Shared Sub SetEgtManageFileDialogVM(EgtManageFileDialogVM As EgtManageFileDialogVM)
+ m_refEgtManageFileDialogVM = EgtManageFileDialogVM
+ End Sub
- Private m_bIsSelected As Boolean
- Public Overridable Property IsSelected As Boolean
- Get
- Return m_bIsSelected
- End Get
- Set(value As Boolean)
- m_bIsSelected = value
- refUpdateSelRoot(Me)
- End Set
- End Property
+ Protected m_bIsSelected As Boolean
+ Public MustOverride Property IsSelected As Boolean
- Private m_bIsExpanded As Boolean
+ Protected m_bIsExpanded As Boolean
Public Overridable Property IsExpanded As Boolean
- Get
- Return m_bIsExpanded
- End Get
- Set(value As Boolean)
- m_bIsExpanded = value
- End Set
- End Property
- Protected m_InfoDir As DirectoryInfo
- Public Property InfoDir As DirectoryInfo
- Get
- Return m_InfoDir
- End Get
- Set(value As DirectoryInfo)
- m_InfoDir = value
- End Set
- End Property
+ Public MustOverride ReadOnly Property sFullName As String
- Public ReadOnly Property sName As String
- Get
- Try
- Return If(Not IsNothing(m_InfoDir), m_InfoDir.Name, "")
- Catch ex As Exception
- Return ""
- End Try
- End Get
- End Property
+ Protected m_sName As String
+ Public MustOverride ReadOnly Property sName As String
- Public m_sIconSource As String
- Public Property sIconSource As String
+ Protected m_sIconSource As String
+ Public Overridable ReadOnly Property sIconSource As String
Get
Return m_sIconSource
End Get
- Set(value As String)
- m_sIconSource = value
- End Set
End Property
- Public ReadOnly Property sTypeItem As String
- Get
- Try
- Return If(Not IsNothing(m_InfoDir), m_InfoDir.Extension, "")
- Catch ex As Exception
- Return ""
- End Try
- End Get
- End Property
+ Protected m_sTypeItem As String
+ Public MustOverride ReadOnly Property sTypeItem As String
- Public ReadOnly Property dLastModifyDate As Date
- Get
- Try
- Return If(Not IsNothing(m_InfoDir), m_InfoDir.LastAccessTime.ToString("dd/MM/yyyy HH:mm:ss"), Date.UtcNow.ToString("dd/MM/yyyy HH:mm:ss"))
- Catch ex As Exception
- Return Date.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")
- End Try
- End Get
- End Property
+ Protected m_ghTypeItem As String
+ Public Overridable ReadOnly Property ghTypeItem As String
- Public ReadOnly Property sDimension As String
- Get
- Try
- Return If(Not IsNothing(m_InfoDir), "", "")
- Catch ex As Exception
- Return ""
- End Try
- End Get
- End Property
+ Protected m_dtLastModifyDate As Date
+ Public MustOverride ReadOnly Property sLastModifyDate As String
Public m_ParentFolder As EgtFolder
Public Property ParentFolder As EgtFolder
@@ -634,28 +612,6 @@ Public Class EgtDirectory
End Set
End Property
- Public m_ItemSelected As EgtDirectory
- Public Property ItemSelected As EgtDirectory
- Get
- Return m_ItemSelected
- End Get
- Set(value As EgtDirectory)
- m_ItemSelected = value
-
- Dim Item As EgtItem = TryCast(m_ItemSelected, EgtItem)
- If Not IsNothing(Item) Then
- m_refEgtManageFileDialogVM.sSaveFileName = Item.sName
- m_refEgtManageFileDialogVM.sFileNameMsg = m_refEgtManageFileDialogVM.FileName_Msg
- Else
- Dim Folder As EgtFolder = TryCast(m_ItemSelected, EgtFolder)
- If Not IsNothing(Folder) Then
- m_refEgtManageFileDialogVM.sSaveFileName = Folder.sName
- m_refEgtManageFileDialogVM.sFileNameMsg = m_refEgtManageFileDialogVM.FolderName_Msg
- End If
- End If
- End Set
- End Property
-
#End Region ' FIELDS & PROPERTIES
End Class
@@ -665,11 +621,16 @@ Public Class EgtFolder
#Region "FIELDS & PROPERTIES"
- Public m_ItemList_View As CollectionView = Nothing
+ Private m_ItemList_View As CollectionView = Nothing
+ Private m_TreeItemList_ViewSource As CollectionViewSource = Nothing
+ Private m_TreeItemList_View As CollectionView = Nothing
+ Public ReadOnly Property TreeItemList_View As CollectionView
+ Get
+ Return m_TreeItemList_View
+ End Get
+ End Property
- Friend Sub SetEgtManageFileDialogVM(EgtManageFileDialogVM As EgtManageFileDialogVM)
- m_refEgtManageFileDialogVM = EgtManageFileDialogVM
- End Sub
+ Private m_DirectoryInfo As DirectoryInfo
Private m_FolderList As New ObservableCollection(Of EgtDirectory)
Public Property FolderList As ObservableCollection(Of EgtDirectory)
@@ -681,37 +642,30 @@ Public Class EgtFolder
End Set
End Property
- Private m_sName As String
- Public Overloads Property sName As String
+ Public Overrides ReadOnly Property sFullName As String
Get
- Return m_sName
+ Return m_DirectoryInfo.FullName
End Get
- Set(value As String)
- m_sName = value
- End Set
End Property
- Private m_sTypeItem As String
- Public Overloads Property sTypeItem As String
+ Public Overrides ReadOnly Property sName As String
Get
- Return m_sTypeItem
+ Return m_DirectoryInfo.Name
End Get
- Set(value As String)
- m_sTypeItem = value
- End Set
End Property
- Private m_dLastModifyDate As Date
- Public Overloads Property dLastModifyDate As String
+ Public Overrides ReadOnly Property sTypeItem As String
Get
- Return m_dLastModifyDate
+ Return EgtMsg(15064)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property sLastModifyDate As String
+ Get
+ Return m_DirectoryInfo.LastWriteTime.ToString("dd/MM/yyyy HH:mm:ss")
End Get
- Set(value As String)
- m_dLastModifyDate = value
- End Set
End Property
- Private m_bIsExpanded As Boolean
Public Overrides Property IsExpanded As Boolean
Get
Return m_bIsExpanded
@@ -719,52 +673,69 @@ Public Class EgtFolder
Set(value As Boolean)
m_bIsExpanded = value
NotifyPropertyChanged(NameOf(IsExpanded))
- SetFolderList()
+ If m_bIsExpanded Then
+ SetFolderList()
+ End If
End Set
End Property
- Private m_bIsSelected As Boolean
Public Overrides Property IsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
m_bIsSelected = value
- refUpdateSelRoot(Me)
- m_refEgtManageFileDialogVM.sUrl_Msg = m_InfoDir.FullName
- If m_bIsSelected = True Then
+ m_refEgtManageFileDialogVM.sSelPath = m_DirectoryInfo.FullName
+ If m_bIsSelected Then
SetFolderList()
+ refUpdateSelRoot(Me)
+ NotifyPropertyChanged(NameOf(IsSelected))
End If
End Set
End Property
+ Friend Sub SetIsSelected(value As Boolean, bRefreshList As Boolean)
+ Dim sSelListItemPath As String = ""
+ If Not IsNothing(m_refEgtManageFileDialogVM.SelTreeItem) Then
+ sSelListItemPath = m_refEgtManageFileDialogVM.SelTreeItem.sFullName
+ End If
+ m_bIsSelected = value
+ m_refEgtManageFileDialogVM.sSelPath = m_DirectoryInfo.FullName
+ If m_bIsSelected Then
+ If bRefreshList Then SetFolderList()
+ refUpdateSelRoot(Me)
+ End If
+ If Not IsNothing(sSelListItemPath) Then
+ Dim SelFolderItem As EgtDirectory = m_FolderList.FirstOrDefault(Function(x) x.sFullName = sSelListItemPath)
+ If Not IsNothing(SelFolderItem) Then
+ m_refEgtManageFileDialogVM.SetItemSelected(SelFolderItem)
+ End If
+ End If
+ NotifyPropertyChanged(NameOf(IsSelected))
+ End Sub
#End Region ' FIELDS & PROPERTIES
#Region "CONTRUCTORS"
- Sub New(InfoDir As DirectoryInfo, Folder As EgtDirectory, EgtManageFileDialogVM As EgtManageFileDialogVM)
+ Sub New()
+ End Sub
- SetEgtManageFileDialogVM(EgtManageFileDialogVM)
-
- m_InfoDir = InfoDir
- m_sName = InfoDir.Name
- m_dLastModifyDate = InfoDir.LastWriteTime.ToString("dd/MM/yyyy HH:mm:ss")
- If InfoDir.Extension <> "" AndAlso InfoDir.Attributes <> FileAttributes.Directory AndAlso InfoDir.Attributes = FileAttributes.ReadOnly Then
- m_sTypeItem = "File " & InfoDir.Extension.ToUpper()
- m_sIconSource = "\Resources\EgtDialog\New.png"
- Else
- m_sTypeItem = m_refEgtManageFileDialogVM.Folder_Msg
- m_sIconSource = "\Resources\EgtDialog\Folder.png"
+ Sub New(DirectoryInfo As DirectoryInfo, Parent As EgtDirectory, Optional IconSource As String = "\Resources\EgtDialog\Folder.png")
+ m_DirectoryInfo = DirectoryInfo
+ m_sIconSource = IconSource
+ If DirectoryInfo.EnumerateDirectories.Count > 0 Then
+ m_FolderList.Add(New EgtFolder())
End If
- m_FolderList.Add(New EgtDirectory())
- m_ParentFolder = Folder
- m_ItemSelected = New EgtDirectory()
+ m_ParentFolder = Parent
m_ItemList_View = CollectionViewSource.GetDefaultView(m_FolderList)
m_ItemList_View.Filter = AddressOf ItemFilter
+ m_TreeItemList_ViewSource = New CollectionViewSource() With {.Source = m_FolderList}
+ m_TreeItemList_View = m_TreeItemList_ViewSource.View
+ m_TreeItemList_View.Filter = AddressOf TreeItemListFilter
NotifyPropertyChanged(NameOf(sName))
- NotifyPropertyChanged(NameOf(dLastModifyDate))
+ NotifyPropertyChanged(NameOf(sLastModifyDate))
NotifyPropertyChanged(NameOf(sTypeItem))
NotifyPropertyChanged(NameOf(sIconSource))
NotifyPropertyChanged(NameOf(FolderList))
@@ -775,18 +746,19 @@ Public Class EgtFolder
#Region "METHODS"
+ Private Function TreeItemListFilter(CurrItem As Object) As Boolean
+ Return TypeOf CurrItem Is EgtFolder
+ End Function
+
Private Function ItemFilter(Item As Object) As Boolean
Dim CurrItem As EgtItem = TryCast(Item, EgtItem)
- Dim MyChar() As Char = {"F", "i", "l", "e", " "}
-
- If Not IsNothing(CurrItem) AndAlso Not IsNothing(m_refEgtManageFileDialogVM.SelExstension.m_sExstension) Then
- If CurrItem.sTypeItem.Trim(MyChar).ToLower() = m_refEgtManageFileDialogVM.SelExstension.m_sExstension.TrimStart("*") Then
+ If Not IsNothing(CurrItem) AndAlso Not IsNothing(m_refEgtManageFileDialogVM.SelFilter.m_sExstension) Then
+ If CurrItem.sTypeItem = m_refEgtManageFileDialogVM.SelFilter.m_sExstension.TrimStart("*") Then
Return True
Else
Return False
End If
End If
-
Return True
End Function
@@ -794,8 +766,8 @@ Public Class EgtFolder
Dim DirectoryList() As DirectoryInfo
Dim FileList() As FileInfo
Try
- DirectoryList = m_InfoDir.GetDirectories().Where(Function(file) (file.Attributes And FileAttributes.Hidden And file.Name <> m_refEgtManageFileDialogVM.DataFolder_Msg) = 0).ToArray()
- FileList = m_InfoDir.GetFiles().Where(Function(file) (file.Attributes And FileAttributes.Hidden) = 0).ToArray()
+ DirectoryList = m_DirectoryInfo.GetDirectories().Where(Function(file) (file.Attributes And FileAttributes.Hidden And file.Name <> m_refEgtManageFileDialogVM.DataFolder_Msg) = 0).ToArray()
+ FileList = m_DirectoryInfo.GetFiles().Where(Function(file) (file.Attributes And FileAttributes.Hidden) = 0).ToArray()
Catch ex As Exception
DirectoryList = Nothing
FileList = Nothing
@@ -803,19 +775,14 @@ Public Class EgtFolder
m_FolderList.Clear()
If Not IsNothing(DirectoryList) AndAlso m_FolderList.Count = 0 Then
For Each subDir As DirectoryInfo In DirectoryList
- Dim directory As New EgtFolder(subDir, Me, m_refEgtManageFileDialogVM)
+ Dim directory As New EgtFolder(subDir, Me)
m_FolderList.Add(directory)
Next
End If
If Not IsNothing(FileList) Then
For Each files As FileInfo In FileList
Dim file As New EgtItem(files)
- Dim MyChar() As Char = {"F", "i", "l", "e", " "}
- If file.sTypeItem.Trim(MyChar).ToLower() = m_refEgtManageFileDialogVM.SelExstension.sExstension.TrimStart("*") Then
- m_FolderList.Add(file)
- Else
- m_FolderList.Add(file)
- End If
+ m_FolderList.Add(file)
Next
End If
End Sub
@@ -829,43 +796,55 @@ Public Class EgtItem
#Region "FIELDS & PROPERTIES"
- Private m_sName As String
- Public Overloads Property sName As String
+ Private m_FileInfo As FileInfo
+
+ Public Overrides ReadOnly Property sFullName As String
Get
- Return m_sName
+ Return m_FileInfo.FullName
End Get
- Set(value As String)
- m_sName = value
- End Set
End Property
- Private m_sTypeItem As String
- Public Overloads Property sTypeItem As String
+ Public Overrides ReadOnly Property sName As String
Get
- Return m_sTypeItem
+ Return m_FileInfo.Name
End Get
- Set(value As String)
- m_sTypeItem = value
- End Set
End Property
- Private m_sDimension As String
- Public Overloads Property sDimension As String
+ Public Overrides ReadOnly Property sTypeItem As String
Get
- Return m_sDimension
+ If Not IsNothing(m_FileInfo) AndAlso Not IsNothing(m_FileInfo.Extension) AndAlso Not String.IsNullOrWhiteSpace(m_FileInfo.Extension) Then
+ Return m_FileInfo.Extension
+ Else
+ Return ""
+ End If
End Get
- Set(value As String)
- m_sDimension = value
- End Set
End Property
- Private m_dLastModifyDate As Date
- Public Overloads Property dLastModifyDate As String
+ Public Overrides ReadOnly Property ghTypeItem As String
Get
- Return m_dLastModifyDate
+ Return If(Not String.IsNullOrWhiteSpace(sTypeItem), "File " & sTypeItem.ToUpper(), "")
End Get
- Set(value As String)
- m_dLastModifyDate = value
+ End Property
+
+ Public ReadOnly Property sDimension As String
+ Get
+ Return If(m_FileInfo.Length / 1024 / 1024 > 1, String.Format("{0:#,##0.00}", m_FileInfo.Length / 1024 / 1024) & " Mb", String.Format("{0:#,##0.00}", m_FileInfo.Length / 1024) & " Kb")
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property sLastModifyDate As String
+ Get
+ Return m_FileInfo.LastWriteTime.ToString("dd/MM/yyyy HH:mm:ss")
+ End Get
+ End Property
+
+ Public Overrides Property IsSelected As Boolean
+ Get
+ Return m_bIsSelected
+ End Get
+ Set(value As Boolean)
+ m_bIsSelected = value
+ refUpdateSelRoot(Me)
End Set
End Property
@@ -873,21 +852,12 @@ Public Class EgtItem
#Region "CONTRUCTORS"
- Sub New(InfoDir As FileInfo)
-
- m_sName = InfoDir.Name
- m_sDimension = String.Format("{0:#,##0.00}", InfoDir.Length / 1024) & " Kb"
- m_dLastModifyDate = InfoDir.LastWriteTime.ToString("dd/MM/yyyy HH:mm:ss")
- If InfoDir.Extension <> "" Then
- m_sTypeItem = "File " & InfoDir.Extension.ToUpper()
- m_sIconSource = "\Resources\EgtDialog\New.png"
- Else
- m_sTypeItem = ""
- End If
-
+ Sub New(FileInfo As FileInfo)
+ m_FileInfo = FileInfo
+ m_sIconSource = "\Resources\EgtDialog\New.png"
NotifyPropertyChanged(NameOf(sName))
NotifyPropertyChanged(NameOf(sDimension))
- NotifyPropertyChanged(NameOf(dLastModifyDate))
+ NotifyPropertyChanged(NameOf(sLastModifyDate))
NotifyPropertyChanged(NameOf(sTypeItem))
NotifyPropertyChanged(NameOf(sIconSource))
End Sub
diff --git a/Icarus/Utility/Dictionary.xaml b/Icarus/Utility/Dictionary.xaml
index d10f6d0..cb4257e 100644
--- a/Icarus/Utility/Dictionary.xaml
+++ b/Icarus/Utility/Dictionary.xaml
@@ -4704,6 +4704,11 @@
-->
+
+
+