TPS1100-Convert/Form2.vb

219 lines
10 KiB
VB.net
Raw Permalink Normal View History

2024-06-19 21:00:35 +02:00
Imports System.Collections.Specialized.BitVector32
Imports System.IO
2024-06-07 00:11:48 +02:00
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Public Class Form2
2024-06-16 05:10:11 +02:00
2024-06-07 00:11:48 +02:00
Public DatotekaSpemembe As Boolean = False
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Activated
Form1.Hide()
2024-06-10 20:57:35 +02:00
RichTextBoxEdit.Clear()
2024-06-07 00:11:48 +02:00
' prepare StreamReader
2024-06-13 04:25:40 +02:00
Dim streamReader As StreamReader = New StreamReader(My.Settings.ZadnjaMapa + "\" + My.Settings.Datoteka)
2024-06-07 00:11:48 +02:00
Dim i As Integer = 0
' loop untill end of stream
Do Until streamReader.EndOfStream
' Beri vrstico po vrstico
Dim line As String = streamReader.ReadLine()
2024-06-10 20:57:35 +02:00
RichTextBoxEdit.AppendText(line + vbCrLf)
2024-06-07 00:11:48 +02:00
i = i + 1
Loop
2024-06-13 04:25:40 +02:00
ToolStripStatusLabel1.Text = "Prebrano: " + i.ToString + " | Datoteka: " + My.Settings.ZadnjaMapa + "\" + My.Settings.Datoteka
2024-06-07 00:11:48 +02:00
DatotekaSpemembe = False
2024-06-10 20:57:35 +02:00
BtnShraniF2.Enabled = False
2024-06-19 21:00:35 +02:00
ComBoxKoda.SelectedIndex = 0
2024-06-07 00:11:48 +02:00
streamReader.Close()
2024-06-10 20:57:35 +02:00
streamReader.Dispose()
2024-06-07 00:11:48 +02:00
End Sub
Private Sub Form2_Close(sender As Object, e As EventArgs) Handles MyBase.Closing
2024-06-10 20:57:35 +02:00
' If DatotekaSpemembe = True Then
' MessageBox.Show("Shranim spremembe?", "Podatki spremenjeni", MessageBoxButtons.YesNo)
' If MessageBoxButtons.YesNo = vbYes Then
' RichTextBoxEdit.SaveFile(My.Settings.ZadnjaMapa, RichTextBoxStreamType.PlainText)
' BtnShraniF2.Enabled = False
' DatotekaSpemembe = False
' End If
' End If
Form1.RichTextBox1.Clear()
Form1.streamLines = 0
Dim streamReader As StreamReader = New StreamReader(Form1.OpenFileDialog1.FileName)
Do Until streamReader.EndOfStream
Form1.RichTextBox1.AppendText(streamReader.ReadLine + vbCrLf)
Form1.streamLines = Form1.streamLines + 1
Loop
Form1.ToolStripProgressBar1.Maximum = Form1.streamLines
streamReader.Close()
streamReader.Dispose()
2024-06-07 00:11:48 +02:00
Form1.Show()
End Sub
2024-06-10 20:57:35 +02:00
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBoxEdit.TextChanged
2024-06-07 00:11:48 +02:00
ToolStripStatusLabel1.Text = "Spremenjeni podatki... datoteka je bila urejana."
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
End Sub
Private Sub BtnShraniF2_Click(sender As Object, e As EventArgs) Handles BtnShraniF2.Click
2024-06-10 20:57:35 +02:00
' SaveFileDialog2.FileName = My.Settings.ZadnjaMapa
' If SaveFileDialog2.ShowDialog = DialogResult.OK Then
2024-06-13 04:25:40 +02:00
RichTextBoxEdit.SaveFile(My.Settings.ZadnjaMapa + "\" + My.Settings.Datoteka, RichTextBoxStreamType.PlainText)
2024-06-10 20:57:35 +02:00
ToolStripStatusLabel1.Text = "Shranjeno: " + SaveFileDialog2.FileName.ToString
BtnShraniF2.Enabled = False
DatotekaSpemembe = False
' End If
2024-06-07 00:11:48 +02:00
End Sub
2024-06-16 05:10:11 +02:00
2024-06-07 00:11:48 +02:00
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
2024-06-19 21:00:35 +02:00
' 0 ---
' 1 Setup: Quick Set
' 2 Setup: Set Azimuth
' 3 Setup: Resection
' 4 Setup: Free Station
' 5 Setup: Ori. & Ht. Transfer
' 6 Measure: Orientation
' 7 Measure: Points
' 8 Data: User-Entered
' 9 Info: Station
' 10 Info: Temp. & Press.
2024-06-16 05:10:11 +02:00
Dim dataTekst As String = ""
2024-06-19 21:00:35 +02:00
If ComBoxKoda.SelectedIndex <= 0 Then
ElseIf ComBoxKoda.SelectedIndex = 1 Then ' Koda Setup: Quick Set
dataTekst = "*410000+" + My.Settings.KodaQuickSet.PadLeft(16, "0") + " "
2024-06-16 05:10:11 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 2 Then ' Koda Setup: Set Azimut
dataTekst = "*410000+" + My.Settings.KodaSetAzi.PadLeft(16, "0") + " "
2024-06-16 05:10:11 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 3 Then ' Koda Setup: Resection
dataTekst = "*410000+" + My.Settings.KodaResection.PadLeft(16, "0") + " "
2024-06-16 05:10:11 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 4 Then ' Koda Setup: Free Station
dataTekst = "*410000+" + My.Settings.KodaFreeStation.PadLeft(16, "0") + " "
2024-06-07 00:11:48 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 5 Then ' Koda Setup: Ori. & Ht. Transfer
dataTekst = "*410000+" + My.Settings.KodaOriHtTrans.PadLeft(16, "0") + " "
2024-06-07 00:11:48 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 6 Then ' Koda Orientacija
dataTekst = "*410000+" + My.Settings.KodaMeasOri.PadLeft(16, "0") + " "
2024-06-07 00:11:48 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 7 Then ' Koda Meritve
dataTekst = "*410000+" + My.Settings.KodaMeas.PadLeft(16, "0") + " "
2024-06-07 00:11:48 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 8 Then ' Koda User-Entered/Import
dataTekst = "*410000+" + My.Settings.KodaUserImport.PadLeft(16, "0") + " "
2024-06-07 00:11:48 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 9 Then ' Koda Stojišče
2024-06-16 05:10:11 +02:00
Dim kodaStoj As String = ToolStripTextBox1.Text.PadLeft(16, "0")
Dim kodaStojVis As Double = ToolStripTextBox2.Text.Replace(",", ".") * 1000
dataTekst = "*410000+" + My.Settings.KodaStojisce.PadLeft(16, "0") + " 71....+" + kodaStoj.PadLeft(16, "0") + " 72....+" + Format(kodaStojVis, "0000000000000000").ToString + " "
2024-06-10 20:57:35 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 10 Then ' Koda Podatki Temp./Pritisk
2024-06-16 05:10:11 +02:00
Dim kodaVremeTemp As Double = ToolStripTextBox3.Text.Replace(",", ".")
Dim kodaVremePrit As Double = ToolStripTextBox4.Text.Replace(",", ".") ' 1 mbar/hPa = 0.750062 Torr
dataTekst = "*410000+" + My.Settings.KodaStojisceInfo.PadLeft(16, "0") + " 71....+" + Format(kodaVremeTemp, "0000000000000000").ToString + " 72....+" + Format(kodaVremePrit, "0000000000000000").ToString + " "
2024-06-07 00:11:48 +02:00
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-19 21:00:35 +02:00
ElseIf ComBoxKoda.SelectedIndex = 11 Then ' Koda Orientacija
Dim kodaOri As String = ToolStripTextBox1.Text.PadLeft(16, "0")
Dim kodaOriHz As Double = ToolStripTextBox5.Text.Replace(",", ".") * 100000
dataTekst = "*410000+" + My.Settings.KodaStojisceOri.PadLeft(16, "0") + " 71....+" + kodaOri.PadLeft(16, "0") + " 72....+" + Format(kodaOriHz, "0000000000000000").ToString + " "
BtnShraniF2.Enabled = True
DatotekaSpemembe = True
2024-06-07 00:11:48 +02:00
End If
2024-06-16 05:10:11 +02:00
RichTextBoxEdit.Focus()
RichTextBoxEdit.SelectionStart = RichTextBoxEdit.GetFirstCharIndexOfCurrentLine
SendKeys.Send("+{HOME}")
RichTextBoxEdit.SelectedText = dataTekst + vbCrLf
2024-06-07 00:11:48 +02:00
End Sub
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
2024-06-10 20:57:35 +02:00
RichTextBoxEdit.Undo()
End Sub
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click
Me.Close()
2024-06-02 05:35:03 +02:00
End Sub
2024-06-13 04:25:40 +02:00
2024-06-16 05:10:11 +02:00
Private Sub ComBoxKoda_Click(sender As Object, e As EventArgs) Handles ComBoxKoda.SelectedIndexChanged
2024-06-19 21:00:35 +02:00
If ComBoxKoda.SelectedIndex <= 0 Then
2024-06-16 05:10:11 +02:00
ToolStripButton2.Enabled = False
ToolStripLabel2.Visible = False
ToolStripLabel3.Visible = False
ToolStripLabel4.Visible = False
ToolStripLabel5.Visible = False
2024-06-19 21:00:35 +02:00
ToolStripLabel6.Visible = False
2024-06-16 05:10:11 +02:00
ToolStripTextBox1.Visible = False
ToolStripTextBox2.Visible = False
ToolStripTextBox3.Visible = False
ToolStripTextBox4.Visible = False
2024-06-19 21:00:35 +02:00
ToolStripTextBox5.Visible = False
ElseIf ComBoxKoda.SelectedIndex = 9 Then
2024-06-16 05:10:11 +02:00
ToolStripButton2.Enabled = True
ToolStripLabel2.Visible = True
ToolStripTextBox1.Visible = True
ToolStripLabel3.Visible = True
ToolStripTextBox2.Visible = True
ToolStripLabel4.Visible = False
ToolStripTextBox3.Visible = False
ToolStripLabel5.Visible = False
ToolStripTextBox4.Visible = False
2024-06-19 21:00:35 +02:00
ToolStripLabel6.Visible = False
ToolStripTextBox5.Visible = False
ElseIf ComBoxKoda.SelectedIndex = 10 Then
2024-06-16 05:10:11 +02:00
ToolStripButton2.Enabled = True
ToolStripLabel2.Visible = False
ToolStripTextBox1.Visible = False
ToolStripLabel3.Visible = False
ToolStripTextBox2.Visible = False
ToolStripLabel4.Visible = True
ToolStripTextBox3.Visible = True
ToolStripLabel5.Visible = True
ToolStripTextBox4.Visible = True
2024-06-19 21:00:35 +02:00
ToolStripLabel6.Visible = False
ToolStripTextBox5.Visible = False
ElseIf ComBoxKoda.SelectedIndex = 11 Then
ToolStripButton2.Enabled = True
ToolStripLabel2.Visible = True
ToolStripTextBox1.Visible = True
ToolStripLabel3.Visible = False
ToolStripTextBox2.Visible = False
ToolStripLabel4.Visible = False
ToolStripTextBox3.Visible = False
ToolStripLabel5.Visible = False
ToolStripTextBox4.Visible = False
ToolStripLabel6.Visible = True
ToolStripTextBox5.Visible = True
2024-06-16 05:10:11 +02:00
Else
ToolStripButton2.Enabled = True
ToolStripLabel2.Visible = False
ToolStripLabel3.Visible = False
ToolStripLabel4.Visible = False
ToolStripLabel5.Visible = False
2024-06-19 21:00:35 +02:00
ToolStripLabel6.Visible = False
2024-06-16 05:10:11 +02:00
ToolStripTextBox1.Visible = False
ToolStripTextBox2.Visible = False
ToolStripTextBox3.Visible = False
ToolStripTextBox4.Visible = False
2024-06-19 21:00:35 +02:00
ToolStripTextBox5.Visible = False
2024-06-16 05:10:11 +02:00
End If
End Sub
2024-07-17 22:30:32 +02:00
Private Sub IzračunMeritveStMerToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles IzračunMeritveStMerToolStripMenuItem.Click
FormIzracunMeasure.Show()
End Sub
2024-06-02 05:35:03 +02:00
End Class