ALARM KURMA UYGULAMASI



using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Media;


namespace AlarmKurmaUygulaması

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        private void Form1_Load_1(object sender, EventArgs e)

        {

            TIMER.Start();

            BTNCANCEL.Enabled = false;

        }

        private void TIMER_Tick(object sender, EventArgs e)

        {

            label1.Text = DateTime.Now.ToLongTimeString();

            //Label'ın texinini şuanki zamanı göstermesi için

            string labelstr = "";

            string saat = "";

            string dakika = "";

            int adim = 0;


            foreach (var item in label1.Text)

            {

                if (item.ToString() != " " && item.ToString() != "P" && item.ToString() != "M")

                {

                    if (item.ToString() == ":")

                    {

                        adim++;

                    }

                    if (item.ToString() != ":" && adim == 0)

                    {

                        saat = saat + item.ToString();

                    }

                    if (item.ToString() != ":" && adim == 1)

                    {

                        dakika = dakika + item.ToString();

                    }

                    textBox1.Text = saat + " " + dakika;

                }

            }

            if (numericUpDown1.Value == Convert.ToInt32(saat) && numericUpDown2.Value == Convert.ToInt32(dakika)/* && numericUpDown3.Value == Convert.ToInt32(saniye)*/)

            {

                Console.Beep(15000, 2000);

            }

            BTNCANCEL.Enabled = true;

        }

        private void BTNSET_Click_1(object sender, EventArgs e)

        {

            numericUpDown1.Enabled = false;

            numericUpDown2.Enabled = false;

            BTNSET.Enabled = false;

            if (numericUpDown1.Value == DateTime.Now.Hour && numericUpDown2.Value == DateTime.Now.Minute && numericUpDown2.Value == DateTime.Now.Second)

            {

                Console.Beep();

                TIMER.Stop();

            }

            BTNCANCEL.Enabled = true;

        }

        private void BTNCANCEL_Click_1(object sender, EventArgs e)

        {

            BTNSET.Enabled = true;

            BTNCANCEL.Enabled = false;

            numericUpDown1.Enabled = true;

            numericUpDown2.Enabled = true;

            Application.Exit();

        }

    }

}



...




Yorumlar

Popüler Yayınlar