public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); currentTime = new DateTime(); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); colorBackground = Color.Black; colorForeground = Color.White; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); // start our update timer ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); currentTime = new DateTime(); colorForeground = new Color(); colorBackground = new Color(); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; panelWidth = screenWidth - (MARGIN_PANEL_EDGE * 2); panelHeight = (screenHeight - ((MARGIN_PANEL_EDGE * 2) + MARGIN_PANEL_PANEL)) / 2; panelCenterX = panelWidth / 2; _bmpwork = new Bitmap(panelWidth, panelHeight); displayMode = DISPLAY_MODE_WHITE; colorForeground = Color.Black; colorBackground = Color.White; currentTime = DateTime.Now; currentH = currentTime.Hour; currentM = currentTime.Minute; oldH = currentH; oldM = currentM; UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); dueTimeFlip = new TimeSpan(0, 0, 0, 0, 0); periodFlip = new TimeSpan(0, 0, 0, 0, 100); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _bmpFace = new Bitmap(Resources.GetBytes(Resources.BinaryResources.BeardFace), Bitmap.BitmapImageType.Gif); _bmpHourHand = new Bitmap(Resources.GetBytes(Resources.BinaryResources.BeardLeft), Bitmap.BitmapImageType.Gif); _bmpMinuteHand = new Bitmap(Resources.GetBytes(Resources.BinaryResources.BeardRight), Bitmap.BitmapImageType.Gif); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); colorForeground = new Color(); colorBackground = new Color(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; hourHandWidth = _bmpHourHand.Width; hourHandHeight = _bmpHourHand.Height; minuteHandWidth = _bmpMinuteHand.Width; minuteHandHeight = _bmpMinuteHand.Height; _bmpRotateHourHand = new Bitmap(hourHandWidth, hourHandHeight); _bmpRotateMinuteHand = new Bitmap(minuteHandWidth, minuteHandHeight); displayMode = DISPLAY_MODE_WHITE; blackOrWhite = BLACK; SetDisplayMode(displayMode); showDigital = false; currentTime = new DateTime(); UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; diskRadius = screenWidth / DISK_RATIO; displayMode = DISPLAY_MODE_BLACK; colorForeground = Color.White; colorBackground = Color.Black; colorDisk = Color.Black; showDigital = false; currentTime = new DateTime(); currentTime = DateTime.Now; _random = new Random(currentTime.Millisecond); _point.X = screenCenterX; _point.Y = screenCenterY; randomDegree = 0; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 0, 0, MOVE_INTERVAL); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); bmpRotate = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); bmpHandBlack = new Bitmap(Resources.GetBytes(Resources.BinaryResources.NumeralHandBlack), Bitmap.BitmapImageType.Gif); bmpHandWhite = new Bitmap(Resources.GetBytes(Resources.BinaryResources.NumeralHandWhite), Bitmap.BitmapImageType.Gif); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; displayMode = DISPLAY_MODE_BLACK; showDate = false; colorForeground = Color.White; colorBackground = Color.Black; showDigital = false; currentTime = new DateTime(); currentTime = DateTime.Now; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); colorForeground = new Color(); colorBackground = new Color(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; fontWidth = fontIPAexGothicKansuji05.CharWidth('零'); fontHeight = fontIPAexGothicKansuji05.Height; marginX = (screenWidth - (fontWidth * 13) - (MARGIN_NUMBER_NUMBER_X * 4)) / 2; marginY = (screenHeight - (fontHeight * 5)) / 2; displayMode = DISPLAY_MODE_BLACK_12; SetDisplayMode(displayMode); showDigital = false; currentTime = new DateTime(); UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); colorForeground = new Color(); colorBackground = new Color(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; gapX = (screenWidth - (SIZE_HOLE * 6)) / 5; gapY = (screenHeight - (SIZE_HOLE * 10)) / 9; margineX = (screenWidth - ((SIZE_HOLE * 6) + (gapX * 5))) / 2; margineY = (screenHeight - ((SIZE_HOLE * 10) + (gapY * 9))) / 2; displayMode = DISPLAY_MODE_BLACK_CIRCLE_12; SetDisplayMode(displayMode); showDigital = false; currentTime = new DateTime(); UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 0, 1, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; circleRadius = screenCenterX - MARGIN_CIRCLE_EDGE; showHourCounter = 0; radiusHour = 0; showMinuteCounter = 0; radiusMinute = 0; displayMode = DISPLAY_MODE_BLACK; SetDisplayMode(); showDigital = false; currentTime = new DateTime(); currentTime = DateTime.Now; _random = new Random(currentTime.Millisecond); UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; displayMode = DISPLAY_MODE_WHITE; isPeep = false; //displayMode = DISPLAY_MODE_PEEP_WHITE; //isPeep = true; showDate = false; colorForeground = Color.Black; colorBackground = Color.White; showDigital = false; currentTime = new DateTime(); currentTime = DateTime.Now; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; distanceOuterCircle = screenCenterX - MARGIN_OUTER_CIRCLE_EDGE; distanceInnerCircle = screenCenterX - (MARGIN_OUTER_CIRCLE_EDGE + THICKNESS_CIRCLE + MARGIN_INNER_CIRCLE_OUTER_CIRCLE); displayMode = DISPLAY_MODE_BLACK; SetDisplayMode(displayMode); showDigital = false; currentTime = new DateTime(); oldM = -1; UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 0, 1, 0); //dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); //period = new TimeSpan(0, 0, 1, 0, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _background = new Bitmap(Resources.GetBytes(Resources.BinaryResources.football), Bitmap.BitmapImageType.Gif); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; backgroundWidth = _background.Width; backgroundHeight = _background.Height; displayMode = DISPLAY_MODE_BLACK_FRAHAND; SetDisplayMode(displayMode); showDigital = false; currentTime = new DateTime(); UpdateTime(null); //dueTime = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); //period = new TimeSpan(0, 0, 0, 1, 0); dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _background = new Bitmap(Resources.GetBytes(Resources.BinaryResources.SpinningDiskBackground), Bitmap.BitmapImageType.Gif); currentTime = new DateTime(); colorForeground = new Color(); colorBackground = new Color(); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; backgroundWidth = _background.Width; backgroundHeight = _background.Height; colorForeground = Color.Black; colorBackground = Color.White; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); currentTime = new DateTime(); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; radius = screenCenterX - radiusMod; displayMode = DISPLAY_MODE_WHITE; //displayMode = DISPLAY_MODE_BLACK; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; squareCornerX = screenCenterX - (WIDTH_SQUARE / 2); squareCornerY = screenHeight - (HEIGHT_SQUARE + MARGIN_SQUARE_EDGE); currentTime = new DateTime(); currentTime = DateTime.Now; displayMode = DISPLAY_MODE_BLACK; SetDisplayMode(); showDigital = false; UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 0, 0, MILLISECOND_UPDATE); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; colorForeground = Color.Black; colorBackground = Color.Black; colorDisk = Color.White; showDigital = false; currentTime = new DateTime(); currentTime = DateTime.Now; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
private static void DrawWatchfaceBase() { _display.Clear(); _display.DrawRectangle(colorBackground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 255); _display.DrawLine(colorForeground, 1, screenCenterX, 0, 0, screenHeight / 5); _display.DrawLine(colorForeground, 1, 0, screenHeight / 5, ROOF_EDGE_WIDTH, screenHeight / 5); _display.DrawLine(colorForeground, 1, ROOF_EDGE_WIDTH, screenHeight / 5, ROOF_EDGE_WIDTH, screenHeight - BASE_HEIGHT); _display.DrawLine(colorForeground, 1, ROOF_EDGE_WIDTH, screenHeight - BASE_HEIGHT, 0, screenHeight - BASE_HEIGHT); _display.DrawLine(colorForeground, 1, screenCenterX, 0, screenWidth, screenHeight / 5); _display.DrawLine(colorForeground, 1, screenWidth, screenHeight / 5, screenWidth - ROOF_EDGE_WIDTH, screenHeight / 5); _display.DrawLine(colorForeground, 1, screenWidth - ROOF_EDGE_WIDTH, screenHeight / 5, screenWidth - ROOF_EDGE_WIDTH, screenHeight - BASE_HEIGHT); _display.DrawLine(colorForeground, 1, screenWidth - ROOF_EDGE_WIDTH, screenHeight - BASE_HEIGHT, screenWidth, screenHeight - BASE_HEIGHT); _azmdrawing.FillArea(_display, colorForeground, 0, 0); _azmdrawing.FillArea(_display, colorForeground, screenWidth - 1, 0); _azmdrawing.FillArea(_display, colorForeground, 0, screenHeight - BASE_HEIGHT - 1); _azmdrawing.FillArea(_display, colorForeground, screenWidth - 1, screenHeight - BASE_HEIGHT - 1); _display.SetPixel(screenCenterX, 0, colorBackground); for (int i = 1; i <= 3; i++) { _display.SetPixel(screenCenterX - i, 0, colorForeground); _display.SetPixel(screenCenterX + i, 0, colorForeground); } _display.DrawEllipse(colorForeground, 1, diskCenterX, diskCenterY, diskRadius, diskRadius, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM, diskRadius - MARGIN_DISK_RIM, colorBackground, 0, 0, colorBackground, 0, 0, 255); _display.DrawEllipse(colorForeground, 1, diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - MARGIN_DISK_NUMBER, diskRadius - MARGIN_DISK_RIM - MARGIN_DISK_NUMBER, colorForeground, 0, 0, colorForeground, 0, 0, 255); /* for (int i = 1; i <= 12; i++) { _azmdrawing.DrawAngledLine(_display, colorForeground, 1, (30 / 2) + (30 * i), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - MARGIN_DISK_NUMBER, MARGIN_DISK_NUMBER + 2); } */ for (int i = 1; i < 3; i++) { _point = _azmdrawing.FindPointDegreeDistance((30 * i), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2) + 1); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * i), _point.X, _point.Y, i.ToString()); } for (int i = 3; i < 4; i++) { _point = _azmdrawing.FindPointDegreeDistance((30 * i), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2)); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * i), _point.X, _point.Y, i.ToString()); } for (int i = 4; i < 6; i++) { _point = _azmdrawing.FindPointDegreeDistance((30 * i), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2) + 1); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * i), _point.X, _point.Y, i.ToString()); } for (int i = 6; i < 7; i++) { _point = _azmdrawing.FindPointDegreeDistance((30 * i), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2) ); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * i), _point.X, _point.Y, i.ToString()); } for (int i = 7; i < 9; i++) { _point = _azmdrawing.FindPointDegreeDistance((30 * i), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2) + 1); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * i), _point.X, _point.Y, i.ToString()); } for (int i = 9; i < 10; i++) { _point = _azmdrawing.FindPointDegreeDistance((30 * i), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2)); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * i), _point.X, _point.Y, i.ToString()); } _point = _azmdrawing.FindPointDegreeDistance((30 * 10), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2) + 1); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * 10), _point.X, _point.Y, "A"); _point = _azmdrawing.FindPointDegreeDistance((30 * 11), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2) + 1); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * 11), _point.X, _point.Y, "B"); _point = _azmdrawing.FindPointDegreeDistance((30 * 12), diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - (MARGIN_DISK_NUMBER / 2)); _azmdrawing.DrawStringAngled(_display, colorForeground, fontRomenNumerals06, (30 * 12), _point.X, _point.Y, "C"); _display.DrawEllipse(colorBackground, 1, diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - MARGIN_DISK_NUMBER - MARGIN_DISK_RIM, diskRadius - MARGIN_DISK_RIM - MARGIN_DISK_NUMBER - MARGIN_DISK_RIM, colorBackground, 0, 0, colorBackground, 0, 0, 255); DrawInitialCuckoo(); }
private static void DrawPendulum() { _display.DrawRectangle(colorBackground, 0, squareCornerX, squareCornerY, WIDTH_SQUARE, HEIGHT_SQUARE, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 255); switch(pendulumCounter) { case 0: degreePendulum = 180 - (DEGREE_SWING * 2); break; case 1: degreePendulum = 180 - (DEGREE_SWING * 1); break; case 2: degreePendulum = 180; break; case 3: degreePendulum = 180 + (DEGREE_SWING * 1); break; case 4: degreePendulum = 180 + (DEGREE_SWING * 2); break; case 5: degreePendulum = 180 + (DEGREE_SWING * 2); break; case 6: degreePendulum = 180 + (DEGREE_SWING * 2); break; case 7: degreePendulum = 180 + (DEGREE_SWING * 1); break; case 8: degreePendulum = 180; break; case 9: degreePendulum = 180 - (DEGREE_SWING * 1); break; case 10: degreePendulum = 180 - (DEGREE_SWING * 2); break; case 11: degreePendulum = 180 - (DEGREE_SWING * 2); break; } _azmdrawing.DrawAngledLine(_display, colorForeground, THIKNESS_PENDULUM, degreePendulum, screenCenterX, MARGIN_CIRCLE_EDGE + RADIUS_CIRCLE, 0, LENGTH_PENDULUM, 0); _point = _azmdrawing.FindPointDegreeDistance(degreePendulum, screenCenterX, MARGIN_CIRCLE_EDGE + RADIUS_CIRCLE, LENGTH_PENDULUM); _display.DrawEllipse(colorForeground, 0, _point.X, _point.Y, RADIUS_PENDULUM, RADIUS_PENDULUM, colorForeground, 0, 0, colorForeground, 0, 0, 255); if (simpleMode == false) { _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_PENDULUM - 2, RADIUS_PENDULUM - 2, colorBackground, 0, 0, colorBackground, 0, 0, 0); } _display.DrawRectangle(colorBackground, 1, squareCornerX, squareCornerY, WIDTH_SQUARE, HEIGHT_SQUARE, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 0); if(11 <= pendulumCounter) { pendulumCounter = 0; } else { pendulumCounter++; } }
static void UpdateTime(object state) { currentTime = DateTime.Now; _display.Clear(); if (showDigital == false) { degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); degreeS = _azmdrawing.SecondToAngle(currentTime.Second); _display.DrawRectangle(colorBackground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 255); ringRadius = screenCenterX - MARGIN_RING_EDGE; ringX = screenCenterX; ringY = screenCenterY; _display.DrawEllipse(colorForeground, 1, ringX, ringY, ringRadius, ringRadius, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, ringX, ringY, ringRadius - THICKNESS_RING, ringRadius - THICKNESS_RING, colorBackground, 0, 0, colorBackground, 0, 0, 255); for (int i = 1; i <= 12; i++) { _point = _azmdrawing.FindPointDegreeDistance(((30 * i) - degreeH + 360) % 360, ringX, ringY, ringRadius - (THICKNESS_RING / 2)); _azmdrawing.DrawStringAngled(_display, colorBackground, fontIPAexGothic08Bold, ((30 * i) - degreeH + 360) % 360, _point.X, _point.Y, i.ToString()); } ringRadius = ringRadius - THICKNESS_RING - MARGIN_RING_RING - MOD_RING; ringX = screenWidth - (MARGIN_RING_EDGE + THICKNESS_RING + MARGIN_RING_RING + ringRadius); ringY = screenHeight - (MARGIN_RING_EDGE + THICKNESS_RING + MARGIN_RING_RING + ringRadius); _display.DrawEllipse(colorForeground, 1, ringX, ringY, ringRadius, ringRadius, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, ringX, ringY, ringRadius - THICKNESS_RING, ringRadius - THICKNESS_RING, colorBackground, 0, 0, colorBackground, 0, 0, 255); for (int i = 0; i < 60; i++) { if (i % 15 == 0) { _point = _azmdrawing.FindPointDegreeDistance(((6 * i) - degreeM + 360) % 360, ringX, ringY, ringRadius - (THICKNESS_RING / 2)); _azmdrawing.DrawStringAngled(_display, colorBackground, fontIPAexGothic08Bold, ((6 * i) - degreeM + 360) % 360, _point.X, _point.Y, i.ToString("D2")); } else if (i % 5 == 0) { _point = _azmdrawing.FindPointDegreeDistance(((6 * i) - degreeM + 360) % 360, ringX, ringY, ringRadius - (THICKNESS_RING / 2) + 2); _display.DrawEllipse(colorBackground, _point.X, _point.Y, 1, 1); } } ringRadius = ringRadius - THICKNESS_RING - MARGIN_RING_RING - MOD_RING; ringX = screenWidth - (MARGIN_RING_EDGE + THICKNESS_RING + MARGIN_RING_RING + +THICKNESS_RING + MARGIN_RING_RING + ringRadius); ringY = screenHeight - (MARGIN_RING_EDGE + THICKNESS_RING + MARGIN_RING_RING + +THICKNESS_RING + MARGIN_RING_RING + ringRadius); _display.DrawEllipse(colorForeground, 1, ringX, ringY, ringRadius, ringRadius, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, ringX, ringY, ringRadius - THICKNESS_RING + 3, ringRadius - THICKNESS_RING + 3, colorBackground, 0, 0, colorBackground, 0, 0, 255); _azmdrawing.DrawAngledLine(_display, colorBackground, THICKNESS_GAP, degreeS, ringX, ringY, ringRadius - THICKNESS_RING - 1, THICKNESS_RING + 3); /* radiusRing = screenCenterX - MARGIN_RING_EDGE; _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, radiusRing - THICKNESS_RING, radiusRing - THICKNESS_RING, colorBackground, 0, 0, colorBackground, 0, 0, 1); radiusRing = radiusRing - THICKNESS_RING - MARGIN_RING_RING - MOD_RING; _display.DrawEllipse(colorBackground, 1, screenWidth - (MARGIN_RING_EDGE + THICKNESS_RING + MARGIN_RING_RING + radiusRing), screenHeight - (MARGIN_RING_EDGE + THICKNESS_RING + MARGIN_RING_RING + radiusRing), radiusRing - THICKNESS_RING, radiusRing - THICKNESS_RING, colorBackground, 0, 0, colorBackground, 0, 0, 1); */ } else { _azmdrawing.DrawDigitalClock(_display, Color.White, Color.Black, font7barPBd24, currentTime, true); ++showDigitalCounter; if (showDigitalCounter > SHOW_DIGITAL_SECOND) { showDigital = false; showDigitalCounter = 0; } } _display.Flush(); }
static void UpdateTime(object state) { currentTime = DateTime.Now; if (showDigital == false) { degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); degreeS = _azmdrawing.SecondToAngle(currentTime.Second); _display.Clear(); _display.DrawRectangle(colorBackground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 255); if (displayMode == DISPLAY_MODE_BLACK_DISK || displayMode == DISPLAY_MODE_WHITE_DISK) { _display.DrawEllipse(colorDisk, 1, _point.X, _point.Y, diskRadius, diskRadius, colorDisk, 0, 0, colorDisk, 0, 0, 255); } else if (displayMode == DISPLAY_MODE_BLACK || displayMode == DISPLAY_MODE_WHITE) { _display.DrawEllipse(colorForeground, 1, _point.X, _point.Y, diskRadius, diskRadius, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, diskRadius - THIKNESS_RIM, diskRadius - THIKNESS_RIM, colorBackground, 0, 0, colorBackground, 0, 0, 255); } _azmdrawing.DrawAngledLine(_display, colorForeground, THICKNESS_HOUR_HAND, degreeH, _point.X, _point.Y, 0, diskRadius - (THIKNESS_RIM + LENGTH_HOUR_HAND_MOD)); _azmdrawing.DrawAngledLine(_display, colorForeground, THICKNESS_MINUTE_HAND, degreeM, _point.X, _point.Y, 0, diskRadius - (THIKNESS_RIM + LENGTH_MINUTE_HAND_MOD)); _azmdrawing.DrawAngledLine(_display, colorForeground, THICKNESS_SECOND_HAND, degreeS, _point.X, _point.Y, 0, diskRadius - (THIKNESS_RIM + LENGTH_SECOND_HAND_MOD)); _display.DrawEllipse(colorForeground, 1, _point.X, _point.Y, RADIUS_OUTER_PIN, RADIUS_OUTER_PIN, colorForeground, 0, 0, colorForeground, 0, 0, 255); if (displayMode == DISPLAY_MODE_BLACK_DISK || displayMode == DISPLAY_MODE_WHITE_DISK) { _display.DrawEllipse(colorDisk, 1, _point.X, _point.Y, RADIUS_INNER_PIN, RADIUS_INNER_PIN, colorDisk, 0, 0, colorDisk, 0, 0, 255); } else if (displayMode == DISPLAY_MODE_BLACK || displayMode == DISPLAY_MODE_WHITE) { _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_INNER_PIN, RADIUS_INNER_PIN, colorBackground, 0, 0, colorBackground, 0, 0, 255); } randomDegree = _random.Next(360); _point = _azmdrawing.FindPointDegreeDistance(randomDegree, _point.X, _point.Y, MOVE_DISTANCE); if (_point.X - diskRadius < 0) { _point.X = diskRadius; } if (_point.Y - diskRadius < 0) { _point.Y = diskRadius; } if (screenWidth - 1 < _point.X + diskRadius) { _point.X = screenWidth - 1 - diskRadius; } if (screenHeight - 1 < _point.Y + diskRadius) { _point.Y = screenHeight - 1 - diskRadius; } } else { _azmdrawing.DrawDigitalClock(_display, Color.White, Color.Black, font7barPBd24, currentTime, true); ++showDigitalCounter; if (showDigitalCounter > SHOW_DIGITAL_SECOND) { showDigital = false; showDigitalCounter = 0; } } _display.Flush(); }
static void UpdateTime(object state) { if (showDigital != true) { currentTime = DateTime.Now; _display.Clear(); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute) - degreeM; if (degreeM == 0) { _display.DrawImage(1, 1, _background, 0, 0, backgroundWidth, backgroundHeight); _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, DISK_RADIUS - 3, DISK_RADIUS - 3, colorBackground, 0, 0, colorBackground, 0, 0, 0); _display.DrawEllipse(colorForeground, 2, screenCenterX, screenCenterY, DISK_RADIUS, DISK_RADIUS, colorForeground, 0, 0, colorForeground, 0, 0, 0); } else { _display.RotateImage(360 - degreeM, 1, 1, _background, 0, 0, backgroundWidth, backgroundHeight, 255); _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, DISK_RADIUS - 3, DISK_RADIUS - 3, colorBackground, 0, 0, colorBackground, 0, 0, 0); _display.DrawEllipse(colorForeground, 2, screenCenterX, screenCenterY, DISK_RADIUS, DISK_RADIUS, colorForeground, 0, 0, colorForeground, 0, 0, 0); } _point = _azmdrawing.FindPointDegreeDistance(degreeH + 180, screenCenterX, screenCenterY, LENGTH_HOUR_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorForeground, THICKNESS_HOUR_HAND, degreeH, _point.X, _point.Y, 0, LENGTH_HOUR_HAND + LENGTH_HOUR_HAND_TAIL); _point = _azmdrawing.FindPointDegreeDistance(180, screenCenterX, screenCenterY, LENGTH_MINUTE_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorForeground, THICKNESS_MINUTE_HAND, 0, _point.X, _point.Y, 0, LENGTH_MINUTE_HAND + LENGTH_MINUTE_HAND_TAIL); _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, 2, 2, colorBackground, 0, 0, colorBackground, 0, 0, 255); _display.DrawEllipse(colorForeground, 1, screenCenterX, screenCenterY, 1, 1, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.Flush(); } }
static void UpdateTime(object state) { currentTime = DateTime.Now; if (showDigital == false) { _display.Clear(); _display.DrawImage(0, 0, _background, 0, 0, backgroundWidth, backgroundHeight); degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); _point = _azmdrawing.FindPointDegreeDistance((degreeM + 180) % 360, screenCenterX, screenCenterY, LENGTH_MINUTE_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorHand, THICKNESS_MINUTE_HAND, degreeM, _point.X, _point.Y, 0, LENGTH_MINUTE_HAND + LENGTH_MINUTE_HAND_TAIL, 6); _point = _azmdrawing.FindPointDegreeDistance((degreeH + 180) % 360, screenCenterX, screenCenterY, LENGTH_HOUR_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorHand, THICKNESS_HOUR_HAND, degreeH, _point.X, _point.Y, 0, LENGTH_HOUR_HAND + LENGTH_HOUR_HAND_TAIL, 6); _display.DrawEllipse(colorPin, 1, screenCenterX, screenCenterY, RADIUS_PIN, RADIUS_PIN, colorPin, 0, 0, colorPin, 0, 0, 255); } else { _azmdrawing.DrawDigitalClock(_display, Color.White, Color.Black, font7barPBd24, currentTime, true); ++showDigitalCounter; if (showDigitalCounter > SHOW_DIGITAL_SECOND) { showDigital = false; showDigitalCounter = 0; } } _display.Flush(); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _cuckooFrames = new Bitmap(Resources.GetBytes(Resources.BinaryResources.CuckooFrame), Bitmap.BitmapImageType.Gif); currentTime = new DateTime(); colorForeground = new Color(); colorBackground = new Color(); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; diskCenterX = screenCenterX; diskRadius = (screenHeight - (MARGIN_CUCKOO_TOP + CUCKOO_HEIGHT + MARGIN_CUCKOO_BOTTOM + MARGIN_DISK_BOTTOM)) / 2; diskCenterY = screenHeight - MARGIN_DISK_BOTTOM - diskRadius - 1; displayMode = DISPLAY_MODE_WHITE_POINT; handType = HAND_TYPE_POINT; colorForeground = Color.Black; colorBackground = Color.White; cuckooFrame = 0; DrawWatchfaceBase(); currentTime = DateTime.Now; if (currentTime.Hour % 12 != 0) { newH = currentTime.Hour % 12; } else { newH = 12; } oldH = newH; UpdateTime(null); currentTime = DateTime.Now; dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeCuckoo = new TimeSpan(0, 0, 0, 0, 0); periodCuckoo = new TimeSpan(0, 0, 0, 0, 150); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
static void UpdateTime(object state) { currentTime = DateTime.Now; _display.Clear(); if (showDigital == false) { degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); degreeS = _azmdrawing.SecondToAngle(currentTime.Second); if (displayMode == DISPLAY_MODE_BLACK || displayMode == DISPLAY_MODE_WHITE) { _display.DrawRectangle(colorForeground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorForeground, 0, 0, colorForeground, 0, 0, 255); _point = _azmdrawing.FindPointDegreeDistance(315, screenCenterX, screenCenterY, MARGIN_CENTER_WINDOW + WINDOW_WIDTH); _corner0 = _azmdrawing.FindPointDegreeDistance(315 - 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)) ; _corner1 = _azmdrawing.FindPointDegreeDistance(315 + 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)); _point = _azmdrawing.FindPointDegreeDistance(315, screenCenterX, screenCenterY, MARGIN_CENTER_WINDOW + 1); _corner2 = _azmdrawing.FindPointDegreeDistance(315 - 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)); _corner3 = _azmdrawing.FindPointDegreeDistance(315 + 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)); _display.DrawLine(colorBackground, 1, _corner0.X, _corner0.Y, _corner2.X, _corner2.Y); _display.DrawLine(colorBackground, 1, _corner2.X, _corner2.Y, _corner3.X, _corner3.Y); _display.DrawLine(colorBackground, 1, _corner3.X, _corner3.Y, _corner1.X, _corner1.Y); _display.DrawLine(colorBackground, 1, _corner1.X, _corner1.Y, _corner0.X, _corner0.Y); _point = _azmdrawing.FindPointDegreeDistance(315, screenCenterX, screenCenterY, MARGIN_CENTER_WINDOW + (WINDOW_WIDTH / 2)); _azmdrawing.FillArea(_display, colorBackground, _point.X, _point.Y); _point = _azmdrawing.FindPointDegreeDistance(135, screenCenterX, screenCenterY, MARGIN_CENTER_WINDOW + WINDOW_WIDTH); _corner0 = _azmdrawing.FindPointDegreeDistance(135 - 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)); _corner1 = _azmdrawing.FindPointDegreeDistance(135 + 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)); _point = _azmdrawing.FindPointDegreeDistance(135, screenCenterX, screenCenterY, MARGIN_CENTER_WINDOW + 1); _corner2 = _azmdrawing.FindPointDegreeDistance(135 - 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)); _corner3 = _azmdrawing.FindPointDegreeDistance(135 + 90, _point.X, _point.Y, (WINDOW_HEIGHT / 2)); _display.DrawLine(colorBackground, 1, _corner0.X, _corner0.Y, _corner2.X, _corner2.Y); _display.DrawLine(colorBackground, 1, _corner2.X, _corner2.Y, _corner3.X, _corner3.Y); _display.DrawLine(colorBackground, 1, _corner3.X, _corner3.Y, _corner1.X, _corner1.Y); _display.DrawLine(colorBackground, 1, _corner1.X, _corner1.Y, _corner0.X, _corner0.Y); _point = _azmdrawing.FindPointDegreeDistance(135, screenCenterX, screenCenterY, MARGIN_CENTER_WINDOW + (WINDOW_WIDTH / 2)); _azmdrawing.FillArea(_display, colorBackground, _point.X, _point.Y); _azmdrawing.DrawAngledLine(_display, colorBackground, 2, 45, screenCenterX + 1, screenCenterY, 3, 1); _azmdrawing.DrawAngledLine(_display, colorBackground, 2, 225, screenCenterX + 1, screenCenterY, 3, 1); } else if (displayMode == DISPLAY_MODE_BLACK_TRANSPARENT || displayMode == DISPLAY_MODE_WHITE_TRANSPARENT) { _display.DrawRectangle(colorBackground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 255); } _display.DrawEllipse(colorForeground, 1, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, RADIUS_OUTER_DISK, RADIUS_OUTER_DISK, colorForeground, 0, 0, colorForeground, 0, 0, 0); _display.DrawEllipse(colorForeground, 1, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, RADIUS_INNER_DISK, RADIUS_INNER_DISK, colorForeground, 0, 0, colorForeground, 0, 0, 0); _display.DrawEllipse(colorForeground, 1, screenWidth - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), screenHeight - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), RADIUS_OUTER_DISK, RADIUS_OUTER_DISK, colorForeground, 0, 0, colorForeground, 0, 0, 0); _display.DrawEllipse(colorForeground, 1, screenWidth - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), screenHeight - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), RADIUS_INNER_DISK, RADIUS_INNER_DISK, colorForeground, 0, 0, colorForeground, 0, 0, 0); if (displayMode == DISPLAY_MODE_BLACK_TRANSPARENT || displayMode == DISPLAY_MODE_WHITE_TRANSPARENT) { _display.DrawEllipse(colorForeground, 1, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, RADIUS_CENTER_HOLE, RADIUS_CENTER_HOLE, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorForeground, 1, screenWidth - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), screenHeight - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), RADIUS_CENTER_HOLE, RADIUS_CENTER_HOLE, colorForeground, 0, 0, colorForeground, 0, 0, 255); _azmdrawing.FillArea(_display, colorForeground, 0, 0); _azmdrawing.FillArea(_display, colorForeground, screenWidth - 1, screenHeight - 1); _display.DrawRectangle(colorForeground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorForeground, 0, 0, colorForeground, 0, 0, 0); } for (int i = 0; i < 3; i++) { //degreeNum = 270 + 45 + (60 * i) - (60 * (currentTime.Minute % 10) / 10); degreeNum = 90 + 45 + (120 * i); _point = _azmdrawing.FindPointDegreeDistance(degreeNum % 360, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, RADIUS_INNER_DISK - (fontNinaB.Height / 2) - OFFSET_NUMBER); _azmdrawing.DrawStringAngled(_display, colorForeground, fontNinaB, (degreeNum - 90) % 360, _point.X, _point.Y, ((((currentTime.Hour / 10 + i) % 10) + 3) % 3).ToString()); } for (int i = 0; i < 10; i++) { degreeNum = 90 + 45 + (36 * i); _point = _azmdrawing.FindPointDegreeDistance(degreeNum % 360, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, MARGIN_EDGE_DISK + RADIUS_OUTER_DISK, RADIUS_INNER_DISK + (RADIUS_OUTER_DISK - RADIUS_INNER_DISK) - (fontNinaB.Height / 2) - OFFSET_NUMBER); _azmdrawing.DrawStringAngled(_display, colorForeground, fontNinaB, (degreeNum - 90) % 360, _point.X, _point.Y, ((currentTime.Hour % 10 + i) % 10).ToString()); } for (int i = 0; i < 6; i++) { //degreeNum = 270 + 45 + (60 * i) - (60 * (currentTime.Minute % 10) / 10); degreeNum = 270 + 45 + (60 * i); _point = _azmdrawing.FindPointDegreeDistance(degreeNum % 360, screenWidth - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), screenHeight - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), RADIUS_INNER_DISK + (RADIUS_OUTER_DISK - RADIUS_INNER_DISK) - (fontNinaB.Height / 2) - OFFSET_NUMBER - 1); _azmdrawing.DrawStringAngled(_display, colorForeground, fontNinaB, (degreeNum + 90) % 360, _point.X, _point.Y, ((((currentTime.Minute / 10 + i) % 10) + 6) % 6).ToString()); } for (int i = 0; i < 10; i++) { degreeNum = 270 + 45 + (36 * i); _point = _azmdrawing.FindPointDegreeDistance(degreeNum % 360, screenWidth - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), screenHeight - (MARGIN_EDGE_DISK + RADIUS_OUTER_DISK), RADIUS_INNER_DISK - (fontNinaB.Height / 2) - OFFSET_NUMBER); _azmdrawing.DrawStringAngled(_display, colorForeground, fontNinaB, (degreeNum + 90) % 360, _point.X, _point.Y, ((currentTime.Minute % 10 + i) % 10).ToString()); } } else { _azmdrawing.DrawDigitalClock(_display, Color.White, Color.Black, font7barPBd24, currentTime, true); ++showDigitalCounter; if (showDigitalCounter > SHOW_DIGITAL_SECOND) { showDigital = false; showDigitalCounter = 0; } } _display.Flush(); }
static void UpdateTime(object state) { currentTime = DateTime.Now; _display.Clear(); if (showDigital == false) { degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); degreeS = _azmdrawing.SecondToAngle(currentTime.Second); _display.DrawRectangle(colorForeground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorForeground, 0, 0, colorForeground, 0, 0, 255); if (isPeep == true) { _display.DrawEllipse(colorForeground, 1, screenCenterX, screenCenterY, screenCenterX - NUMBER_MARGIN_EDGE, screenCenterY - NUMBER_MARGIN_EDGE, colorForeground, 0, 0, colorForeground, 0, 0, 255); _point = _azmdrawing.FindPointDegreeDistance(degreeH, screenCenterX, screenCenterY, LENGTH_HOUR_HAND + RADIUS_HAND_CIRCLE); _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_HAND_CIRCLE - 2, RADIUS_HAND_CIRCLE - 2, colorBackground, 0, 0, colorBackground, 0, 0, 255); _point = _azmdrawing.FindPointDegreeDistance(degreeM, screenCenterX, screenCenterY, LENGTH_MINUTE_HAND + RADIUS_HAND_CIRCLE); _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_HAND_CIRCLE - 2, RADIUS_HAND_CIRCLE - 2, colorBackground, 0, 0, colorBackground, 0, 0, 255); _azmdrawing.DrawMinuteNumbers(_display, colorForeground, fontsmall, screenCenterX - NUMBER_MARGIN_EDGE - NUMBER_MARGIN_MINUTE, 0); _azmdrawing.DrawHourNumbers(_display, colorForeground, fontsmall, screenCenterX - NUMBER_MARGIN_EDGE - NUMBER_MARGIN_MINUTE - NUMBER_MARGIN_HOUR, 0); _point = _azmdrawing.FindPointDegreeDistance(degreeH, screenCenterX, screenCenterY, LENGTH_HOUR_HAND + RADIUS_HAND_CIRCLE); _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_HAND_CIRCLE, RADIUS_HAND_CIRCLE, colorBackground, 0, 0, colorBackground, 0, 0, 0); _point = _azmdrawing.FindPointDegreeDistance(degreeM, screenCenterX, screenCenterY, LENGTH_MINUTE_HAND + RADIUS_HAND_CIRCLE); _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_HAND_CIRCLE, RADIUS_HAND_CIRCLE, colorBackground, 0, 0, colorBackground, 0, 0, 0); _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, screenCenterX - NUMBER_MARGIN_EDGE, screenCenterY - NUMBER_MARGIN_EDGE, colorBackground, 0, 0, colorBackground, 0, 0, 0); _azmdrawing.FillArea(_display, colorBackground, screenCenterX, screenCenterY); _point = _azmdrawing.FindPointDegreeDistance(degreeH, screenCenterX, screenCenterY, LENGTH_HOUR_HAND + RADIUS_HAND_CIRCLE); _azmdrawing.DrawCircle(_display, colorForeground, 2, _point.X, _point.Y, RADIUS_HAND_CIRCLE, RADIUS_HAND_CIRCLE); _point = _azmdrawing.FindPointDegreeDistance(degreeM, screenCenterX, screenCenterY, LENGTH_MINUTE_HAND + RADIUS_HAND_CIRCLE); _azmdrawing.DrawCircle(_display, colorForeground, 2, _point.X, _point.Y, RADIUS_HAND_CIRCLE, RADIUS_HAND_CIRCLE); } else { _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, screenCenterX - 3, screenCenterY - NUMBER_MARGIN_EDGE, colorBackground, 0, 0, colorBackground, 0, 0, 255); _point = _azmdrawing.FindPointDegreeDistance(degreeH, screenCenterX, screenCenterY, LENGTH_HOUR_HAND + RADIUS_HAND_CIRCLE); _display.DrawEllipse(colorForeground, 1, _point.X, _point.Y, RADIUS_HAND_CIRCLE, RADIUS_HAND_CIRCLE, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_HAND_CIRCLE - 2, RADIUS_HAND_CIRCLE - 2, colorBackground, 0, 0, colorBackground, 0, 0, 255); _azmdrawing.DrawMinuteNumbers(_display, colorForeground, fontsmall, screenCenterX - NUMBER_MARGIN_EDGE - NUMBER_MARGIN_MINUTE, 0); _azmdrawing.DrawHourNumbers(_display, colorForeground, fontsmall, screenCenterX - NUMBER_MARGIN_EDGE - NUMBER_MARGIN_MINUTE - NUMBER_MARGIN_HOUR, 0); _point = _azmdrawing.FindPointDegreeDistance(degreeH, screenCenterX, screenCenterY, LENGTH_HOUR_HAND + RADIUS_HAND_CIRCLE); _azmdrawing.DrawCircle(_display, colorForeground, 2, _point.X, _point.Y, RADIUS_HAND_CIRCLE, RADIUS_HAND_CIRCLE); _point = _azmdrawing.FindPointDegreeDistance(degreeM, screenCenterX, screenCenterY, LENGTH_MINUTE_HAND + RADIUS_HAND_CIRCLE); _azmdrawing.DrawCircle(_display, colorForeground, 2, _point.X, _point.Y, RADIUS_HAND_CIRCLE, RADIUS_HAND_CIRCLE); } _point = _azmdrawing.FindPointDegreeDistance((degreeH + 180) % 360, screenCenterX, screenCenterY, LENGTH_HOUR_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorForeground, THIKNESS_HOUR_HAND, degreeH, _point.X, _point.Y, 0, LENGTH_HOUR_HAND + LENGTH_HOUR_HAND_TAIL, 0); _point = _azmdrawing.FindPointDegreeDistance((degreeM + 180) % 360, screenCenterX, screenCenterY, LENGTH_MINUTE_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorForeground, THIKNESS_MINUTE_HAND, degreeM, _point.X, _point.Y, 0, LENGTH_MINUTE_HAND + LENGTH_MINUTE_HAND_TAIL, 0); _point = _azmdrawing.FindPointDegreeDistance((degreeS + 180) % 360, screenCenterX - 1, screenCenterY - 1, LENGTH_SECOND_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorForeground, THIKNESS_SECOND_HAND, degreeS, _point.X, _point.Y, 0, LENGTH_SECOND_HAND + LENGTH_SECOND_HAND_TAIL, 0); _display.DrawEllipse(colorForeground, 1, screenCenterX - 1, screenCenterY - 1, 4, 4, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, screenCenterX - 1, screenCenterY - 1, 2, 2, colorBackground, 0, 0, colorBackground, 0, 0, 255); _display.DrawEllipse(colorForeground, 1, screenCenterX - 1, screenCenterY - 1, 1, 1, colorForeground, 0, 0, colorForeground, 0, 0, 255); if (showDate == true) { _display.DrawRectangle(colorForeground, 1, screenWidth - DATE_MARGIN - DATE_WIDTH, screenCenterY - (DATE_HEIGHT / 2), DATE_WIDTH, DATE_HEIGHT, 2, 2, colorForeground, 0, 0, colorForeground, 0, 0, 0); _display.DrawText(currentTime.Day.ToString("D2"), fontsmall, colorForeground, screenWidth - DATE_MARGIN - DATE_WIDTH + 4, screenCenterY - (DATE_HEIGHT / 2)); } } else { _azmdrawing.DrawDigitalClock(_display, Color.White, Color.Black, font7barPBd24, currentTime, true); ++showDigitalCounter; if (showDigitalCounter > SHOW_DIGITAL_SECOND) { showDigital = false; showDigitalCounter = 0; } } _display.Flush(); }
static void UpdateTime(object state) { if (showDigital == false) { currentTime = DateTime.Now; degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); _display.Clear(); _display.DrawRectangle(Color.Black, 1, 0, 0, screenWidth, screenHeight, 0, 0, Color.Black, 0, 0, Color.Black, 0, 0, 255); if (displayMode == DISPLAY_MODE_BLACK || displayMode == DISPLAY_MODE_WHITE) { _display.DrawEllipse(Color.White, 1, screenCenterX, screenCenterY, radius, radius, Color.White, 0, 0, Color.White, 0, 0, 255); _azmdrawing.DrawAngledLine(_display, Color.Black, 1, degreeH, screenCenterX, screenCenterY, 0, screenCenterX); _azmdrawing.DrawAngledLine(_display, Color.Black, 1, degreeM, screenCenterX, screenCenterY, 0, screenCenterX); if (displayMode == DISPLAY_MODE_WHITE) { _point = _azmdrawing.FindPointDegreeDistance(degreeH - 5, screenCenterX, screenCenterY, radius / 2); } else { _point = _azmdrawing.FindPointDegreeDistance(degreeH + 5, screenCenterX, screenCenterY, radius / 2); } //_display.SetPixel(_point.X, _point.Y, Color.Black); _azmdrawing.FillArea(_display, Color.Black, _point.X, _point.Y); _azmdrawing.DrawAngledLine(_display, Color.Black, 1, degreeH, screenCenterX, screenCenterY, 0, radius); _azmdrawing.DrawAngledLine(_display, Color.Black, 1, degreeM, screenCenterX, screenCenterY, 0, radius); } else { _point = _azmdrawing.FindPointDegreeDistance((degreeH + 180) % 360, screenCenterX, screenCenterY, 10); _azmdrawing.DrawAngledLine(_display, Color.White, 4, degreeH, _point.X, _point.Y, 0, radius / 5 * 3 + 10); _point = _azmdrawing.FindPointDegreeDistance((degreeM + 180) % 360, screenCenterX, screenCenterY, 10); _azmdrawing.DrawAngledLine(_display, Color.White, 4, degreeM, _point.X, _point.Y, 0, radius / 10 * 9 + 10); _display.DrawEllipse(Color.Black, 1, screenCenterX, screenCenterY, 3, 3, Color.Black, 0, 0, Color.Black, 0, 0, 255); _display.DrawEllipse(Color.White, 1, screenCenterX, screenCenterY, 1, 1, Color.White, 0, 0, Color.White, 0, 0, 255); //_display.DrawEllipse(Color.Black, 1, screenCenterX, screenCenterY, 1, 1, Color.Black, 0, 0, Color.Black, 0, 0, 255); } _display.Flush(); } }
static void UpdateTime(object state) { if (showDigital == false) { currentTime = DateTime.Now; degreeH = ((((DEGREE_METER / 12) * ((currentTime.Hour % 12))) + 180) + ((DEGREE_METER / 12) * currentTime.Minute / 60)) % 360; _display.Clear(); if (showDisk != true) { _display.DrawRectangle(colorBackground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 255); _display.DrawEllipse(colorForeground, 1, screenCenterX, screenCenterY, screenCenterX - MARGIN_DISK_EDGE, screenCenterY - MARGIN_DISK_EDGE, colorForeground, 0, 0, colorForeground, 0, 0, 0); } else { _display.DrawRectangle(colorForeground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, screenCenterX - MARGIN_DISK_EDGE, screenCenterY - MARGIN_DISK_EDGE, colorBackground, 0, 0, colorBackground, 0, 0, 255); } _display.DrawEllipse(colorForeground, 1, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK), screenCenterY - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK), colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK + THICKNESS_RED_ZONE), screenCenterY - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK + THICKNESS_RED_ZONE), colorBackground, 0, 0, colorBackground, 0, 0, 255); _azmdrawing.DrawAngledLine(_display, colorBackground, 1, (((DEGREE_METER / 12) * MIN_RED) + 180) % 360, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK + THICKNESS_RED_ZONE), THICKNESS_RED_ZONE); _azmdrawing.DrawAngledLine(_display, colorBackground, 1, (((DEGREE_METER / 12) * 12) + 180) % 360, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK + THICKNESS_RED_ZONE), THICKNESS_RED_ZONE); _point = _azmdrawing.FindPointDegreeDistance((((DEGREE_METER / 12) * 12) + 180) % 360 + 2, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK) - 2); //_display.SetPixel(_point.X, _point.Y, colorBackground); _azmdrawing.FillArea(_display, colorBackground, _point.X, _point.Y); for (int i = 0; i < (MIN_RED * DIAL_UNIT); i++) { if (i % DIAL_UNIT == 0) { _azmdrawing.DrawAngledLine(_display, colorForeground, 2, (((DEGREE_METER / 12 / DIAL_UNIT) * i) + 180) % 360, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK + THICKNESS_RED_ZONE), THICKNESS_RED_ZONE - 1); } else { _azmdrawing.DrawAngledLine(_display, colorForeground, 2, (((DEGREE_METER / 12 / DIAL_UNIT) * i) + 180) % 360, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK) - 2, 1); } } for (int i = (MIN_RED * DIAL_UNIT) + 1; i < (12 * DIAL_UNIT); i++) { if (i % DIAL_UNIT == 0) { _azmdrawing.DrawAngledLine(_display, colorBackground, 2, (((DEGREE_METER / 12 / DIAL_UNIT) * i) + 180) % 360, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK + THICKNESS_RED_ZONE), THICKNESS_RED_ZONE); } else { _azmdrawing.DrawAngledLine(_display, colorBackground, 2, (((DEGREE_METER / 12 / DIAL_UNIT) * i) + 180) % 360, screenCenterX, screenCenterY, screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK) - 2, 1); } } for (int i = 0; i <= 12; i++) { _azmdrawing.DrawStringByDegreeDistance(_display, colorForeground, fontSmall, i.ToString(), (((DEGREE_METER / 12) * i) + 180) % 360,screenCenterX - (MARGIN_DISK_EDGE + MARGIN_RED_ZONE_DISK + THICKNESS_RED_ZONE + MARGIN_HOUR_NUMBER_DIAL)); } _azmdrawing.DrawStringAligned(_display, colorForeground, fontSmall, LABEL_RPM_01, AZMDrawing.ALIGN_CENTER, MARGIN_RPM_EDGE_X, AZMDrawing.VALIGN_TOP, MARGIN_RPM_EDGE_Y); _azmdrawing.DrawStringAligned(_display, colorForeground, fontSmall, LABEL_RPM_02, AZMDrawing.ALIGN_CENTER, MARGIN_RPM_EDGE_X, AZMDrawing.VALIGN_TOP, MARGIN_RPM_EDGE_Y + (fontSmall.Height / 2) + 1); _azmdrawing.DrawStringAligned(_display, colorForeground, fontSmall, kmhMph, AZMDrawing.ALIGN_RIGHT, MARGIN_KMH_MPH_EDGE_X, AZMDrawing.VALIGN_BOTTOM, MARGIN_KMH_MPH_EDGE_Y); _point = _azmdrawing.FindPointDegreeDistance((degreeH + 180) % 360, screenCenterX, screenCenterY, LENGTH_HOUR_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorForeground, THICKNESS_HOUR_HAND, degreeH, _point.X, _point.Y, 0, LENGTH_HOUR_HAND + LENGTH_HOUR_HAND_TAIL, 1); _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, RADIUS_OUTER_PIN, RADIUS_OUTER_PIN, colorBackground, 0, 0, colorBackground, 0, 0, 255); _display.DrawEllipse(colorForeground, 1, screenCenterX, screenCenterY, RADIUS_INNER_PIN, RADIUS_INNER_PIN, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawRectangle(colorForeground, 1, screenWidth - MARGIN_MINUTE_EDGE_X - WIDTH_FRAME, screenHeight - MARGIN_MINUTE_EDGE_Y - HEIGHT_FRAME - MARGINE_MINUTE_FRAME, WIDTH_FRAME, HEIGHT_FRAME, 3, 3, colorForeground, 0, 0, colorForeground, 0, 0, 0); _azmdrawing.FillArea(_display, colorForeground, screenWidth - MARGIN_MINUTE_EDGE_X - WIDTH_FRAME + 2, screenHeight - MARGIN_MINUTE_EDGE_Y - HEIGHT_FRAME - MARGINE_MINUTE_FRAME + 2); _azmdrawing.DrawStringAligned(_display, colorBackground, font7barPBd20, "0" + currentTime.Minute.ToString("D2"), AZMDrawing.ALIGN_RIGHT, MARGIN_MINUTE_EDGE_X, AZMDrawing.VALIGN_BOTTOM, MARGIN_MINUTE_EDGE_Y); _display.Flush(); } }
private static void UpdateTime(object state) { currentTime = DateTime.Now; degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); //degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute) - (30 / 2); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); _display.DrawEllipse(colorForeground, 1, diskCenterX, diskCenterY, diskRadius - MARGIN_DISK_RIM - MARGIN_DISK_NUMBER - MARGIN_DISK_RIM - 1, diskRadius - MARGIN_DISK_RIM - MARGIN_DISK_NUMBER - MARGIN_DISK_RIM - 1, colorForeground, 0, 0, colorForeground, 0, 0, 255); if (handType == HAND_TYPE_RECT) { _point = _azmdrawing.FindPointDegreeDistance((degreeH + 180) % 360, diskCenterX, diskCenterY, LENGTH_HOUR_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorBackground, THICKNESS_HOUR_HAND, degreeH, _point.X, _point.Y, 0, LENGTH_HOUR_HAND + LENGTH_HOUR_HAND_TAIL, handType); _point = _azmdrawing.FindPointDegreeDistance((degreeM + 180) % 360, diskCenterX, diskCenterY, LENGTH_MINUTE_HAND_TAIL); _azmdrawing.DrawAngledLine(_display, colorBackground, THICKNESS_MINUTE_HAND, degreeM, _point.X, _point.Y, 0, LENGTH_MINUTE_HAND + LENGTH_MINUTE_HAND_TAIL, handType); } else { _azmdrawing.DrawAngledLine(_display, colorBackground, THICKNESS_HOUR_HAND, degreeH, diskCenterX, diskCenterY, 0, LENGTH_HOUR_HAND, handType); _azmdrawing.DrawAngledLine(_display, colorBackground, THICKNESS_HOUR_HAND, (degreeH + 180) % 360, diskCenterX, diskCenterY, 0, LENGTH_HOUR_HAND_TAIL, handType); _azmdrawing.DrawAngledLine(_display, colorBackground, THICKNESS_MINUTE_HAND, degreeM, diskCenterX, diskCenterY, 0, LENGTH_MINUTE_HAND, handType); _azmdrawing.DrawAngledLine(_display, colorBackground, THICKNESS_MINUTE_HAND, (degreeM + 180) % 360, diskCenterX, diskCenterY, 0, LENGTH_MINUTE_HAND_TAIL, handType); } _display.DrawEllipse(colorForeground, 1, diskCenterX, diskCenterY, 1, 1, colorForeground, 0, 0, colorForeground, 0, 0, 255); //_display.DrawEllipse(colorForeground, 1, diskCenterX, diskCenterY, 1, 1, colorForeground, 0, 0, colorForeground, 0, 0, 255); /* cuckooFrame = 0; cuckooX = 1 + (CUCKOO_WIDTH * cuckooFrame) + (1 * cuckooFrame); cuckooY = 1; _display.DrawImage(screenCenterX - (CUCKOO_WIDTH / 2), MARGIN_CUCKOO_TOP, _cuckooFrames, cuckooX, cuckooY, CUCKOO_WIDTH, CUCKOO_HEIGHT); */ _display.Flush(); if (currentTime.Hour % 12 != 0) { newH = currentTime.Hour % 12; } else { newH = 12; } if (oldH != newH) { oldH = newH; cuckooTimesMax = oldH; showCuckoo = true; cuckooTimes = 0; cuckooCounter = 0; cuckooFrame = 0; _updateClockTimerCuckoo = new Timer(UpdateTimeCuckoo, null, dueTimeCuckoo, periodCuckoo); } if (currentTime.Minute == 30) { cuckooTimesMax = 1; showCuckoo = true; cuckooTimes = 0; cuckooCounter = 0; cuckooFrame = 0; _updateClockTimerCuckoo = new Timer(UpdateTimeCuckoo, null, dueTimeCuckoo, periodCuckoo); } }
static void UpdateTime(object state) { currentTime = DateTime.Now; _display.Clear(); if (showDigital == false) { degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); degreeS = _azmdrawing.SecondToAngle(currentTime.Second); _display.DrawRectangle(colorForeground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorForeground, 0, 0, colorForeground, 0, 0, 255); _point.X = screenCenterX; _point.Y = screenCenterY; _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_BASE * 2, RADIUS_BASE * 2, colorBackground, 0, 0, colorBackground, 0, 0, 255); _point = _azmdrawing.FindPointDegreeDistance(degreeH, _point.X, _point.Y, (RADIUS_BASE - RADIUS_HOUR) * 2 - MARGIN_HOUR); _display.DrawEllipse(colorForeground, 1, _point.X, _point.Y, RADIUS_HOUR * 2, RADIUS_HOUR * 2, colorForeground, 0, 0, colorForeground, 0, 0, 255); _point = _azmdrawing.FindPointDegreeDistance(degreeM, _point.X, _point.Y, (RADIUS_HOUR - RADIUS_MINUTE) * 2 - MARGIN_MINUTE); _display.DrawEllipse(colorBackground, 1, _point.X, _point.Y, RADIUS_MINUTE * 2, RADIUS_MINUTE * 2, colorBackground, 0, 0, colorBackground, 0, 0, 255); _point = _azmdrawing.FindPointDegreeDistance(degreeS, _point.X, _point.Y, (RADIUS_MINUTE - RADIUS_SECOND) * 2 - MARGIN_SECOND); _display.DrawEllipse(colorForeground, 1, _point.X, _point.Y, RADIUS_SECOND * 2, RADIUS_SECOND * 2, colorForeground, 0, 0, colorForeground, 0, 0, 255); } else { _azmdrawing.DrawDigitalClock(_display, Color.White, Color.Black, font7barPBd24, currentTime, true); ++showDigitalCounter; if (showDigitalCounter > SHOW_DIGITAL_SECOND) { showDigital = false; showDigitalCounter = 0; } } _display.Flush(); }
public static void Main() { _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight); _azmdrawing = new AZMDrawing(); _point = new AGENT.AZMutil.Point(); colorForeground = new Color(); colorBackground = new Color(); screenWidth = _display.Width; screenHeight = _display.Height; screenCenterX = screenWidth / 2; screenCenterY = screenHeight / 2; //distanceDial = screenCenterX - (MARGIN_CIRCLE_EDGE + MARGIN_RED_ZONE_OUTER_CIRCLE + MARGIN_DIAL_INNER_CIRCLE); //distanceNumber = distanceDial-(LENGTH_DIAL_LONG + MARGIN_HOUR_NUMBER_DIAL); displayMode = DISPLAY_MODE_BLACK_KMH; SetDisplayMode(displayMode); showDigital = false; currentTime = new DateTime(); UpdateTime(null); dueTime = new TimeSpan(0, 0, 0, 59 - currentTime.Second, 1000 - currentTime.Millisecond); period = new TimeSpan(0, 0, 1, 0, 0); dueTimeDigital = new TimeSpan(0, 0, 0, 0, 1000 - currentTime.Millisecond); periodDigital = new TimeSpan(0, 0, 0, 1, 0); _updateClockTimer = new Timer(UpdateTime, null, dueTime, period); ButtonHelper.ButtonSetup = new Buttons[] { Buttons.BottomRight, Buttons.MiddleRight, Buttons.TopRight }; ButtonHelper.Current.OnButtonPress += Current_OnButtonPress; Thread.Sleep(Timeout.Infinite); }
static void UpdateTime(object state) { if (showDigital == false) { currentTime = DateTime.Now; degreeH = _azmdrawing.HourToAngle(currentTime.Hour, currentTime.Minute); degreeM = _azmdrawing.MinuteToAngle(currentTime.Minute); _display.Clear(); _display.DrawRectangle(colorBackground, 1, 0, 0, screenWidth, screenHeight, 0, 0, colorBackground, 0, 0, colorBackground, 0, 0, 255); radiusRing = screenCenterX - MARGIN_DISK_EDGE; _display.DrawEllipse(colorDisk, 1, screenCenterX, screenCenterY, radiusRing, radiusRing, colorDisk, 0, 0, colorDisk, 0, 0, 255); radiusRing = radiusRing - 1; _display.DrawEllipse(colorForeground, 1, screenCenterX, screenCenterY, radiusRing, radiusRing, colorForeground, 0, 0, colorForeground, 0, 0, 255); radiusRing = radiusRing - THIKNESS_RIM; _display.DrawEllipse(colorDisk, 1, screenCenterX, screenCenterY, radiusRing, radiusRing, colorDisk, 0, 0, colorDisk, 0, 0, 255); for (int i = 0; i <= 10; i++) { _display.DrawEllipse(colorForeground, 1, screenCenterX, screenCenterY, radiusRing, radiusRing, colorForeground, 0, 0, colorForeground, 0, 0, 0); radiusRing = radiusRing - MARGINE_RING_RING; } /* _point = _azmdrawing.FindPointDegreeDistance(degreeH, screenCenterX, screenCenterY, screenCenterX - MARGIN_DISK_EDGE); _display.DrawEllipse(colorForeground, _point.X, _point.Y, RADIUS_BITE, RADIUS_BITE); _point = _azmdrawing.FindPointDegreeDistance(degreeM, screenCenterX, screenCenterY, RADIUS_HOLE - (RADIUS_BITE / 2)); _display.DrawEllipse(colorForeground, _point.X, _point.Y, RADIUS_BITE, RADIUS_BITE); */ _point = _azmdrawing.FindPointDegreeDistance(degreeH, screenCenterX, screenCenterY, RADIUS_HOLE - (RADIUS_BITE / 2)); _display.DrawEllipse(colorForeground, 1, _point.X, _point.Y, RADIUS_BITE, RADIUS_BITE, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorDisk, 1, _point.X, _point.Y, RADIUS_BITE, RADIUS_BITE, colorDisk, 0, 0, colorDisk, 0, 0, 1); _point = _azmdrawing.FindPointDegreeDistance(degreeM, screenCenterX, screenCenterY, screenCenterX - MARGIN_DISK_EDGE); _display.DrawEllipse(colorForeground, 1, _point.X, _point.Y, RADIUS_BITE, RADIUS_BITE, colorForeground, 0, 0, colorForeground, 0, 0, 255); _display.DrawEllipse(colorDisk, 1, _point.X, _point.Y, RADIUS_BITE, RADIUS_BITE, colorDisk, 0, 0, colorDisk, 0, 0, 1); radiusRing = screenCenterX + THIKNESS_ERASE; _display.DrawEllipse(colorBackground, THIKNESS_ERASE + 1, screenCenterX, screenCenterY, radiusRing, radiusRing, colorBackground, 0, 0, colorBackground, 0, 0, 0); radiusRing = screenCenterX - MARGIN_DISK_EDGE + 1; _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, radiusRing, radiusRing, colorBackground, 0, 0, colorBackground, 0, 0, 1); radiusRing = RADIUS_HOLE; _display.DrawEllipse(colorBackground, 1, screenCenterX, screenCenterY, radiusRing, radiusRing, colorBackground, 0, 0, colorBackground, 0, 0, 255); _display.Flush(); } }