Esempio n. 1
0
        public void OnAlert(DateTime time)
        {
            // Clone window action (F5)
            if (time == DateTime.MinValue)
            {
                ClientWindow Child = new ClientWindow(child: true);
                Child.Show();
            }

            // Closing child
            else if (time == DateTime.MaxValue)
            {
                IsOriginalChild = false;
                this.Close();
            }

            // Update date/time alert
            else
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    // Draw clock image
                    Bitmap Bitmap     = DrawClockFace.DrawClockFace(time, (int)imgClock.Width, (int)imgClock.Height);
                    ImageSource Image = loadBitmap(Bitmap);
                    imgClock.Source   = Image;

                    // Display date/time string
                    txtDateTime.Text = time.ToString();
                }));
            }
        }
        private void AlertClock(DateTime time)
        {
            Bitmap clockBit = drawer.DrawClockFace(time, (int)clock_image.Width, (int)clock_image.Height);
            var    hbmp     = clockBit.GetHbitmap();
            var    options  = BitmapSizeOptions.FromEmptyOptions();

            clock_image.Source = Imaging.CreateBitmapSourceFromHBitmap(hbmp, IntPtr.Zero, Int32Rect.Empty, options);
        }