static public void StartSlideShow(bool cheater = false)
        {
            if (cheater)
            {
                LaunchCheater();
            }

            Connection.CurrentPresentation.SlidesTotal = ppt.Slides.Count;

            if (Connection.CurrentRole == Role.Host)
            {
                ServerController.OnPresentationStart(Connection.CurrentPresentation);
            }
            else
            {
                Connection.clientConnection.ClPresentationStart(Connection.CurrentPresentation);
            }

            app.Visible     = MsoTriState.msoTrue; // Window showing
            app.WindowState = PpWindowState.ppWindowMinimized;
            SlideShowSettings sss = ppt.SlideShowSettings;

            sss.Run();

            while (app.SlideShowWindows.Count <= 0)
            {
                ;
            }

            SlideShowWindow ssw = ppt.SlideShowWindow;

            ssv = ssw.View;
        }
Esempio n. 2
0
        /// <summary>
        /// Open PPT App and opens dialog to select presentation
        /// </summary>
        /// <returns></returns>
        public bool OpenPowerPoint()
        {
            try
            {
                //Create an instance of PowerPoint.
                oPPT = new Application();
                // Show PowerPoint to the user.
                oPPT.Visible = MsoTriState.msoTrue;
                objPresSet   = oPPT.Presentations;
                OpenFileDialog Opendlg = new OpenFileDialog();

                Opendlg.Filter = "Powerpoint|*.ppt;*.pptx|All files|*.*";

                // Open file when user  click "Open" button
                if (Opendlg.ShowDialog() == true)
                {
                    string pptFilePath = Opendlg.FileName;
                    //open the presentation
                    objPres = objPresSet.Open(pptFilePath, MsoTriState.msoFalse,
                                              MsoTriState.msoTrue, MsoTriState.msoTrue);

                    objPres.SlideShowSettings.ShowPresenterView = MsoTriState.msoFalse;
                    objPres.SlideShowSettings.Run();

                    oSlideShowView = objPres.SlideShowWindow.View;
                    return(true);
                }
                return(false);
            }
            catch (Exception)
            {
                MessageBox.Show("Unable to open Power Point, please make sure you have the program installed correctly");
                return(false);
            }
        }
        /// <summary>
        /// Open PPT App and opens dialog to select presentation
        /// </summary>
        /// <returns></returns>
        public bool OpenPowerPoint()
        {
            try
            {
                //Create an instance of PowerPoint.
                oPPT = new Application();
                // Show PowerPoint to the user.
                oPPT.Visible = MsoTriState.msoTrue;
                objPresSet = oPPT.Presentations;
                OpenFileDialog Opendlg = new OpenFileDialog();

                Opendlg.Filter = "Powerpoint|*.ppt;*.pptx|All files|*.*";

                // Open file when user  click "Open" button
                if (Opendlg.ShowDialog() == true)
                {
                    string pptFilePath = Opendlg.FileName;
                    //open the presentation
                    objPres = objPresSet.Open(pptFilePath, MsoTriState.msoFalse,
                    MsoTriState.msoTrue, MsoTriState.msoTrue);

                    objPres.SlideShowSettings.ShowPresenterView = MsoTriState.msoFalse;
                    objPres.SlideShowSettings.Run();
                    
                    oSlideShowView = objPres.SlideShowWindow.View;
                    return true;
                }
                return false;
            }
            catch (Exception)
            {
                MessageBox.Show("Unable to open Power Point, please make sure you have the program installed correctly");
                return false;
            }
        }
        public SlideShowController(Application application, SpeechEngine speech, GestureEngine gesture, CueStore store)
        {
            pptApp = application;
            pptApp.SlideShowBegin += OnSlideShowBegin;
            pptApp.SlideShowEnd += OnSlideShowEnd;
            pptApp.SlideShowNextSlide += OnSlideShowNextSlide;

            detectors = new List<ISlideShowCommandDetector>();
            detectors.Add(new SpeechCommandDetector(this, speech, store));
            detectors.Add(new GestureCommandDetector(this, gesture));

            slideShowView = null;
            slideId = 0;
            step = 0;
        }
Esempio n. 5
0
        public ActionResult JazzSlideShow()
        {
            IEnumerable <JazzEvent> events = repository.GetAllJazzEvents();

            List <SlideShowView> SlideShowViews = new List <SlideShowView>();

            foreach (JazzEvent jEvent in events)
            {
                if (jEvent.PictureLocation != null)
                {
                    SlideShowView slideShowView = new SlideShowView();
                    slideShowView.BandName    = jEvent.JazzArtist;
                    slideShowView.Description = jEvent.Description;
                    slideShowView.ImageLink   = jEvent.PictureLocation;

                    SlideShowViews.Add(slideShowView);
                }
            }

            return(PartialView(SlideShowViews));
        }
