private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _graphics = new XamlGraphics (LayoutRoot);

            var timer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds (1),
            };
            timer.Tick += delegate {
                Draw ();
            };
            timer.Start ();
        }
        double Draw()
        {
            var del = Content;

            if (del == null)
            {
                return(0);
            }

            if (_graphics == null)
            {
                _graphics = new XamlGraphics(this);
            }

            var startT = DateTime.Now;

            _graphics.BeginDrawing();
            _graphics.BeginEntity(del);

            //
            // Draw
            //
            var fr = new RectangleF(0, 0, (float)ActualWidth, (float)ActualHeight);

            if (_ppi != NativePointsPerInch)
            {
                fr.Width  /= _ppi / (float)NativePointsPerInch;
                fr.Height /= _ppi / (float)NativePointsPerInch;
            }
            del.Frame = fr;
            try {
                del.Draw(_graphics);
            }
            catch (Exception) {
            }

            _graphics.EndDrawing();

            var endT = DateTime.Now;

            return((endT - startT).TotalSeconds);
        }
Beispiel #3
0
        double Draw()
        {
            var del = Content;
            if (del == null) return 0;

            if (_graphics == null) {
                _graphics = new XamlGraphics (this);
            }

            var startT = DateTime.Now;

            _graphics.BeginDrawing ();
            _graphics.BeginEntity (del);

            //
            // Draw
            //
            var fr = new RectangleF (0, 0, (float)ActualWidth, (float)ActualHeight);
            if (_ppi != NativePointsPerInch) {
                fr.Width /= _ppi / (float)NativePointsPerInch;
                fr.Height /= _ppi / (float)NativePointsPerInch;
            }
            del.Frame = fr;
            try {
                del.Draw (_graphics);
            }
            catch (Exception) {
            }

            _graphics.EndDrawing ();

            var endT = DateTime.Now;
            return (endT - startT).TotalSeconds;
        }
Beispiel #4
0
 public void ResetGraphics()
 {
     _graphics = null;
 }
 public void ResetGraphics()
 {
     _graphics = null;
 }