Public Class frmModImp
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
Dim W As New IO.StreamWriter(Application.StartupPath + "\Imp\" + dtpImp.Value.ToLongDateString + ".txt")
W.Write(txtImp.Text)
W.Close()
With frmHelper
.MagoMerlino.Speak(.Sentences(frmHelper.SenNum.Impegni_Salvati))
End With
End Sub
Private Sub cmdErase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdErase.Click
With frmHelper
.MagoMerlino.Stop()
.MagoMerlino.Play("Confused")
If MsgBox("Sei sicuro?", MsgBoxStyle.Question + vbYesNo) = MsgBoxResult.Yes Then
Kill(Application.StartupPath + "\Imp\" + dtpImp.Value.ToLongDateString + ".txt")
.MagoMerlino.Speak(.Sentences(frmHelper.SenNum.Impegni_Cancellati))
End If
End With
End Sub
Private Sub frmModImp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim D As Date = Date.Now
Try
Dim R As New IO.StreamReader(Application.StartupPath + "\Imp\" + D.ToLongDateString + ".txt")
txtImp.Text = R.ReadToEnd
R.Close()
Catch FNFE As IO.FileNotFoundException
txtImp.Text = "Nessun impegno per oggi!"
End Try
End Sub
Private Sub dtpImp_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpImp.ValueChanged
Dim D As Date = dtpImp.Value
Try
Dim R As New IO.StreamReader(Application.StartupPath + "\Imp\" + D.ToLongDateString + ".txt")
txtImp.Text = R.ReadToEnd
R.Close()
Catch FNFE As IO.FileNotFoundException
txtImp.Text = "Nessun impegno per oggi!"
End Try
End Sub
End Class