Example #1
0
        private void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(_svgFilePath) || !File.Exists(_svgFilePath))
            {
                zoomPanControl.ContentScale = 1.0;

                if (zoomPanControl != null)
                {
                    zoomPanControl.IsMouseWheelScrollingEnabled = true;
                }

                if (string.IsNullOrWhiteSpace(_svgFilePath))
                {
                    this.UnloadDocument();
                }
            }

            try
            {
                //  DispatcherTimer setup
                if (_dispatcherTimer == null)
                {
                    _dispatcherTimer          = new DispatcherTimer();
                    _dispatcherTimer.Tick    += OnUpdateUITick;
                    _dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());
            }

            if (zoomPanControl != null && zoomPanControl.ScrollOwner == null)
            {
                if (canvasScroller != null)
                {
                    zoomPanControl.ScrollOwner = canvasScroller;
                }
            }

            if (_dispatcherTimer != null)
            {
                _dispatcherTimer.Start();
            }

            if (_mainWindow != null)
            {
                _wndOverview             = new ZoomPanOverviewWindow();
                _wndOverview.Title       = "Overview - Scrollable";
                _wndOverview.PageMode    = ZoomPanPageMode.Scrollable;
                _wndOverview.Owner       = _mainWindow;
                _wndOverview.DataContext = this;
                _wndOverview.Left        = _mainWindow.Left + _mainWindow.ActualWidth;
                _wndOverview.Top         = _mainWindow.Top + _mainWindow.ActualHeight - _wndOverview.Height;

                _wndOverview.Show();
            }
        }
Example #2
0
 private void OnPageUnloaded(object sender, RoutedEventArgs e)
 {
     if (_dispatcherTimer != null)
     {
         _dispatcherTimer.Stop();
     }
     if (_wndOverview != null)
     {
         _wndOverview.Close();
         _wndOverview = null;
     }
 }