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); }
private void MenuItemCreateLayout_Click(object sender, RoutedEventArgs e) { MyDeskLayout.ClearLayout(); Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "My Scenario"; // Default file name dlg.DefaultExt = ".scomp"; // Default file extension dlg.Filter = "Scenario documents (.scomp)|*.scomp"; // Filter files by extension // Process save file dialog box results if (dlg.ShowDialog() == true) { ProjectFileName = dlg.FileName; m_Layout = new Layout(); m_Layout.Save(ProjectFileName); using (new WaitCursor()) { m_ComposerLayout.FrontSideLayout = new LayoutProperties(); m_ComposerLayout.RearSideLayout = new LayoutProperties(); m_ComposerLayout.FrontSideLayout.m_AudioPlayerInfo = new List <AudioPlayerInfo>(); WordDocument = ""; m_Layout.Data1 = LayoutFileReader.GetBytes(SerializeToString(m_ComposerLayout.FrontSideLayout)); m_Layout.Data2 = LayoutFileReader.GetBytes(SerializeToString(m_ComposerLayout.RearSideLayout)); m_Layout.Save(ProjectFileName); } m_IsNewProject = true; LoadProjectFileAsync(ProjectFileName); } }
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 }
private void Window_Closed(object sender, EventArgs e) { //AudioPlaybackControl[] apcs = MyDeskLayout.AudioControls.ToArray(); //for (var i = 0; i < apcs.Length; i++) //{ // apcs[i].CloseWaveOut(); //} MyDeskLayout.AudioControls.All((i) => i.Stop()); MyDeskLayout.VideoControls.All((i) => i.Stop()); MyDeskLayout.SaveProject(ProjectFileName); }
private void MainWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl) { IsCtrlDown = true; } if (m_IsSelected) { if (e.Key == Key.Delete) { if (MessageBox.Show("Delete slected item?", "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { if (m_SelectedElement is AudioPlaybackControl) { ((AudioPlaybackControl)m_SelectedElement).Stop(); } MyDeskLayout.RemoveControl(m_SelectedElement); e.Handled = true; } } } if (IsCtrlDown && e.Key == Key.O) { MenuItemOpenProject_Click(this, null); } if (IsCtrlDown && e.Key == Key.D) { MenuItemDeskWindow_Click(this, null); } if (IsCtrlDown && e.Key == Key.B) { MenuItemVideotWindow_Click(this, null); } if (IsCtrlDown && e.Key == Key.V) { var files = Clipboard.GetFileDropList(); if (files.Count == 1 && !string.IsNullOrEmpty(files[0]) && DeskLayout.IsAcceptableFile(files[0])) { MyDeskLayout.LoadFileToCanvas(files[0]); } } }
private void MenuItemCloseProject_Click(object sender, RoutedEventArgs e) { MyDeskLayout.ClearLayout(); if (m_SampleDeskWindow != null) { m_SampleDeskWindow.MyDeskLayout.ClearLayout(); } string tmp = string.Concat(System.IO.Path.GetTempPath(), "\\", Guid.NewGuid().ToString(), ".docx"); ByteArrayToFile(tmp, Properties.Resources.scenario); ReadDocx(tmp); //LoadWordDocToView(tmp); IsProjectLoaded = false; }
private void MenuItemSaveProject_Click(object sender, RoutedEventArgs e) { MyDeskLayout.SaveProject(ProjectFileName); }