153 lines
4.9 KiB
VB.net
153 lines
4.9 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib
|
|
Imports System.IO
|
|
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
|
|
Public Enum MODE_LAUNCHER
|
|
LastProject
|
|
NewProject
|
|
OpenFolder
|
|
ShowWindow
|
|
SelectedProject
|
|
End Enum
|
|
|
|
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)
|
|
|
|
Private m_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
|
|
Public ReadOnly Property SelPath As String
|
|
Get
|
|
Return m_SelPath
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub New(Owner As Window)
|
|
Me.Owner = Owner
|
|
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
|
|
Dim ItemFile As String = String.Empty
|
|
'carico la liste dei file recenti
|
|
Dim sFileName As String = String.Empty
|
|
For Each ItemFile In m_MainWindow.m_CurrentProjectPageUC.m_MruFiles.FileNames
|
|
sFileName = ItemFile.Replace("__", "_")
|
|
If Not String.IsNullOrEmpty(sFileName) Then
|
|
m_RecentFileList.Add(New FileNameLsBxItem(sFileName, File.GetLastAccessTime(sFileName)))
|
|
m_RecentFileList.Add(New FileNameLsBxItem(sFileName, File.GetLastAccessTime(sFileName)))
|
|
Else
|
|
m_MainWindow.m_CurrentProjectPageUC.m_MruFiles.Remove(ItemFile)
|
|
End If
|
|
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 = EgtMsg(91010) ' Seleziona modalità di avvio
|
|
FileName.Text = EgtMsg(91011) ' Progetti recenti
|
|
DataFile.Text = EgtMsg(91012) ' Ultima apertura
|
|
LastProject.ToolTip = EgtMsg(91013)
|
|
NewProject.ToolTip = EgtMsg(91014)
|
|
OpenFolder.ToolTip = EgtMsg(91015)
|
|
End Sub
|
|
|
|
' lancio l'apertura della pagina dei progetti
|
|
Private Sub OpenFolder_Click(sender As Object, e As RoutedEventArgs) Handles OpenFolder.Click
|
|
m_CurrSelection = MODE_LAUNCHER.OpenFolder
|
|
EgtZoom(ZM.ALL)
|
|
Me.Close()
|
|
End Sub
|
|
|
|
' creo un progetto nuovo
|
|
Private Sub NewProject_Click(sender As Object, e As RoutedEventArgs) Handles NewProject.Click
|
|
m_CurrSelection = MODE_LAUNCHER.NewProject
|
|
EgtZoom(ZM.ALL)
|
|
Me.Close()
|
|
End Sub
|
|
|
|
' Ultimo progetto
|
|
Private Sub LastProject_Click(sender As Object, e As RoutedEventArgs) Handles LastProject.Click
|
|
m_CurrSelection = MODE_LAUNCHER.LastProject
|
|
EgtZoom(ZM.ALL)
|
|
Me.Close()
|
|
End Sub
|
|
|
|
' quando viene rilasciato il mouse
|
|
Private Sub SelectProject_MouseUp(sender As Object, e As RoutedEventArgs) Handles FilesLsBx.MouseDoubleClick, FilesLsBx.TouchUp
|
|
' recupero il nome selezionato
|
|
m_SelPath = FilesLsBx.SelectedItem.Name
|
|
m_CurrSelection = MODE_LAUNCHER.SelectedProject
|
|
EgtZoom(ZM.ALL)
|
|
Me.Close()
|
|
End Sub
|
|
|
|
End Class
|