Sayfalar
9 Nisan 2016 Cumartesi
ÇOKLU ALARM ÖRNEK PROJESİ
ÇOKLU ALARM PROJE KODLARI
İNDİR
Public Class Form1 Dim AlarmCal As Boolean = False Dim TimerAyarla As Boolean = False Dim eylemSuresi As Byte = 0 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim xDizi As String Timer1.Enabled = True Timer2.Enabled = True ' Menüleri Boşalt alarm_Cmb1A.Items.Add("") alarm_Cmb2A.Items.Add("") alarm_Cmb3A.Items.Add("") alarm_Cmb1B.Items.Add("") alarm_Cmb2B.Items.Add("") alarm_Cmb3B.Items.Add("") 'Saat Bölümünü doldur For n As Byte = 0 To 23 xDizi = n IKI(xDizi) alarm_Cmb1A.Items.Add(xDizi) alarm_Cmb2A.Items.Add(xDizi) alarm_Cmb3A.Items.Add(xDizi) Next 'Dakika Bölümünü doldur For n As Byte = 0 To 59 xDizi = n IKI(xDizi) alarm_Cmb1B.Items.Add(xDizi) alarm_Cmb2B.Items.Add(xDizi) alarm_Cmb3B.Items.Add(xDizi) Next End Sub Private Sub Form1_Closing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing Dim SesliUyar As Boolean = False If alarm_Cmb1A.Text <> "" And alarm_Cmb1B.Text <> "" Then SesliUyar = True If alarm_Cmb2A.Text <> "" And alarm_Cmb2B.Text <> "" Then SesliUyar = True If alarm_Cmb3A.Text <> "" And alarm_Cmb3B.Text <> "" Then SesliUyar = True If timer_LblKronometre.Text <> "00:00" Then SesliUyar = True If SesliUyar = True Then If MsgBox("Çıkmak istediğinizden emin misiniz?", _ MsgBoxStyle.YesNo, "Çoklu Alarm Uyarısı") = MsgBoxResult.No Then e.Cancel = True End If End If End Sub Private Sub TimerButonları(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles timer_Btn10.Click, timer_Btn5.Click, timer_Btn1.Click, timer_BtnBASLAT.Click Dim Btn_Text As Control = CType(sender, Control) Dim Ekle As Byte Dim Basamak As String Select Case Btn_Text.Text Case "+1" Ekle = 1 Case "+5" Ekle = 5 Case "+10" Ekle = 10 Case "Başla" timer_BtnBASLAT.Text = "Sıfırla" timer_BtnBASLAT.ForeColor = Color.Red TimerAyarla = True timer_LblKronometre.Enabled = True Exit Sub Case "Sıfırla" timer_BtnBASLAT.ForeColor = SystemColors.ControlText timer_BtnBASLAT.Text = "Başla" timer_BtnBASLAT.Enabled = False timer_LblKronometre.Enabled = False TimerAyarla = False timer_LblKronometre.Text = "00:00" Exit Sub End Select timer_BtnBASLAT.Enabled = True 'TIMER için 1, 5 veya 10 dakika ekle Basamak = Mid(timer_LblKronometre.Text, 1, 2) + Ekle IKI(Basamak) 'iki basamaktaki sayı 99 dan büyükse çık 'iki basamaklı sayıyı hatırla If Basamak > 99 Then Exit Sub 'Değişiklikleri uygula timer_LblKronometre.Text = Basamak & ":" & Mid(timer_LblKronometre.Text, 4, 5) End Sub Private Sub btnDUR_Click(sender As System.Object, e As System.EventArgs) Handles btnDUR.Click AlarmSesi("Dur") btnDUR.BackColor = SystemColors.Control btnDUR.ForeColor = SystemColors.ControlText End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 'ALARM CODE Dim SaatBLM As String = DateTime.Now.Hour 'Saat Dim DakikaBLM As String = DateTime.Now.Minute 'Dakika Dim SaniyeBLM As String = DateTime.Now.Second 'Saniye Bölümü IKI(SaatBLM) IKI(DakikaBLM) IKI(SaniyeBLM) SaatLbl.Text = SaatBLM & ":" & DakikaBLM & ":" & SaniyeBLM If alarm_Cmb1A.Text = SaatBLM _ And alarm_Cmb1B.Text = DakikaBLM _ And SaniyeBLM = "00" Then AlarmSesi("Başla") End If If alarm_Cmb2A.Text = SaatBLM _ And alarm_Cmb2B.Text = DakikaBLM _ And SaniyeBLM = "00" Then AlarmSesi("Başla") End If If alarm_Cmb3A.Text = SaatBLM _ And alarm_Cmb3B.Text = DakikaBLM _ And SaniyeBLM = "00" Then AlarmSesi("Başla") End If 'TIMER KODLARI If TimerAyarla = True Then If timer_LblKronometre.Text = "00:00" Then TimerAyarla = False timer_BtnBASLAT.Text = "Başla" timer_BtnBASLAT.Enabled = False timer_LblKronometre.Enabled = False AlarmSesi("Başla") Exit Sub End If If Mid(timer_LblKronometre.Text, 4, 5) <> "00" Then Dim SecilenKrnm As String = Mid(timer_LblKronometre.Text, 4, 5) - 1 IKI(SecilenKrnm) timer_LblKronometre.Text = Mid(timer_LblKronometre.Text, 1, 2) & ":" & SecilenKrnm Else Dim Basamak As String = Mid(timer_LblKronometre.Text, 1, 2) - 1 IKI(Basamak) timer_LblKronometre.Text = Basamak & ":" & "59" End If End If End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick If AlarmCal = True Then My.Computer.Audio.Play(My.Resources.BipBip, AudioPlayMode.Background) eylemSuresi += 1 End If If eylemSuresi > 15 Then Timer2.Interval = 200 End If If eylemSuresi > 215 Then AlarmSesi("Dur") btnDUR.BackColor = SystemColors.Control btnDUR.ForeColor = SystemColors.ControlText End If End Sub Private Sub AlarmSesi(ByVal eylem) Select Case eylem Case "Başla" AlarmCal = True btnDUR.Enabled = True btnDUR.BackColor = Color.Red btnDUR.ForeColor = Color.White Case ("Dur") AlarmCal = False btnDUR.Enabled = False btnDUR.BackColor = SystemColors.Control btnDUR.ForeColor = SystemColors.ControlText eylemSuresi = 0 Timer2.Interval = 1000 End Select End Sub Private Sub IKI(ByRef deger) If deger < 10 Then deger = "0" & deger End If End Sub End Class
Hiç yorum yok:
Yorum Gönder
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder