コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: AnalogClock.cs プロジェクト: mostafamasoudi/AP97982
        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);
        }