Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
The Agent - frmModImp.vb

frmModImp.vb

Caricato da: Totem
Scarica il programma completo

  1. Imports TheAgent.frmHelper
  2. Public Class frmModImp
  3.     'Salva gli impegni
  4.     Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
  5.         Dim W As New IO.StreamWriter(Application.StartupPath + "\Imp\" + dtpImp.Value.ToLongDateString + ".txt")
  6.         W.Write(txtImp.Text)
  7.         W.Close()
  8.         With frmHelper
  9.             'Impegni salvati
  10.             SaySentence(2)
  11.         End With
  12.     End Sub
  13.  
  14.     'Cancella l'impegno selezionato
  15.     Private Sub cmdErase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdErase.Click
  16.         With frmHelper
  17.             .Agente.Stop()
  18.             .Agente.Play("Confused")
  19.             If MessageBox.Show("Sei sicuro?", "Eliminazione", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = MsgBoxResult.Yes Then
  20.                 IO.File.Delete(Application.StartupPath + "\Imp\" + dtpImp.Value.ToLongDateString + ".txt")
  21.                 txtImp.Text = ""
  22.                 'Impegni cancellati
  23.                 SaySentence(3)
  24.             End If
  25.         End With
  26.     End Sub
  27.  
  28.     'Carica gli impegni per oggi
  29.     Private Sub frmModImp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  30.         Dim D As Date = Date.Now
  31.         Try
  32.             Dim R As New IO.StreamReader(Application.StartupPath + "\Imp\" + D.ToLongDateString + ".txt")
  33.             txtImp.Text = R.ReadToEnd
  34.             R.Close()
  35.         Catch FNFE As IO.FileNotFoundException
  36.             txtImp.Text = "Nessun impegno per oggi!"
  37.         End Try
  38.     End Sub
  39.  
  40.     'Carica gli impegni per la data selezionata
  41.     Private Sub dtpImp_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpImp.ValueChanged
  42.         Dim D As Date = dtpImp.Value
  43.         Try
  44.             Dim R As New IO.StreamReader(Application.StartupPath + "\Imp\" + D.ToLongDateString + ".txt")
  45.             txtImp.Text = R.ReadToEnd
  46.             R.Close()
  47.         Catch FNFE As IO.FileNotFoundException
  48.             txtImp.Text = "Nessun impegno per oggi!"
  49.         End Try
  50.     End Sub
  51. End Class