Imports TheAgent.frmHelper
Public Class frmModImp
'Salva gli impegni
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
'Impegni salvati
SaySentence(2)
End With
End Sub
'Cancella l'impegno selezionato
Private Sub cmdErase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdErase.Click
With frmHelper
.Agente.Stop()
.Agente.Play("Confused")
If MessageBox.Show("Sei sicuro?", "Eliminazione", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = MsgBoxResult.Yes Then
IO.
File.
Delete(Application.
StartupPath + "\Imp\" + dtpImp.
Value.
ToLongDateString + ".txt")
txtImp.Text = ""
'Impegni cancellati
SaySentence(3)
End If
End With
End Sub
'Carica gli impegni per oggi
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
'Carica gli impegni per la data selezionata
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