Example #1
0
 /// <summary>
 /// draw each element in canvas and shows the clock
 /// </summary>
 public void Draw()
 {
     ParentCanvas.Children.Add(SecondHand.GetUI());
     ParentCanvas.Children.Add(MinutesHand.GetUI());
     ParentCanvas.Children.Add(HoursHand.GetUI());
     Around.Draw();
 }
        public MainWindow()
        {
            InitializeComponent();
            MinuteHand  minuteHand = new MinuteHand(Minute, 30, 2, Brushes.DarkSalmon);
            HourHand    hourHand   = new HourHand(hour, 20, 3, Brushes.DeepPink);
            SecondHand  secondHand = new SecondHand(Second, 30, 1, Brushes.DodgerBlue);
            Ticks       ticks      = new Ticks(Brushes.IndianRed, 10, 3, test);
            Face        face       = new Face(50, Brushes.Lavender, m);
            AnalogClock clock      = new AnalogClock(50, 50, minuteHand, secondHand, hourHand, ticks, face);
            Thread      start      = new Thread(() => StartAnalogClock(clock));

            start.Start();
        }
Example #3
0
        public AnalogClock(Canvas canvasFrame, Ellipse frame, Point center)
        {
            CanvasFrame = canvasFrame;
            Frame       = frame;
            Center      = center;

            DispatcherTimer Timer = new DispatcherTimer();

            Timer.Tick    += Timer_Tick;
            Timer.Interval = new TimeSpan(0, 0, 1);
            Timer.Start();

            //Initialize FrameBorder;
            Borders = new List <FrameBorder>();
            InitializeFrameBorder();
            //Initialize SecondHand
            SecondHand = new SecondHand(1, Brushes.Black, Center, DateTime.Now.Second * 6, CanvasFrame.Width * 4 / 10);
            //Initialize MinuteHand
            MinuteHand = new MinuteHand(4, Brushes.Black, Center, (DateTime.Now.Minute * 6) + (DateTime.Now.Second / 59), CanvasFrame.Width * 4 / 11);
            //Initialize HourHand
            HourHand = new HourHand(7, Brushes.Black, Center, (DateTime.Now.Hour * 30) + (DateTime.Now.Minute * 0.5), CanvasFrame.Width * 2 / 10);

            Thread.Sleep(800);
        }