示例#1
0
        private void LoadProjectFileAsync(string p)
        {
            ProjectFileName = p;
            System.Threading.Tasks.Task.Factory.StartNew(new Action(() =>
            {
                Dispatcher.Invoke(new EventHandler(SetProgressBarValue), new object[] { 10.0, null });

                m_ComposerLayout.LoadFile(ProjectFileName);

                //LayoutProperties = ReadLayoutXml(LayoutFileReader.GetString(m_Layout.Data1));
                LayoutProperties = m_ComposerLayout.FrontSideLayout;

                Dispatcher.Invoke(new EventHandler(SetProgressBarValue), new object[] { 20.0, null });

                Dispatcher.Invoke(delegate
                {
                    ReadDocx(WordDocument);

                    /*var lwdtvRes = LoadWordDocToView(WordDocument);
                     * if (lwdtvRes != 0)
                     * {
                     *  string tmp = string.Concat(System.IO.Path.GetTempPath(), "\\", Guid.NewGuid().ToString(), ".docx");
                     *  if (lwdtvRes == 2)
                     *      ByteArrayToFile(tmp, Properties.Resources.error);
                     *  if (lwdtvRes == 3)
                     *      ByteArrayToFile(tmp, Properties.Resources.scenario);
                     *
                     *  LoadWordDocToView(tmp);
                     * }*/

                    SetProgressBarValue(50.0, null);

                    MyDeskLayout.LoadLayout(m_ComposerLayout.FrontSideLayout);
                    if (m_SampleDeskWindow != null)
                    {
                        m_SampleDeskWindow.MyDeskLayout.LoadLayout(m_ComposerLayout.RearSideLayout);
                    }

                    SetProgressBarValue(85.0, null);

                    System.Threading.Tasks.Task.Factory.StartNew(new Action(() =>
                    {
                        Thread.Sleep(1000);
                        Dispatcher.Invoke(delegate
                        {
                            //var dvScrollViewer = FindVisualChild<ScrollViewer>(documentviewWord);
                            var dvScrollViewer          = FindVisualChild <ScrollViewer>(flowDocumentReader);
                            MyDeskLayout.ExpandedHeight = dvScrollViewer.ExtentHeight;

                            SetProgressBarValue(ProgressBarLoading.Maximum, null);

                            IsProjectLoaded = true;
                        });
                    }));
                });
            }));

            //if (OnSupplementLayoutLoaded != null)
            //    OnSupplementLayoutLoaded(this, EventArgs.Empty);
        }
示例#2
0
        private void ButtonPrintInfo_Click(object sender, RoutedEventArgs e)
        {
            SetVerticalOffset = 1;

            MenuItemOpenProject_Click(null, null);
            MyDeskLayout.LoadLayout(LayoutProperties);

            #region MyRegion
            //var dvScrollViewer = FindVisualChild<ScrollViewer>(screenplayRack.documentviewWord);

            //var dvsl = Canvas.GetLeft(screenplayRack.documentviewWord);   NaN
            //var dvsr = Canvas.GetRight(screenplayRack.documentviewWord);
            //Canvas.SetLeft(dvScrollViewer, dvsl);
            //Canvas.SetRight(dvScrollViewer, dvsr);



            //var height = screenplayRack.documentviewWord.Document.DocumentPaginator.PageSize.Height;

            //var dvScrollViewer = FindVisualChild<ScrollViewer>(screenplayRack.documentviewWord); ;

            //dvScrollViewer.ScrollChanged += dvScrollViewer_ScrollChanged;
            ////((Image)(myScrollViewer.Content)).Height = dvScrollViewer.ExtentHeight;
            //((Image)(ImageSpacer)).Height = dvScrollViewer.ExtentHeight;

            //Canvas.SetLeft(dvScrollViewer, Canvas.GetLeft(screenplayRack.documentviewWord));
            //Canvas.SetRight(dvScrollViewer, Canvas.GetRight(screenplayRack.documentviewWord));

            //dvScrollViewer.Height = screenplayRack.documentviewWord.ActualHeight;
            //dvScrollViewer.Width = screenplayRack.documentviewWord.ActualWidth;

            ////ImageSpacer.Height = dvScrollViewer.ActualHeight;
            ////ImageSpacer.Width = dvScrollViewer.ActualWidth;


            //var vp = FindVisualChild<ScrollViewer>(screenplayRack.documentviewWord);
            //var ccs = vp.ExtentHeight;
            //var ViewportHeight = vp.VerticalOffset;
            ////vp.CanContentScroll = false;
            ////myScrollViewer.SetCurrentValue(ScrollViewer.ViewportHeightProperty, ViewportHeight);
            ////((Image)(myScrollViewer.Content)).Height = ViewportHeight;


            //RichTextBoxInfo.AppendText("ViewportHeight: " + screenplayRack.documentviewWord.ViewportHeight); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("HorizontalOffset: " + screenplayRack.documentviewWord.HorizontalOffset); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("Height " + screenplayRack.documentviewWord.Height); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("ActualHeight: " + screenplayRack.documentviewWord.ActualHeight); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("DesiredSize: " + screenplayRack.documentviewWord.DesiredSize); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("RenderSize: " + screenplayRack.documentviewWord.RenderSize); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("VerticalOffset: " + screenplayRack.documentviewWord.VerticalOffset); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("VerticalPageSpacing: " + screenplayRack.documentviewWord.VerticalPageSpacing); RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("\n");
            //RichTextBoxInfo.AppendText("ExtentWidth: " + screenplayRack.documentviewWord.ViewportWidth);
            //RichTextBoxInfo.AppendText("\n");
            #endregion
        }