Esempio n. 6
0
        public Controller(SlideShowWindow window)
        {
            view        = window.View;
            this.window = window;
            window.Application.SlideShowOnPrevious += (s) => SlideShowChanged?.Invoke(this, s);
            window.Application.SlideShowNextSlide  += (s) => SlideShowChanged?.Invoke(this, s);

            var    pageWidth  = window.Application.ActivePresentation.PageSetup.SlideWidth;
            var    pageHeight = window.Application.ActivePresentation.PageSetup.SlideHeight;
            var    screenSize = Screen.PrimaryScreen.Bounds;
            double rateWidth  = screenSize.Width / pageWidth;
            double rateHeight = screenSize.Height / pageHeight;

            if (rateWidth < rateHeight)
            {
                SlideShowMargin = new Size(0, (int)(screenSize.Height - pageHeight * rateWidth) / 2);
            }
            else
            {
                SlideShowMargin = new Size((int)(screenSize.Width - pageWidth * rateHeight) / 2, 0);
            }
        }
        private void OnSlideShowBegin(SlideShowWindow Wn)
        {
            try
            {
                foreach (ISlideShowCommandDetector detector in detectors)
                {
                    detector.Initialize();
                }

                foreach (ISlideShowCommandDetector detector in detectors)
                {
                    detector.SlideShowCommandDetected += OnSlideShowCommandDetected;
                    detector.Start();
                }
            }
            catch
            {
                ErrorHandler.ShowSlideShowModeKinectNotFoundDialog();
            }

            slideShowView = Wn.View;
            slideId = slideShowView.Slide.SlideID;
            step = 0;
        }
        private void OnSlideShowEnd(Presentation Pres)
        {
            foreach (ISlideShowCommandDetector detector in detectors)
            {
                detector.Stop();
                detector.SlideShowCommandDetected -= OnSlideShowCommandDetected;
            }

            slideShowView = null;
            slideId = 0;
            step = 0;
        }
