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
Shutdown - Form1.vb

Form1.vb

Caricato da: Progman-92
Scarica il programma completo

  1. Imports System
  2. Imports System.Threading
  3. Imports System.Drawing
  4. Imports System.Collections
  5. Imports System.ComponentModel
  6. Imports System.Windows.Forms
  7. Imports System.Net
  8. Imports System.Net.Mail
  9. Imports System.Runtime.InteropServices
  10. Imports System.IO
  11.  
  12. Public Class Form1
  13.     Const HWND_BROADCAST As Integer = &HFFFF
  14.     Const SC_MONITORPOWER As Integer = &HF170
  15.     Const WM_SYSCOMMAND As Short = &H112S
  16.     Dim ore, minuti, secondi As Integer
  17.     Dim setOre, setMin As Integer
  18.     Dim nomeapp As String
  19.     Dim suono As String
  20.     Public nomeprocesso As String
  21.     Public testomex As String
  22.     Public titolomex As String
  23.  
  24. #Region "API"
  25.  
  26.     <DllImport("user32.dll", CallingConvention:=Runtime.InteropServices.CallingConvention.StdCall, CharSet:=Runtime.InteropServices.CharSet.Ansi, EntryPoint:="keybd_event", ExactSpelling:=True, SetLastError:=True)> Public Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
  27.     End Sub
  28.  
  29.     <DllImport("user32.dll", CallingConvention:=Runtime.InteropServices.CallingConvention.StdCall, CharSet:=Runtime.InteropServices.CharSet.Ansi, EntryPoint:="ExitWindowsEx", ExactSpelling:=True, SetLastError:=True)> Public Shared Sub ExitWindowsEx(ByVal uFlags As Integer, ByVal dwReason As Integer)
  30.     End Sub
  31.  
  32.     Private Function SendMessage(ByVal Handle As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
  33.     End Function
  34.  
  35. #End Region
  36.    
  37.     Private Sub NotificaEmail(ByVal destinatario As String, ByVal operazione As String, ByVal nomepc As String, ByVal data As String, ByVal ora As String)
  38.         Dim message As New MailMessage("Shutdown@virgilio.it", destinatario, "Operazione effetuata con successo", "Ciao " & destinatario & ", la informo che l'operazione di " & operazione & " sul computer " & nomepc & " è avvenuta con successo il " & data & " alle " & ora & ". Shutdown 4.0 Developed by Progman-92/De Vos Ugo!!!.")
  39.         Dim emailClient As New SmtpClient("out.virgilio.it")
  40.         message.Priority = MailPriority.Normal
  41.         emailClient.Send(message)
  42.     End Sub
  43.  
  44.     Private Sub spegniSchermo()
  45.         SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1)
  46.     End Sub
  47.  
  48.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  49.         cbSelezione.SelectedItem = "Nessuna operazione"
  50.         tmrOraDataSistema.Start()
  51.         lblTipologiaOperazione.Text = "Nessuna operazione"
  52.     End Sub
  53.  
  54.     Private Sub btnNascondi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  55.         Me.Hide()
  56.     End Sub
  57.  
  58.     Private Sub btnOpzioni_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpzioni.Click
  59.         Select Case cbSelezione.SelectedItem.ToString
  60.             Case "Nessuna operazione", "Disconessione utente", "Blocco personal computer", "Spegnimento", "Riavvio", "Sospensione", "Ibernazione", "Screenshoot", "Spegnimento schermo"
  61.                 MessageBox.Show("Non è neccessario specificare nessun parametro aggiuntivo per eseguire questa operazione!!!", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error)
  62.             Case "Avvio applicazione"
  63.                 Dim percorso
  64.                 apriFile1.InitialDirectory = "C:\Programmi"
  65.                 apriFile1.RestoreDirectory = True
  66.                 apriFile1.Title = "Scegli l'applicazione che vuoi avviare"
  67.                 apriFile1.FilterIndex = 2
  68.                 apriFile1.DefaultExt = "exe"
  69.                 apriFile1.Filter = "file eseguibili (*.exe) | *.exe| " & "tutti i file (*.*) | *.*"
  70.                 If apriFile1.ShowDialog() = Windows.Forms.DialogResult.OK Then
  71.                     percorso = Me.apriFile1.FileName
  72.                     nomeapp = percorso.ToString
  73.                 End If
  74.             Case "Chiusura applicazione"
  75.                 Form2.Show()
  76.             Case "Messaggio"
  77.                 Form3.Show()
  78.             Case "Suono"
  79.                 apriFile1.InitialDirectory = "C:\Windows\Media"
  80.                 apriFile1.RestoreDirectory = True
  81.                 apriFile1.Title = "Scegli il suono che vuoi avviare"
  82.                 apriFile1.FilterIndex = 2
  83.                 apriFile1.DefaultExt = "wav"
  84.                 apriFile1.Filter = "File audio wave (*.wav) | *.wav| " & "Tutti i file (*.*) | *.*"
  85.                 If apriFile1.ShowDialog() = Windows.Forms.DialogResult.OK Then
  86.                     suono = apriFile1.FileName.ToString
  87.                 End If
  88.         End Select
  89.     End Sub
  90.  
  91.     Private Sub tmrOraDataSistema_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrOraDataSistema.Tick
  92.         lblOra.Text = Date.Now
  93.     End Sub
  94.  
  95.     Private Sub tmrOperazioni_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrOperazioni.Tick
  96.         tmrOperazioni.Start()
  97.         If rbtnAlle.Checked = True Then
  98.             ShutdownAt()
  99.         ElseIf rbtnIn.Checked = True Then
  100.             ShutdownIn()
  101.         End If
  102.     End Sub
  103.  
  104.     Private Function formato2Cifre(ByVal Valore As Integer) As String
  105.         Dim nuovoValore As String
  106.         Dim lungh As Integer = Valore.ToString.Length
  107.         If lungh = 1 Then
  108.             nuovoValore = "0" + Valore.ToString
  109.             Return nuovoValore
  110.         Else
  111.             Return Valore.ToString
  112.         End If
  113.     End Function
  114.  
  115.     Private Sub ShutdownIn()
  116.         If ore > 0 Or minuti > 0 Or secondi > 0 Then
  117.             If minuti = 0 AndAlso ore > 0 Then minuti = 59 : ore = ore - 1
  118.             If secondi = 0 AndAlso minuti > 0 Then secondi = 60 : minuti = minuti - 1
  119.             secondi = secondi - 1
  120.         End If
  121.         lblTipologiaOperazione.Text = cbSelezione.Text + " in"
  122.         lblCountDown.Text = formato2Cifre(ore) + ":" + formato2Cifre(minuti) + ":" + formato2Cifre(secondi)
  123.         If ore = 0 AndAlso minuti = 0 AndAlso secondi = 0 Then
  124.             tmrOperazioni.Stop()
  125.             Select Case cbSelezione.SelectedIndex
  126.                 Case 0
  127.  
  128.                 Case 1
  129.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  130.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  131.                     End If
  132.                     ExitWindowsEx(0, 0)
  133.                     Me.Close()
  134.  
  135.                 Case 2
  136.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  137.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  138.                     End If
  139.                     Shell("rundll32.exe user32.dll,LockWorkStation")
  140.                     Me.Close()
  141.                 Case 3
  142.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  143.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  144.                     End If
  145.                     ExitWindowsEx(2, 0)
  146.                     Me.Close()
  147.                 Case 4
  148.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  149.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  150.                     End If
  151.                     ExitWindowsEx(1, 0)
  152.                     Me.Close()
  153.                 Case 5
  154.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  155.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  156.                     End If
  157.                     Application.SetSuspendState(PowerState.Suspend, True, True)
  158.                     Me.Close()
  159.                 Case 6
  160.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  161.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  162.                     End If
  163.                     Application.SetSuspendState(PowerState.Hibernate, True, True)
  164.                     Me.Close()
  165.                 Case 7
  166.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  167.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  168.                     End If
  169.                     spegniSchermo()
  170.                     Me.Close()
  171.                 Case 8
  172.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  173.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  174.                         System.Threading.Thread.Sleep(500)
  175.                     End If
  176.                     Shell(nomeapp)
  177.                     Me.Close()
  178.                 Case 9
  179.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  180.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  181.                     End If
  182.                     Dim processi() As Process = Process.GetProcessesByName(nomeprocesso.ToString)
  183.                     Dim processo As Process
  184.                     For Each processo In processi
  185.                         processo.CloseMainWindow()
  186.                     Next
  187.                     Me.Close()
  188.                 Case 10
  189.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  190.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  191.                     End If
  192.                     MessageBox.Show(testomex, titolomex, MessageBoxButtons.OK, MessageBoxIcon.Information)
  193.                     Me.Close()
  194.                 Case 11
  195.                     If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  196.                         NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  197.                     End If
  198.                     My.Computer.Audio.Play(suono)
  199.                     tmrSuono.Start()
  200.                     Me.Hide()
  201.                 Case 12
  202.                     Const KEYEVENTF_KEYUP As Byte = &H2
  203.                     keybd_event(AscW(Chr(44)), 0, 0, 0)
  204.                     keybd_event(AscW(Chr(44)), 0, KEYEVENTF_KEYUP, 0)
  205.                     pctbScreenShoot.Image = CType(Clipboard.GetDataObject().GetData(DataFormats.Bitmap), Bitmap)
  206.                     pctbScreenShoot.Image.Save(Application.StartupPath & "/Screenshoot.jpg", Imaging.ImageFormat.Jpeg)
  207.             End Select
  208.         End If
  209.     End Sub
  210.  
  211.     Private Sub ShutdownAt()
  212.         lblTipologiaOperazione.Text = cbSelezione.Text + " alle"
  213.         lblCountDown.Text = formato2Cifre(nudOre1.Value) + ":" + formato2Cifre(nudMin1.Value) + ":" + formato2Cifre(0)
  214.         If String.Compare(Now.Hour.ToString, nudOre1.Value.ToString) = 0 Then
  215.             If String.Compare(Now.Minute.ToString, nudMin1.Value.ToString) = 0 Then
  216.                 Me.Show()
  217.                 tmrSuono.Stop()
  218.                 Select Case cbSelezione.SelectedIndex
  219.                     Case 0
  220.  
  221.                     Case 1
  222.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  223.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  224.                         End If
  225.                         ExitWindowsEx(0, 0)
  226.                         Me.Close()
  227.  
  228.                     Case 2
  229.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  230.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  231.                         End If
  232.                         Shell("rundll32.exe user32.dll,LockWorkStation")
  233.                         Me.Close()
  234.                     Case 3
  235.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  236.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  237.                         End If
  238.                         ExitWindowsEx(2, 0)
  239.                         Me.Close()
  240.                     Case 4
  241.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  242.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  243.                         End If
  244.                         ExitWindowsEx(1, 0)
  245.                         Me.Close()
  246.                     Case 5
  247.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  248.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  249.                         End If
  250.                         Application.SetSuspendState(PowerState.Suspend, True, True)
  251.                         Me.Close()
  252.                     Case 6
  253.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  254.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  255.                         End If
  256.                         Application.SetSuspendState(PowerState.Hibernate, True, True)
  257.                         Me.Close()
  258.                     Case 7
  259.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  260.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  261.                         End If
  262.                         spegniSchermo()
  263.                         Me.Close()
  264.                     Case 8
  265.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  266.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  267.                             System.Threading.Thread.Sleep(500)
  268.                         End If
  269.                         Shell(nomeapp)
  270.                         Me.Close()
  271.                     Case 9
  272.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  273.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  274.                         End If
  275.                         Dim processi() As Process
  276.                         Dim processo As Process
  277.                         processi = Process.GetProcessesByName(nomeprocesso.ToString)
  278.                         For Each processo In processi
  279.                             processo.CloseMainWindow()
  280.                         Next
  281.                         Me.Close()
  282.                     Case 10
  283.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  284.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  285.                         End If
  286.                         MessageBox.Show(testomex, titolomex, MessageBoxButtons.OK, MessageBoxIcon.Information)
  287.                         Me.Close()
  288.                     Case 11
  289.                         If Me.chkbNotifica.CheckState = CheckState.Checked And txtMail.Text <> "" Then
  290.                             NotificaEmail(txtMail.Text, cbSelezione.Text, My.Computer.Name, Date.Today.Day & "/" & Date.Today.Month & "/" & Date.Today.Year, Date.Today.Hour & ":" & Date.Today.Minute & ":" & Date.Today.Second)
  291.                         End If
  292.                         My.Computer.Audio.Play(suono)
  293.                         tmrSuono.Start()
  294.                         Me.Hide()
  295.                     Case 12
  296.                         Const KEYEVENTF_KEYUP As Byte = &H2
  297.                         keybd_event(AscW(Chr(44)), 0, 0, 0)
  298.                         keybd_event(AscW(Chr(44)), 0, KEYEVENTF_KEYUP, 0)
  299.                         pctbScreenShoot.Image = CType(Clipboard.GetDataObject().GetData(DataFormats.Bitmap), Bitmap)
  300.                         pctbScreenShoot.Image.Save(Application.StartupPath & "/Screenshoot.jpg", Imaging.ImageFormat.Jpeg)
  301.                 End Select
  302.             End If
  303.         End If
  304.     End Sub
  305.  
  306.     Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
  307.         If cbSelezione.SelectedItem = "Nessuna operazione" Then
  308.             MessageBox.Show("Specificare una operazione!!!", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error)
  309.         Else
  310.             tmrOperazioni.Start()
  311.             lblOra.Visible = True
  312.             setOre = nudOre2.Value
  313.             setMin = nudMin2.Value
  314.             ore = setOre
  315.             minuti = setMin
  316.             If nudOre2.Value = 0 AndAlso nudMin2.Value = 0 Then
  317.                 secondi = 60
  318.             Else
  319.                 secondi = 0
  320.             End If
  321.             btnOk.Enabled = False
  322.  
  323.         End If
  324.     End Sub
  325.  
  326.     Private Sub btnAnnulla_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnnulla.Click
  327.         tmrOperazioni.Stop()
  328.         lblTipologiaOperazione.Text = "Nessuna operazione"
  329.         lblCountDown.Text = ""
  330.         cbSelezione.SelectedIndex = 0
  331.         Me.btnOk.Enabled = True
  332.     End Sub
  333.  
  334.     Private Sub nudHours_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudOre1.ValueChanged
  335.         tmrOperazioni.Stop()
  336.         If nudOre1.Value = nudOre1.Maximum Then
  337.             nudOre1.UpButton()
  338.             nudOre1.Value = nudOre1.Minimum + 1
  339.         End If
  340.  
  341.         If nudOre1.Value = nudOre1.Minimum Then
  342.             nudOre1.DownButton()
  343.             nudOre1.Value = nudOre1.Maximum - 1
  344.         End If
  345.     End Sub
  346.  
  347.     Private Sub nudMin_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudMin1.ValueChanged
  348.         tmrOperazioni.Stop()
  349.         If nudMin1.Value = nudMin1.Maximum Then
  350.             nudMin1.UpButton()
  351.             nudMin1.Value = nudMin1.Minimum + 1
  352.         End If
  353.  
  354.         If nudMin1.Value = nudMin1.Minimum Then
  355.             nudMin1.DownButton()
  356.             nudMin1.Value = nudMin1.Maximum - 1
  357.         End If
  358.     End Sub
  359.  
  360.     Private Sub nudHours2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudOre2.ValueChanged
  361.         tmrOperazioni.Stop()
  362.         If nudOre2.Value = nudOre2.Maximum Then
  363.             nudOre2.UpButton()
  364.             nudOre2.Value = nudOre2.Minimum + 1
  365.         End If
  366.         If nudOre2.Value = nudOre2.Minimum Then
  367.             nudOre2.DownButton()
  368.             nudOre2.Value = nudOre2.Maximum - 1
  369.         End If
  370.     End Sub
  371.  
  372.     Private Sub nudMin2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudMin2.ValueChanged
  373.         tmrOperazioni.Stop()
  374.         If nudMin2.Value = nudMin2.Maximum Then
  375.             nudMin2.UpButton()
  376.             nudMin2.Value = nudMin2.Minimum + 1
  377.         End If
  378.  
  379.         If nudMin2.Value = nudMin2.Minimum Then
  380.             nudMin2.DownButton()
  381.             nudMin2.Value = nudMin2.Maximum - 1
  382.         End If
  383.     End Sub
  384.  
  385.     Private Sub rbtnAt_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnAlle.CheckedChanged
  386.         nudOre1.Enabled = True
  387.         nudMin1.Enabled = True
  388.         nudOre2.Enabled = False
  389.         nudMin2.Enabled = False
  390.         tmrOperazioni.Stop()
  391.     End Sub
  392.  
  393.     Private Sub rbtnIn_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnIn.CheckedChanged
  394.         nudOre1.Enabled = False
  395.         nudMin1.Enabled = False
  396.         nudOre2.Enabled = True
  397.         nudMin2.Enabled = True
  398.         tmrOperazioni.Stop()
  399.     End Sub
  400.  
  401.     Private Sub txtMail_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMail.TextChanged
  402.         If txtMail.Text.Length <> 0 Then
  403.             chkbNotifica.CheckState = CheckState.Checked
  404.         Else
  405.             chkbNotifica.CheckState = CheckState.Unchecked
  406.         End If
  407.     End Sub
  408.  
  409.     Private Sub tmrSuono_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrSuono.Tick
  410.         My.Computer.Audio.Play(suono)
  411.     End Sub
  412.  
  413.     Private Sub MostraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MostraToolStripMenuItem.Click
  414.         Me.ShowDialog()
  415.     End Sub
  416.  
  417.     Private Sub NascondiToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NascondiToolStripMenuItem.Click
  418.         Me.Hide()
  419.     End Sub
  420.  
  421.     Private Sub InterrompiTuttoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InterrompiTuttoToolStripMenuItem.Click
  422.         tmrOperazioni.Stop()
  423.         lblTipologiaOperazione.Text = ""
  424.         lblCountDown.Text = ""
  425.         cbSelezione.SelectedIndex = 0
  426.         Me.btnOk.Enabled = True
  427.     End Sub
  428.  
  429.     Private Sub EsciToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EsciToolStripMenuItem.Click
  430.         Me.Close()
  431.     End Sub
  432.  
  433.     Private Sub InfoSuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InfoSuToolStripMenuItem.Click
  434.         AboutBox1.ShowDialog()
  435.     End Sub
  436.  
  437. End Class