'
' Created by SharpDevelop.
' User: Jano
' Date: 8.8.2017
' Time: 16:27
' 
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
Imports System.IO
Public Partial Class FKnihaJazd
Dim modul As New Module1
		Dim nacitane As String = ""	
	Public Sub New()
		' The Me.InitializeComponent call is required for Windows Forms designer support.
		Me.InitializeComponent()
		
		'
		' TODO : Add constructor code after InitializeComponents
		'
		
		If File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "/kj" & modul.readKtojeprihl() & ".txt") Then
		      nacitane = My.Computer.FileSystem.ReadAllText(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "/kj" & modul.readKtojeprihl() & ".txt")		      			
		End If
		richTextBox1.Text=nacitane.Trim()
	End Sub
	
	Sub FKnihaJazdFormClosed(sender As Object, e As FormClosedEventArgs)
			MainForm.okno=0
	End Sub
	
	Sub Button1Click(sender As Object, e As EventArgs)
		'klikol ulozit poznamky o jazdach
		Try
			Dim modul As New Module1
			If richTextBox1.Text.Trim()<>nacitane.Trim() Then
			modul.ulozKnihuJazd(modul.readKtojeprihl(),richTextBox1.Text.Trim())
			MsgBox("Prebehol pokus o uloženie Vašej knihy jázd. Pri opätovnom otvorení by ste mali vidieť pridané údaje.")
			Else
				MsgBox("Nepridali ste žiadne nové údaje do knihy jázd. Zatváram knihu jázd.")
			End If
			Me.Close()
		Catch ex As Exception
			MsgBox(ex.Message)
		End Try
	End Sub
End Class
