private void _UpdateDocumentPreview()
        {
            m_SupplementLayout.LoadFile(CurrentLayout);

            var sp = new SupplementPainter(MainWindow.DpiY, mainWindow.DisciplineLabels);

            //sp.LayoutProperties = m_LayoutLoader.LoadLayout(CurrentLayout, LayoutProperties.GetConfigFilename(CurrentSide));
            sp.LayoutProperties        = m_SupplementLayout.GetProperties(CurrentSide);
            sp.IsSkipEmplyLines        = mainWindow.IsSkipEmplyLines.IsChecked == true;
            sp.IsAssessmentsOnLastLine = mainWindow.IsAssessmentsOnLastLine.IsChecked == true;
            sp.IsHorizontalInnings     = mainWindow.IsHorizontalInnings.IsChecked == true;

            m_DrawingVisual = sp.DrawSupplement(CurrentStudent, (LayoutSide)CurrentSide);

            var horizontalBorderHeight = SystemParameters.ResizeFrameHorizontalBorderHeight;
            var verticalBorderWidth    = SystemParameters.ResizeFrameVerticalBorderWidth;
            var captionHeight          = SystemParameters.CaptionHeight;

            var px = mainWindow.IsHorizontalInnings.IsChecked.Value ?
                     MainWindow.CentimeterToPixel(sp.DocumentSize.X, sp.DocumentSize.Y) :
                     MainWindow.CentimeterToPixel(sp.DocumentSize.Y, sp.DocumentSize.X);

            documentViewer.Width  = px.X + verticalBorderWidth;
            documentViewer.Height = px.Y + captionHeight + horizontalBorderHeight;

            Document = XpsDocumentPainter.PaintDrawingVisual(m_DrawingVisual, new PageMediaSize(px.X, px.Y));
        }
        public LayoutWindow(SupplementLayout layout, LayoutSide layoutSide)
        {
            instance           = this;
            m_SupplementLayout = layout;
            LayoutProperties   = layout.GetProperties(layoutSide);

            CurrentLayout     = LayoutProperties.Name;
            CurrentLayoutSide = layoutSide;

            var m_piSize = MainWindow.CentimeterToPixel(LayoutProperties.Size.X, LayoutProperties.Size.Y);

            //m_LayoutLoader = new LayoutLoader();

            InitializeComponent();

            Canvas.SetLeft(ImageBackground, LayoutProperties.Offset.X * MainWindow.DpiX / 2.54d / 100d);
            Canvas.SetTop(ImageBackground, LayoutProperties.Offset.Y * MainWindow.DpiY / 2.54d / 100d);

            SetWindowSize((int)m_piSize.X, (int)m_piSize.Y, WindowStyle != System.Windows.WindowStyle.None);

            Task.Factory.StartNew(new Action(() =>
            {
                Dispatcher.Invoke(new MakeLayoutLoad(LoadLayout), new object[] { LayoutProperties });
            }));
        }
        private void MenuItemReloadLayout_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show("Not implemented!", "Notice", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            //m_LayoutLoader.LoadLayoutAsync(LayoutProperties.Name, LayoutProperties.ConfigFile);
            //LayoutProperties = m_LayoutLoader.LoadLayout(LayoutProperties.Name, LayoutProperties.ConfigFile);

            m_SupplementLayout.LoadFile(CurrentLayout);
            LayoutProperties = m_SupplementLayout.GetProperties(CurrentLayoutSide);

            var m_piSize = MainWindow.CentimeterToPixel(LayoutProperties.Size.X, LayoutProperties.Size.Y);

            Canvas.SetLeft(ImageBackground, LayoutProperties.Offset.X * MainWindow.DpiX / 2.54d / 100d);
            Canvas.SetTop(ImageBackground, LayoutProperties.Offset.Y * MainWindow.DpiY / 2.54d / 100d);

            SetWindowSize((int)m_piSize.X, (int)m_piSize.Y, WindowStyle != System.Windows.WindowStyle.None);

            LoadLayout(LayoutProperties);
        }