private void fprocessClock(clockArgs cArgs) { FrameDimension dimension = new FrameDimension(cArgs.Image.FrameDimensionsList[0]); while (!cArgs.Quitting) { if (cArgs.Update) { DateTime Now = DateTime.Now; int x = (Now.Minute); int y = (Now.Hour % 12); cArgs.StringValue = y.ToString() + " - " + x.ToString(); cArgs.Image.SelectActiveFrame(dimension, y * 60 + x); cArgs.OutImage = (Bitmap)cArgs.Image.Clone(); cArgs.Update = false; } Thread.Sleep(1); } }
private void Form1_Load(object sender, EventArgs e) { key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\YTImager", true); if (key == null) { key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\YTImager", true); } serPort.BaudRate = 3000000; serPort.DataBits = 8; serPort.StopBits = System.IO.Ports.StopBits.One; serPort.Parity = System.IO.Ports.Parity.None; serPort.PortName = "COM20"; //serPort.Open(); if (!serPort.IsOpen) { // start querying ConnectionCheck = new Thread(() => fConnectionCheck(ipd)); ConnectionCheck.Start(); } DataSend = new Thread(() => fDataSend(ref blackPixels, dataSendArgs)); AnimationSend = new Thread(() => fAnimationSend(ref blackPixels, animSendArgs)); Bitmap clock = ita.Properties.Resources.clock; cArgs = new clockArgs(false, false, ref clock); ProcessClock = new Thread(() => fprocessClock(cArgs)); ProcessClock.Start(); tmrClock.Tag = cArgs; tmrClock.Interval = 500; tmrClock.Enabled = true; tmrClock.Stop(); tmr.Interval = 300; tmr.Enabled = false; }