Bakın Bunlarda Kodlarım Benim Yapmak İstediğimi Anlamadınız Hala Çalışmıyor Demiyorum Ben Sürekli Saniyenin Dakikanın Değişmesinden Bahsetmiştim Ben
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Collections.Generic;
using System.Text;
using System.Media;
namespace Alarm
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
internal System.Windows.Forms.Button button2;
internal System.Windows.Forms.Button button1;
internal System.Windows.Forms.Label Label3;
internal System.Windows.Forms.TextBox textBox3;
internal System.Windows.Forms.TextBox textBox2;
internal System.Windows.Forms.Timer timer2;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.TextBox textBox1;
internal System.Windows.Forms.Timer timer1;
internal System.Windows.Forms.Label Label1;
private Timer timer3;
private Label label4;
private Label label5;
private Label label6;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.Label3 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.Label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.Label1 = new System.Windows.Forms.Label();
this.timer3 = new System.Windows.Forms.Timer(this.components);
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button2
//
this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
this.button2.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.button2.Location = new System.Drawing.Point(421, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(72, 56);
this.button2.TabIndex = 26;
this.button2.Text = "Alarmı Kapat";
this.button2.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
this.button1.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.button1.Location = new System.Drawing.Point(335, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 56);
this.button1.TabIndex = 25;
this.button1.Text = "Alarmı Aç";
this.button1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Label3
//
this.Label3.Location = new System.Drawing.Point(8, 59);
this.Label3.Name = "Label3";
this.Label3.Size = new System.Drawing.Size(72, 23);
this.Label3.TabIndex = 23;
this.Label3.Text = "Alarm Metni";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(86, 55);
this.textBox3.Multiline = true;
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(192, 83);
this.textBox3.TabIndex = 24;
this.textBox3.Text = "Uyarı Mesajını Lütfen Buraya Yazınız";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(132, 29);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 22;
//
// timer2
//
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// Label2
//
this.Label2.Location = new System.Drawing.Point(8, 32);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(100, 23);
this.Label2.TabIndex = 21;
this.Label2.Text = "Alarm Saati";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(132, 4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 20;
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Label1
//
this.Label1.Location = new System.Drawing.Point(8, 7);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(88, 16);
this.Label1.TabIndex = 19;
this.Label1.Text = "Alarm Tarihi";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(374, 107);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 13);
this.label4.TabIndex = 27;
this.label4.Text = "label4";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(387, 107);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 28;
this.label5.Text = "label5";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(405, 107);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(35, 13);
this.label6.TabIndex = 29;
this.label6.Text = "label6";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(505, 151);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.Label3);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.Label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.Label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
{
timer3.Enabled = true;
}
label4.Text = DateTime.Now.Hour.ToString();
label5.Text = ":" + DateTime.Now.Minute.ToString();
label6.Text = ":" + DateTime.Now.Second.ToString();
//tarih ve saati Text kutularında göster
textBox1.Text = DateTime.Now.ToShortDateString();
textBox2.Text = DateTime.Now.ToLongTimeString();
//Başlangıçta alarm kapalı
timer2.Enabled = false;
timer1.Enabled = false;
//her 100 ms'de bir yanıp sönmeyi sağla
timer2.Interval = 100;
//her 1000 ms'de bir alarmı kontrol etsin
timer1.Interval = 1000;
Text = "Alarm Kapalı";
}
private void timer1_Tick(object sender, System.EventArgs e)
{
//alarm zamanı geldiyse
if (textBox1.Text == DateTime.Now.ToShortDateString() && textBox2.Text == DateTime.Now.ToLongTimeString())
{
//timer2yi aktif yap (yanıp sönmeyi sağlayacak)
timer2.Enabled = true;
//Alarm metnini bildir
MessageBox.Show(textBox3.Text);
}
}
private void timer2_Tick(object sender, System.EventArgs e)
{
//Yazı ve zemin rengini değiştirerek
//Yanıp sönmesini sağla
Color c;
c=textBox3.BackColor;
textBox3.BackColor=textBox3.ForeColor ;
textBox3.ForeColor=c;
}
private void button1_Click(object sender, System.EventArgs e)
{
//Alarmı aktif yap
timer1.Enabled = true;
this.Text = "Alarm Açık";
}
private void button2_Click(object sender, System.EventArgs e)
{
//alarmı kapat
timer2.Enabled = false;
timer1.Enabled = false;
this.Text = "Alarm Kapalı";
}
private void timer3_Tick(object sender, EventArgs e)
{
label4.Text = DateTime.Now.Hour.ToString();
label5.Text = DateTime.Now.Minute.ToString();
label6.Text = DateTime.Now.Second.ToString();
}
}
}