TPS1100-Convert/DialogPripravaKartice.vb

93 lines
3.5 KiB
VB.net
Raw Normal View History

2024-07-17 22:30:32 +02:00
Imports System.Windows.Forms
Public Class DialogPripravaKartice
Enum FormatType
Quick = 0
Normal = 1
End Enum
Enum Capacity
DefaultCapcity = 0
End Enum
Declare Function SHFormatDrive Lib "shell32" (ByVal hwnd As Int32, ByVal sDriveToFormat As String, ByVal s As Capacity, ByVal formattype As FormatType) As Int32
Private Sub DialogPripravaKartice_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each drive In IO.DriveInfo.GetDrives
'get all removable and fixed drives
If drive.DriveType = IO.DriveType.Removable Then
'add all found drives into the combobox
ComboBox1.Items.Add(drive)
End If
Next
End Sub
' Funkcija za pripravo PC-kartice/delovne mape
Private Sub PripravaKartice()
Dim delovnaMapa = My.Application.Info.DirectoryPath.ToString
Dim karticaMapa = ComboBox1.Text
Dim fileUvozCode = delovnaMapa + "\Virtualna Kartica\CODE\TPS1100.crf"
Dim fileIzvozCode = karticaMapa + "CODE\TPS1100.crf"
Dim fileUvozGeoid = delovnaMapa + "\Virtualna Kartica\DATA\GPS\GEOID\SLOV2016.GEM"
Dim fileIzvozGeoid = karticaMapa + "DATA\GPS\GEOID\SLOV2016.GEM"
Dim fileUvozTps = delovnaMapa + "\Virtualna Kartica\TPS\CONF\1102_BB.PAR"
Dim fileIzvozTps = karticaMapa + "TPS\CONF\1102_BB.PAR"
Dim fileUvozGpsGsi = delovnaMapa + "\Virtualna Kartica\CONVERT\GPS-GSI.FRT"
Dim fileIzvozGpsGsi = karticaMapa + "CONVERT\GPS-GSI.FRT"
Dim fileUvozGpsKoo = delovnaMapa + "\Virtualna Kartica\CONVERT\GPS-KOO.FRT"
Dim fileIzvozGpsKoo = karticaMapa + "CONVERT\GPS-KOO.FRT"
Dim fileUvozGpsPor = delovnaMapa + "\Virtualna Kartica\CONVERT\POROCILO.FRT"
Dim fileIzvozGpsPor = karticaMapa + "CONVERT\POROCILO.FRT"
' Kopiraj datoteke na kartico
If My.Computer.FileSystem.FileExists(fileUvozCode) Then
My.Computer.FileSystem.CopyFile(fileUvozCode, fileIzvozCode, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGeoid) Then
My.Computer.FileSystem.CopyFile(fileUvozGeoid, fileIzvozGeoid, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozTps) Then
My.Computer.FileSystem.CopyFile(fileUvozTps, fileIzvozTps, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGpsGsi) Then
My.Computer.FileSystem.CopyFile(fileUvozGpsGsi, fileIzvozGpsGsi, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGpsKoo) Then
My.Computer.FileSystem.CopyFile(fileUvozGpsKoo, fileIzvozGpsKoo, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGpsPor) Then
My.Computer.FileSystem.CopyFile(fileUvozGpsPor, fileIzvozGpsPor, True)
End If
MessageBox.Show("Kartica pripravljena...
Naloženo:
- knjižnica z kodami TPS1100
- Nastavitve za instrument TPS110x
- Formati za izvoz podatkov na GPS500
- Geoid SLOV2016.GEM za uporabo na GPS500")
End Sub
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Show the Format dialog
SHFormatDrive(Me.Handle.ToInt32, ComboBox1.Text, CType(2, Capacity), FormatType.Normal)
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
PripravaKartice()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class