using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace datetime
{
    public partial class Form1 : Form
    {
        PersianCalendar pc = new PersianCalendar();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string year, month, day;
            year = pc.GetYear(DateTime.Now).ToString();
            month = pc.GetMonth(DateTime.Now).ToString();
            day = pc.GetDayOfMonth(DateTime.Now).ToString();

            lbldate.Text=year+"/"+month+"/"+day.ToString();


            try 
            {
                lbltoday.Text = pc.GetDayOfWeek(DateTime.Now).ToString();

                switch (DateTime.Now.DayOfWeek)
                {
                    case DayOfWeek.Saturday:
                        lbltoday.Text = "شنبه";
                        break;

                    case DayOfWeek.Sunday:
                        lbltoday.Text = "یکشنبه";
                        break;

                        
                    case DayOfWeek.Monday:
                        lbltoday.Text = "دوشنبه";
                        break;

                    case DayOfWeek.Tuesday:
                        lbltoday.Text = "سه شنبه";
                        break;


                    case DayOfWeek.Wednesday:
                        lbltoday.Text = "چهارشنبه";
                        break;

                    case DayOfWeek.Thursday:
                        lbltoday.Text = "پنج شنبه";
                        break;

                    case DayOfWeek.Friday:
                        lbltoday.Text = "جمعه";
                        break;
                }

            }

            catch(Exception ex)
            {
                MessageBox.Show(ex.Message,"خطا");
            }
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            string hours, minutes, seconds;
            hours = DateTime.Now.Hour.ToString();
            minutes = DateTime.Now.Minute.ToString();
            seconds = DateTime.Now.Second.ToString();

            lbltime.Text = hours + ":" + minutes + ":" + seconds.ToString();
        }
    }
}
