Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            cfundal     = Properties.Settings.Default.cfundal;
            fundal      = Properties.Settings.Default.fundal;
            font        = Properties.Settings.Default.Fontsetting;
            n           = Properties.Settings.Default.locatie;
            monitor     = Properties.Settings.Default.monitor;
            x           = Properties.Settings.Default.xsetting;
            y           = Properties.Settings.Default.ysetting;
            transparent = Properties.Settings.Default.transparentsetting;
            background  = Properties.Settings.Default.backgroundcolor;
            forecolor   = Properties.Settings.Default.forecolor;
            afisaredata = Properties.Settings.Default.afisaredata;

            if (monitor == false || System.Windows.Forms.Screen.AllScreens.Length > 1)
            {
                if (ok == false)
                {
                    button1.Enabled = false;
                    f = new clock(font, n, monitor, x, y, transparent, background, forecolor, fundal, cfundal, afisaredata);
                    f.Show();
                    ok = true;
                }
            }
            else
            {
                MessageBox.Show("Nu este conectat nici un monitor extins.");
            }
        }
Example #2
0
            public void Start()
            {
                while (true)
                {
                    //
                    // TimeOfTick time=new TimeOfTick();
                    string str = null;
                    clock ts = new clock();
                    ts.setter();
                    str = ts.getter();

                    DateTime dt1 = DateTime.Parse(str);

                    if (DateTime.Now > dt1)
                    {
                        Console.WriteLine("闹钟时间小于系统时间,请重新设置:");
                        continue;
                    }

                    while (true)
                    {
                        string strnow = DateTime.Now.ToString();
                        DateTime dt = DateTime.Parse(strnow);

                        string str1 = dt.ToString();
                        //判断时间到了吗
                        if (str1 == str)
                        {
                            if (Tick != null)
                            {

                                TimeEventArgs TEA = new TimeEventArgs();
                                TEA.Time = DateTime.Now;
                                Tick(this, TEA);
                            }
                            System.Console.WriteLine("设置时间到");

                        }
                    }
                }
            }