84 lines
3.0 KiB
VB.net
84 lines
3.0 KiB
VB.net
Imports XCCLibrary
|
|
Public Class Settings
|
|
Public Shared filesFolder As String
|
|
Public Shared HLCtFolder As String
|
|
Public Shared exportFolder As String
|
|
Public Shared folderPaths As New Dictionary(Of String, String)
|
|
|
|
Public Shared SRName, SRPhone, SRMail As String
|
|
Private Shared appDataList As New List(Of String)
|
|
|
|
Public Shared Sub Init_Settings()
|
|
Dim appData As String() = System.IO.File.ReadAllLines(AppForm.appDataPath & "\SavedData.txt")
|
|
For i = 0 To appData.Length - 1
|
|
appDataList.Add(appData(i))
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub TextBox_Name_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Name.TextChanged
|
|
SRName = sender.Text
|
|
|
|
Update_AppData("Sales Representative: Name", SRName)
|
|
End Sub
|
|
|
|
Private Sub TextBox_Phone_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Phone.TextChanged
|
|
SRPhone = sender.Text
|
|
|
|
Update_AppData("Sales Representative: Phone number", SRPhone)
|
|
End Sub
|
|
|
|
Private Sub TextBox_Mail_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Mail.TextChanged
|
|
SRMail = sender.Text
|
|
|
|
Update_AppData("Sales Representative: Mail", SRMail)
|
|
End Sub
|
|
|
|
|
|
Private Sub Button_KB_Click(sender As Object, e As EventArgs) Handles Button_KB.Click
|
|
adminClass.updateDatabase() 'Update KB
|
|
End Sub
|
|
|
|
Private Sub Button_FilePath_Click(sender As Object, e As EventArgs) Handles Button_FilePath.Click
|
|
Dim ofd As FolderBrowserDialog = New FolderBrowserDialog
|
|
If ofd.ShowDialog() <> DialogResult.Cancel Then
|
|
Settings.exportFolder = ofd.SelectedPath
|
|
|
|
Update_AppData("Export Folder Path", ofd.SelectedPath)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button_Save_Click(sender As Object, e As EventArgs) Handles Button_Save.Click
|
|
System.IO.File.WriteAllLines(AppForm.appDataPath & "\SavedData.txt", appDataList.ToArray())
|
|
|
|
If SRName <> "" AndAlso SRPhone <> "" AndAlso SRMail <> "" AndAlso Settings.exportFolder <> "" Then
|
|
Main_Menu.Button_Order.Enabled = True
|
|
Main_Menu.Label_SettingsError.Visible = False
|
|
Else
|
|
Main_Menu.Button_Order.Enabled = False
|
|
Main_Menu.Label_SettingsError.Visible = True
|
|
End If
|
|
|
|
AppForm.fillMode = True
|
|
AppForm.Panel_Start.Controls.Clear()
|
|
Main_Menu.TopLevel = False
|
|
AppForm.Panel_Start.Controls.Add(Main_Menu)
|
|
Main_Menu.Show()
|
|
End Sub
|
|
|
|
Private Shared Sub Update_AppData(dataName As String, data As String)
|
|
Dim pathUpdated As Boolean = False
|
|
For i = 0 To appDataList.Count - 1
|
|
If appDataList(i) = dataName Then
|
|
appDataList(i + 1) = data
|
|
pathUpdated = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
If pathUpdated = False Then
|
|
appDataList.Add("")
|
|
appDataList.Add(dataName)
|
|
appDataList.Add(data)
|
|
End If
|
|
End Sub
|
|
End Class |