Esempio n. 1
0
 public override void Show()
 {
     if (doc.HasLoaded)
     {
         doc.Move(Area.WindowLocation.X, Area.WindowLocation.Y);
         isShown = true;
     }
     else
     {
         showOnLoaded = true;
     }
 }
Esempio n. 2
0
        private void buttonMove_Click(object sender, EventArgs e)
        {
            if (activeDocument == null)
            {
                return;
            }

            int x = int.Parse(textBoxX.Text);
            int y = int.Parse(textBoxY.Text);

            activeDocument.Move(x, y);
        }
Esempio n. 3
0
        private void PerformLoad()
        {
            if (File == null)
            {
                throw new InvalidOperationException("file has not been set");
            }

            try
            {
                doc        = PowerpointViewerController.Open(this.File.FullName, new Rectangle(Area.WindowLocation.X, Area.WindowLocation.Y, Area.WindowSize.Width, Area.WindowSize.Height), openHidden: true, thumbnailWidth: 200);
                doc.Error += (sender, args) =>
                {
                    if (!doc.HasLoaded)
                    {
                        Controller.Dispatcher.Invoke(new Action(() => OnLoaded(false)));
                    }
                    else
                    {
                        base.OnClosedExternally();
                    }
                };

                doc.Loaded += (sender, args) =>
                {
                    Controller.Dispatcher.Invoke(new Action(() =>
                    {
                        if (!isClosing)
                        {
                            WordsLive.Presentation.Wpf.Interop.RemoveFromAeroPeek(doc.WindowHandle);
                            if (showOnLoaded)
                            {
                                doc.Move(Area.WindowLocation.X, Area.WindowLocation.Y);
                                isShown = true;
                            }
                            OnLoaded(true);
                            Controller.FocusMainWindow(true);
                        }
                        else
                        {
                            doc.Close();
                        }
                    }));
                };

                doc.Closed += (sender, args) =>
                {
                    if (!isClosing)
                    {
                        base.OnClosedExternally();
                    }
                };

                doc.SlideChanged += (sender, args) =>
                {
                    base.OnSlideIndexChanged();
                };

                doc.HiddenSlide += (sender, args) =>
                {
                    Controller.Dispatcher.Invoke(new Action(() =>
                    {
                        if (!hasShownHiddenWarning)
                        {
                            MessageBox.Show(Resource.slideErrorMsgHiddenSlides, Resource.slideErrorMsgHiddenSlidesTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                            hasShownHiddenWarning = true;
                        }
                    }));
                };

                LoadPreviewProvider();
            }
            catch (PowerpointViewerController.PowerpointViewerOpenException)
            {
                Controller.Dispatcher.Invoke(new Action(() =>
                {
                    OnLoaded(false);
                }));
            }
        }