Esempio n. 9
0
        protected override void Execute(CodeActivityContext context)
        {
            var filename      = Filename.Get(context);
            var startingslide = StartingSlide.Get(context);
            var kioskmode     = KioskMode.Get(context);
            var endingslide   = EndingSlide.Get(context);
            var advancetime   = AdvanceTime.Get(context);

            filename = Environment.ExpandEnvironmentVariables(filename);
            Application  activeObject = null;
            Presentation document     = null;

            try
            {
                activeObject = (Application)Marshal.GetActiveObject("Powerpoint.Application");
                foreach (Presentation current in activeObject.Presentations)
                {
                    if (current.FullName == filename)
                    {
                        document = current;
                        break;
                    }
                }
            }
            catch
            {
                activeObject = null;
            }
            finally
            {
                if (activeObject == null)
                {
                    activeObject = (Application)Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("91493441-5A91-11CF-8700-00AA0060263B")));
                }
                activeObject.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
            }
            if (document == null)
            {
                document = activeObject.Presentations.Open(filename);
            }
            document.Close();
            document = activeObject.Presentations.Open(filename);

            if (startingslide < 1)
            {
                startingslide = 1;
            }
            if (endingslide < 1 || endingslide > document.Slides.Count)
            {
                endingslide = document.Slides.Count;
            }
            if (kioskmode)
            {
                document.SlideShowSettings.ShowType = PpSlideShowType.ppShowTypeKiosk;
            }
            document.SlideShowSettings.ShowType    = PpSlideShowType.ppShowTypeSpeaker;
            document.SlideShowSettings.RangeType   = PpSlideShowRangeType.ppShowSlideRange;
            document.SlideShowSettings.AdvanceMode = PpSlideShowAdvanceMode.ppSlideShowManualAdvance;
            document.Slides.Range().SlideShowTransition.AdvanceTime = 0;
            document.Slides.Range().SlideShowTransition.AdvanceOnTime = Microsoft.Office.Core.MsoTriState.msoFalse;
            document.Slides.Range().SlideShowTransition.AdvanceOnClick = Microsoft.Office.Core.MsoTriState.msoTrue;
            //activeObject.ActivePresentation.Application.ActivePresentation.Slides[startingslide].Select();

            // StartingSlide does not seem to work the first time we open a powerpoint, so lets manually move forward
            document.SlideShowSettings.StartingSlide = startingslide;
            //activeObject.ActivePresentation.Application.ActiveWindow.Panes[2].Activate();


            SlideShowWindow obj          = document.SlideShowSettings.Run();
            SlideShowView   objSlideShow = document.SlideShowWindow.View;

            try
            {
                //while (objSlideShow.CurrentShowPosition < startingslide)
                //{
                //    objSlideShow.Next();
                //}
                while (objSlideShow.CurrentShowPosition < endingslide || objSlideShow.State != PpSlideShowState.ppSlideShowDone)
                {
                    if (advancetime != TimeSpan.Zero)
                    {
                        System.Threading.Thread.Sleep(advancetime);
                        objSlideShow.Next();
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(500);
                    }
                }
            }
            catch (COMException)
            {
            }
            catch (Exception)
            {
                throw;
            }
            try
            {
                if (objSlideShow != null && advancetime != TimeSpan.Zero)
                {
                    objSlideShow.Exit();
                }
            }
            catch (Exception)
            {
            }
            if (CloseAtEnd.Get(context))
            {
                try
                {
                    document.Close();
                    if (activeObject.Presentations.Count == 0)
                    {
                        activeObject.Quit();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Esempio n. 10
0
        void wm_WiimoteChanged(object sender, WiimoteChangedEventArgs e)
        {
            //Does thw wiimote use?
            if (!connectWiimoteButton.Checked)
            {
                return;
            }
            if (Globals.ThisAddIn == null)
            {
                return;
            }

            //Wiimote state
            WiimoteState ws = e.WiimoteState;

            Presentation ap = Globals.ThisAddIn.Application.ActivePresentation;

            try
            {
                if (isSlideShowMode)
                {
                    SlideShowView view = ap.SlideShowWindow.View;

                    if (ws.ButtonState.One && ws.ButtonState.Two)
                    {
                        //Exit slide show
                        view.Exit();
                    }
                    else if (ws.ButtonState.Left)
                    {
                        //Back to the slide show
                        view.Previous();
                    }
                    else if (ws.ButtonState.A)
                    {
                        //Go to the next slide
                        view.Next();
                    }
                    else if (ws.ButtonState.Home)
                    {
                        //Go to slide sorter view
                        view.Exit();
                        DocumentWindow aw = Globals.ThisAddIn.Application.ActiveWindow;
                        aw.ViewType = PpViewType.ppViewSlideSorter;
                    }
                }
                else if (Globals.ThisAddIn.Application.ActiveWindow.ViewType == PpViewType.ppViewSlideSorter)
                {
                    DocumentWindow aw = Globals.ThisAddIn.Application.ActiveWindow;

                    //If slide sorter view
                    if (ws.ButtonState.Up)
                    {
                        SendKeys.SendWait("{UP}");
                    }
                    else if (ws.ButtonState.Down)
                    {
                        SendKeys.SendWait("{down}");
                    }
                    else if (ws.ButtonState.Left)
                    {
                        SendKeys.SendWait("{LEFT}");
                    }
                    else if (ws.ButtonState.Right)
                    {
                        SendKeys.SendWait("{RIGHT}");
                    }
                    else if (ws.ButtonState.Home)
                    {
                        aw.ViewType = PpViewType.ppViewNormal;
                    }
                    else if (ws.ButtonState.A)
                    {
                        showPresentationFromSelection();
                    }
                    else if (ws.ButtonState.Minus)
                    {
                        //Scalling down
                        int current = aw.View.Zoom;
                        if (0 < current - 10)
                        {
                            aw.View.Zoom = current - 10;
                        }
                    }
                    else if (ws.ButtonState.Plus)
                    {
                        //Scalling up
                        int current = aw.View.Zoom;

                        if (current + 10 <= 100)
                        {
                            aw.View.Zoom = current + 10;
                        }
                        else if (current + 10 > 100)
                        {
                            aw.View.Zoom = 100;
                        }
                    }
                }
                else
                {
                    DocumentWindow aw          = Globals.ThisAddIn.Application.ActiveWindow;
                    int            currentPage = aw.Selection.SlideRange.SlideIndex;

                    //Normal view mode
                    if (ws.ButtonState.Up)
                    {
                        if (1 < currentPage)
                        {
                            ap.Slides.Range(currentPage - 1).Select();
                        }
                    }
                    else if (ws.ButtonState.Down)
                    {
                        if (currentPage < ap.Slides.Count)
                        {
                            ap.Slides.Range(currentPage + 1).Select();
                        }
                    }
                    else if (ws.ButtonState.A)
                    {
                        showPresentationFromSelection();
                    }
                    else if (ws.ButtonState.Home)
                    {
                        aw.ViewType = PpViewType.ppViewSlideSorter;
                    }
                }
            }
            catch (COMException ce)
            {
                Console.WriteLine(ce.StackTrace);
            }

            refreshBattery(ws);
        }