101 lines
3.8 KiB
VB.net
101 lines
3.8 KiB
VB.net
Public Class frmLizenzmanager
|
||
|
||
Private licenseKey_old As String
|
||
Private licenseManager As ClassLicenseManager = Nothing
|
||
|
||
Private Sub frmLizenzmanager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||
Me.licenseManager = New ClassLicenseManager("#DigitalData9731258!#", My.Settings.licensekey)
|
||
Me.txtKey.Text = My.Settings.licensekey
|
||
Me.licenseKey_old = Me.txtKey.Text
|
||
Me.txtmachineOriginal.Text = My.Computer.Name
|
||
Me.CheckLicenseKey()
|
||
End Sub
|
||
|
||
|
||
Private Sub CheckLicenseKey()
|
||
Me.txtCompany.Text = ""
|
||
Me.txtmachine.Text = ""
|
||
Me.lvLicense.Items.Clear()
|
||
|
||
If Not Me.txtKey.Text = "" Then
|
||
If Me.txtKey.Text = "DD MaxLicense" Or Me.txtKey.Text.ToUpper = "DDALLIN" Then
|
||
Me.txtCompany.Text = "Digital Data"
|
||
Me.txtmachine.Text = "None"
|
||
Else
|
||
Me.licenseManager.licenseString = Me.licenseManager.DecodeLicenseKey(Me.txtKey.Text)
|
||
Me.licenseManager.licenseStringArray = Me.licenseManager.SplitLicenseString(Me.licenseManager.licenseString)
|
||
Me.licenseManager.LoadLicenses()
|
||
|
||
Dim i As Integer = 0
|
||
|
||
If Me.licenseManager.Licenses.Licenses IsNot Nothing Then
|
||
Me.txtCompany.Text = Me.licenseManager.Licenses.Company
|
||
Me.txtmachine.Text = Me.licenseManager.Licenses.machine
|
||
Me.lvLicense.Items.Clear()
|
||
For Each license As ClassLicense In Me.licenseManager.Licenses.Licenses()
|
||
Dim expires As String = license.Expires.Date
|
||
Dim type As String = license.Type
|
||
Dim anzProf As String = license.Anz_Profile
|
||
If anzProf = 99 Then
|
||
anzProf = "Unlimited"
|
||
End If
|
||
|
||
'Date.TryParse(expires, license.Expires)
|
||
If Not expires = "" Then
|
||
Me.lvLicense.Items.Add(license.Modulename)
|
||
' MsgBox(license.Modulename)
|
||
Dim test = Me.lvLicense.Items.Item(i)
|
||
Me.lvLicense.Items(i).SubItems.Add(expires)
|
||
lvLicense.Items(i).SubItems.Add(type)
|
||
lvLicense.Items(i).SubItems.Add(anzProf)
|
||
i += 1
|
||
End If
|
||
Next
|
||
End If
|
||
End If
|
||
|
||
|
||
|
||
End If
|
||
End Sub
|
||
|
||
|
||
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
|
||
If Not Me.licenseKey_old = Me.txtKey.Text Then
|
||
Dim result As MsgBoxResult = MsgBox("Sind sie sicher, dass der Lizenzschl<68>ssel ge<67>ndert werden soll?", MsgBoxStyle.YesNo, "Lizenzschl<EFBFBD>ssel wurde ge<67>ndert")
|
||
If result = MsgBoxResult.Yes Then
|
||
My.Settings.licensekey = Me.txtKey.Text
|
||
My.Settings.Save()
|
||
End If
|
||
End If
|
||
|
||
|
||
If Not My.Settings.licensekey = "" Then
|
||
' alle vorhandenen Module laden
|
||
frmStart.LoadAllModules()
|
||
End If
|
||
|
||
Me.Close()
|
||
End Sub
|
||
|
||
|
||
Private Sub btnAbbrechen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbbrechen.Click
|
||
Me.txtKey.Text = ""
|
||
Me.txtCompany.Text = ""
|
||
Me.lvLicense.Items.Clear()
|
||
|
||
frmStart.ClearGroupBoxes()
|
||
|
||
If Not My.Settings.licensekey = "" Then
|
||
' alle vorhandenen Module laden
|
||
frmStart.LoadAllModules()
|
||
End If
|
||
|
||
Me.Close()
|
||
End Sub
|
||
|
||
|
||
Private Sub txtKey_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtKey.TextChanged
|
||
Me.CheckLicenseKey()
|
||
End Sub
|
||
End Class |