diff --git a/LicenceBox/LicenceBoxV.xaml b/LicenceBox/LicenceBoxV.xaml
new file mode 100644
index 0000000..12385b1
--- /dev/null
+++ b/LicenceBox/LicenceBoxV.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LicenceBox/LicenceBoxV.xaml.vb b/LicenceBox/LicenceBoxV.xaml.vb
new file mode 100644
index 0000000..3f423c7
--- /dev/null
+++ b/LicenceBox/LicenceBoxV.xaml.vb
@@ -0,0 +1,45 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class LicenceBoxV
+
+ Private WithEvents m_LicenceBoxVM As LicenceBoxVM
+
+ Sub New(Owner As Window, LicenceBoxVM As LicenceBoxVM)
+ MyBase.New()
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = LicenceBoxVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_LicenceBoxVM = LicenceBoxVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_LicenceBoxVM.m_CloseWindow
+ Me.DataContext = Nothing
+ Me.DialogResult = bDialogResult
+ End Sub
+
+ 'Private Sub LicenceBoxV_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
+ ' Me.Owner = Application.Current.MainWindow
+
+ ' InfoLbl.Text = CType(Map.refSearchLicencePageVM.Row.Item, Licence).LicFile
+
+ ' '' Inizializzo liste opzioni
+ ' 'LoadOptions(1, m_Option1)
+ ' 'LoadOptions(2, m_Option2)
+
+ ' DownloadBtn.Content = "Download"
+ ' ExitBtn.Content = "Close"
+ 'End Sub
+
+ Private Sub DownloadBtn_Click(sender As Object, e As RoutedEventArgs) Handles DownloadBtn.Click
+ Dim lines As String() = InfoLbl.Text.Split(New String() {Environment.NewLine},
+ StringSplitOptions.None)
+ IO.File.WriteAllLines(IO.Path.ChangeExtension(CType(Map.refSearchLicencePageVM.Row.Item, Licence).File, ".lic"),
+ lines, Text.Encoding.UTF8)
+ MessageBox.Show("Licenza scaricata correttamente")
+ End Sub
+
+End Class
+
diff --git a/LicenceBox/LicenceBoxVM.vb b/LicenceBox/LicenceBoxVM.vb
new file mode 100644
index 0000000..c124076
--- /dev/null
+++ b/LicenceBox/LicenceBoxVM.vb
@@ -0,0 +1,117 @@
+Imports System.Collections.ObjectModel
+Imports EgtWPFLib5
+
+Public Class LicenceBoxVM
+ Inherits VMBase
+
+ Private m_LicFileContentText As String
+ Public Property LicFileContentText As String
+ Get
+ Return m_LicFileContentText
+ End Get
+ Set(value As String)
+ m_LicFileContentText = value
+ End Set
+ End Property
+
+ Private m_Option1 As New ObservableCollection(Of KeyOption)
+ Public ReadOnly Property Option1 As ObservableCollection(Of KeyOption)
+ Get
+ Return m_Option1
+ End Get
+ End Property
+
+ Private m_Option2 As New ObservableCollection(Of KeyOption)
+ Public Event m_CloseWindow(bDialogResult As Boolean)
+
+ Public ReadOnly Property Option2 As ObservableCollection(Of KeyOption)
+ Get
+ Return m_Option2
+ End Get
+ End Property
+
+ Public ReadOnly Property Option1Msg As String
+ Get
+ Return "Option 1"
+ End Get
+ End Property
+
+ Public ReadOnly Property Option2Msg As String
+ Get
+ Return "Option 2"
+ End Get
+ End Property
+
+ Public ReadOnly Property DownloadMsg As String
+ Get
+ Return "Download"
+ End Get
+ End Property
+
+ Public ReadOnly Property ExitMsg As String
+ Get
+ Return "Close"
+ End Get
+ End Property
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Imposto riferimento nella mappa
+ Map.SetRefLicenceBoxVM(Me)
+
+ InitLicenceBox()
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Sub InitLicenceBox()
+ LicFileContentText = CType(Map.refSearchLicencePageVM.Row.Item, Licence).LicFile
+
+ ' Inizializzo liste opzioni
+ LoadOptions(1, m_Option1)
+ LoadOptions(2, m_Option2)
+ End Sub
+
+#End Region ' METHODS
+
+ Private Sub LoadOptions(nIndex As Integer, OptionList As ObservableCollection(Of KeyOption))
+ Dim SelectedLicence = CType(Map.refSearchLicencePageVM.Row.Item, Licence)
+ 'Cerco ProductName associato a ProductID
+ Dim Query As String = "SELECT " & DB_PRODUCTNAME & " FROM " & DB_PRODUCT & " WHERE " & DB_PRODUCTID & " = " & SelectedLicence.ProductID
+ Dim ProductName = ManageDb.ExecuteStringQuery(Query, DB_PRODUCTNAME)(0)
+ ' Cancello opzioni
+ OptionList.Clear()
+ ' Carico opzioni
+ Dim OptionIndex As Integer = 1
+ Dim OptionName As String = String.Empty
+ GetMainPrivateProfileString(ProductName & " - Option" & nIndex, "Option" & OptionIndex, "", OptionName)
+ While Not String.IsNullOrWhiteSpace(OptionName)
+ OptionList.Add(New KeyOption(False, True, OptionName))
+ OptionIndex += 1
+ GetMainPrivateProfileString(ProductName & " - Option" & nIndex, "Option" & OptionIndex, "", OptionName)
+ End While
+ ' Se ho caricato delle opzioni
+ If OptionList.Count > 0 Then
+ ' Verifico se ci sono opzioni del prodotto
+ Dim ProductOption As Integer = If(nIndex = 1, SelectedLicence.Option1, SelectedLicence.Option2)
+ Dim nBinaryIndex As Integer = 1
+ For I = 0 To OptionList.Count - 1
+ If (ProductOption And nBinaryIndex) <> 0 Then
+ OptionList(I).IsChecked = True
+ OptionList(I).IsEnabled = True
+ End If
+ If nIndex = 2 Then
+ If (OptionList(I).Msg.Equals("XXX")) Then
+ OptionList(I).IsChecked = False
+ OptionList(I).IsEnabled = False
+ End If
+ End If
+ nBinaryIndex *= 2
+ Next
+ End If
+ End Sub
+
+End Class
diff --git a/LicenseManager.vbproj b/LicenseManager.vbproj
index c627f7c..aaa9c41 100644
--- a/LicenseManager.vbproj
+++ b/LicenseManager.vbproj
@@ -110,6 +110,7 @@
KeyPageV.xaml
+ MainMenuV.xaml
@@ -199,7 +200,7 @@
Dictionary.xaml
-
+ LicenceBoxV.xaml
@@ -368,7 +369,7 @@
MSBuild:CompileDesigner
-
+ DesignerMSBuild:Compile
diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb
index 79ba0f8..abdbdd2 100644
--- a/MainWindow/MainWindowM.vb
+++ b/MainWindow/MainWindowM.vb
@@ -154,8 +154,12 @@ Public Class MainWindowM
m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' Info su opzioni chiave
EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString())
- ' Semanca la licenza si esce
+ ' Se manca la licenza si esce
If Not bKey Then
+ ' Box di avviso chiave/licenza mancante
+ Dim sText As String = "Chiave o Licenza non presente." & vbCrLf & "Inserirla e riavviare il programma."
+ Dim sTitle As String = "Errore"
+ MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
End
End If
End Sub
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index f88eef7..5d5ab18 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -59,5 +59,5 @@ Imports System.Windows
' usando l'asterisco '*' come illustrato di seguito:
'
-
-
+
+
diff --git a/NewLicencePage/NewLicencePageVM.vb b/NewLicencePage/NewLicencePageVM.vb
index bc118db..a48ead0 100644
--- a/NewLicencePage/NewLicencePageVM.vb
+++ b/NewLicencePage/NewLicencePageVM.vb
@@ -381,7 +381,7 @@ Public Class NewLicencePageVM
' Verifico se ci sono opzioni del prodotto
Dim ProductOption As Integer = If(nIndex = 1, m_SelProduct.ProductOption1, m_SelProduct.ProductOption2)
Dim nBinaryIndex As Integer = 1
- For I = 0 To 15
+ For I = 0 To OptionList.Count - 1
If (ProductOption And nBinaryIndex) <> 0 Then
OptionList(I).IsChecked = True
OptionList(I).IsEnabled = False
@@ -486,7 +486,7 @@ Public Class NewLicencePageVM
Try
IO.File.WriteAllLines(fileName, StringFile, Text.Encoding.UTF8)
Catch ex As Exception
- MessageBox.Show("Errore nella scrittura del file dati per licenza", "KeyGenerator Error")
+ MessageBox.Show("Errore nella scrittura del file dati per licenza", "LicenceManager Error")
Return
End Try
@@ -503,7 +503,7 @@ Public Class NewLicencePageVM
' Errore nella generazione della licenza
If proc.ExitCode <> 0 Then
Dim sOut As String = "La Licenza non è stata generata correttamente (" & proc.ExitCode.ToString() & ")"
- MessageBox.Show(sOut, "LicenceManager")
+ MessageBox.Show(sOut, "KeyGenerator Error")
Return
Else
Try
@@ -529,7 +529,7 @@ Public Class NewLicencePageVM
ManageDb.ExecuteQuery(Query)
Catch ex As Exception
- MessageBox.Show("Errore nella scrittura del file dati per licenza", "LicenceManager Error")
+ MessageBox.Show("Errore nell'aggiunta della licenza al DB", "LicenceManager Error")
Return
End Try
diff --git a/SearchLicencePage/SearchLicencePageV.xaml.vb b/SearchLicencePage/SearchLicencePageV.xaml.vb
index 62657df..dce598f 100644
--- a/SearchLicencePage/SearchLicencePageV.xaml.vb
+++ b/SearchLicencePage/SearchLicencePageV.xaml.vb
@@ -5,9 +5,15 @@
Private Sub Row_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
Map.refSearchLicencePageVM.Row = CType(ItemsControl.ContainerFromElement(CType(sender, DataGrid), CType(e.OriginalSource, DependencyObject)), DataGridRow)
If (Not IsNothing(Map.refSearchLicencePageVM.Row)) AndAlso (Not IsNothing(CType(Map.refSearchLicencePageVM.Row.Item, Licence).LicFile)) Then
- Dim LicenceBox As New LicenceBoxV
- LicenceBox.Owner = Application.Current.MainWindow
- LicenceBox.ShowDialog()
+ 'Dim LicenceBox As New LicenceBoxV
+ 'LicenceBox.Owner = Application.Current.MainWindow
+ 'LicenceBox.ShowDialog()
+
+ Dim LicBox As New LicenceBoxV(Application.Current.MainWindow, New LicenceBoxVM())
+ LicBox.Height = 700
+ LicBox.Width = 1100
+ LicBox.HorizontalAlignment = HorizontalAlignment.Center
+ LicBox.ShowDialog()
End If
End Sub
diff --git a/SearchLicencePage/SearchLicencePageVM.vb b/SearchLicencePage/SearchLicencePageVM.vb
index d8ac829..bb32f09 100644
--- a/SearchLicencePage/SearchLicencePageVM.vb
+++ b/SearchLicencePage/SearchLicencePageVM.vb
@@ -412,7 +412,7 @@ Public Class SearchLicencePageVM
' Verifico se ci sono opzioni del prodotto
Dim ProductOption As Integer = If(nIndex = 1, m_SelProduct.ProductOption1, m_SelProduct.ProductOption2)
Dim nBinaryIndex As Integer = 1
- For I = 0 To 15
+ For I = 0 To OptionList.Count - 1
If (ProductOption And nBinaryIndex) <> 0 Then
OptionList(I).IsChecked = True
OptionList(I).IsEnabled = False
@@ -538,7 +538,7 @@ Public Class SearchLicencePageVM
End If
If Not String.IsNullOrWhiteSpace(LockID) Then
EvalWhere(bFirstWhere, Query)
- Query &= DB_LOCKID & " LIKE '%" & LockID & "%' "
+ Query &= DB_LICENCE & "." & DB_LOCKID & " LIKE '%" & LockID & "%' "
End If
If Not String.IsNullOrWhiteSpace(File) Then
EvalWhere(bFirstWhere, Query)
@@ -546,7 +546,7 @@ Public Class SearchLicencePageVM
End If
If Not IsNothing(LicenseDate) Then
EvalWhere(bFirstWhere, Query)
- Query &= DB_DATE & " LIKE '%" & Format(LicenseDate, "yyyy-MM-dd") & "%' "
+ Query &= DB_LICENCE & "." & DB_DATE & " LIKE '%" & Format(LicenseDate, "yyyy-MM-dd") & "%' "
End If
If Not IsNothing(m_SelIsDongle) Then
If m_SelIsDongle <> 2 Then
diff --git a/UpdateLicencePage/UpdateLicencePageVM.vb b/UpdateLicencePage/UpdateLicencePageVM.vb
index a54ffe9..0254065 100644
--- a/UpdateLicencePage/UpdateLicencePageVM.vb
+++ b/UpdateLicencePage/UpdateLicencePageVM.vb
@@ -699,7 +699,7 @@ Public Class UpdateLicencePageVM
"'" & m_Note & "')"
Catch ex As Exception
- MessageBox.Show("Errore nella scrittura del file dati per licenza", "LicenceManager Error")
+ MessageBox.Show("Errore nella lettura dei dati per la scrittura su DB", "LicenceManager Error")
Return
End Try
End If
diff --git a/UpdateProductPage/UpdateProductPageVM.vb b/UpdateProductPage/UpdateProductPageVM.vb
index 790f5e1..4d89567 100644
--- a/UpdateProductPage/UpdateProductPageVM.vb
+++ b/UpdateProductPage/UpdateProductPageVM.vb
@@ -158,7 +158,7 @@ Public Class UpdateProductPageVM
' Verifico se ci sono opzioni del prodotto
Dim ProductOption As Integer = If(nIndex = 1, m_Product.ProductOption1, m_Product.ProductOption2)
Dim nBinaryIndex As Integer = 1
- For I = 0 To 15
+ For I = 0 To OptionList.Count - 1
If (ProductOption And nBinaryIndex) <> 0 Then
OptionList(I).IsChecked = True
OptionList(I).IsEnabled = True
diff --git a/Utility/DatePickerYears.xaml.vb b/Utility/DatePickerYears.xaml.vb
index 3a2ebe9..4c0f84d 100644
--- a/Utility/DatePickerYears.xaml.vb
+++ b/Utility/DatePickerYears.xaml.vb
@@ -15,10 +15,12 @@
Private Sub CustomDP_SelectedDateChanged(ByVal sender As Object,
ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles CustomDP.SelectedDateChanged
+ If IsNothing(SelectedDate) Then
+ SelectedDate = Date.Now
+ End If
SelectedDate = New Date(Year(CDate(CustomDP.SelectedDate)),
Month(CDate(CustomDP.SelectedDate)),
Day(CDate(CustomDP.SelectedDate)))
-
End Sub
Private Sub Plus1Y_Click(sender As Object, e As RoutedEventArgs) Handles Plus1Y.Click
diff --git a/Utility/LicenceBoxV.xaml b/Utility/LicenceBoxV.xaml
deleted file mode 100644
index 3bac15e..0000000
--- a/Utility/LicenceBoxV.xaml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Utility/LicenceBoxV.xaml.vb b/Utility/LicenceBoxV.xaml.vb
deleted file mode 100644
index bd67ca5..0000000
--- a/Utility/LicenceBoxV.xaml.vb
+++ /dev/null
@@ -1,21 +0,0 @@
-Imports EgtUILib
-
-Public Class LicenceBoxV
-
- Private Sub LicenceBoxV_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
- Me.Owner = Application.Current.MainWindow
-
- InfoLbl.Text = CType(Map.refSearchLicencePageVM.Row.Item, Licence).LicFile
- DownloadBtn.Content = "Download"
- ExitBtn.Content = "Close"
- End Sub
-
- Private Sub DownloadBtn_Click(sender As Object, e As RoutedEventArgs) Handles DownloadBtn.Click
- Dim lines As String() = InfoLbl.Text.Split(New String() {Environment.NewLine},
- StringSplitOptions.None)
- IO.File.WriteAllLines(IO.Path.ChangeExtension(CType(Map.refSearchLicencePageVM.Row.Item, Licence).File, ".lic"),
- lines, Text.Encoding.UTF8)
- MessageBox.Show("Licenza scaricata correttamente")
- End Sub
-End Class
-
diff --git a/Utility/Map.vb b/Utility/Map.vb
index cb23049..3e04237 100644
--- a/Utility/Map.vb
+++ b/Utility/Map.vb
@@ -21,6 +21,7 @@ Module Map
Private m_refUpdateProductPageVM As UpdateProductPageVM
Private m_refUpdateVersionPageVM As UpdateVersionPageVM
Private m_refUpdateResellerPageVM As UpdateResellerPageVM
+ Private m_refLicenceBoxVM As LicenceBoxVM
#Region "Get"
@@ -138,6 +139,12 @@ Module Map
End Get
End Property
+ Public ReadOnly Property refLicenceBoxVM As LicenceBoxVM
+ Get
+ Return m_refLicenceBoxVM
+ End Get
+ End Property
+
#End Region ' Get
@@ -233,6 +240,11 @@ Module Map
Return Not IsNothing(m_refUpdateResellerPageVM)
End Function
+ Friend Function SetRefLicenceBoxVM(LicenceBoxVM As LicenceBoxVM) As Boolean
+ m_refLicenceBoxVM = LicenceBoxVM
+ Return Not IsNothing(m_refLicenceBoxVM)
+ End Function
+
#End Region ' Set
#Region "Init"