Example #1
0
        private void ImageMover(object sender)
        {
            GunaButton c = (GunaButton)sender;

            SlidePicture.Location = new Point(c.Location.X + 27, c.Location.Y - 8);
            SlidePicture.SendToBack();
        }
Example #2
0
    /// <summary>
    /// Method to do the work of actually loading the image from file. This method
    /// should only be used by the prefetching thread.
    /// </summary>
    public void LoadNextSlideThread()
    {
        try
        {
            Debug.Assert(Thread.CurrentThread == _prefetchingThread);

            lock (_slidesLock)
            {
                NeededSlide = new SlidePicture(_neededSlideFilePath, false);
            }

            lock (_prefetchingThreadLock)
            {
                _prefetchingThread = null;
            }
        }
        catch (ThreadAbortException ex)
        {
            Log.Debug("SlideCache: LoadNextSlideThread {0}", ex.Message);
            // abort is expected when slide changes outpace prefetch, ignore
            // Trace.WriteLine(String.Format("  ...aborted {0} slide {1}", _neededSlideRelativeIndex.ToString("G"), System.IO.Path.GetFileNameWithoutExtension(_neededSlideFilePath)));
        }
        catch (Exception ex)
        {
            Log.Error("SlideCache: LoadNextSlideThread {0}", ex.Message);
        }
    }
Example #3
0
        public override IShape Create(OpenXmlCompositeElement pShapeTreeChild, SCSlide slide)
        {
            P.Picture pPicture;
            if (pShapeTreeChild is P.Picture treePic)
            {
                pPicture = treePic;
            }
            else
            {
                var framePic = pShapeTreeChild.Descendants <P.Picture>().FirstOrDefault();
                pPicture = framePic;
            }

            if (pPicture != null)
            {
                var pBlipFill    = pPicture.GetFirstChild <P.BlipFill>();
                var blipRelateId = pBlipFill?.Blip?.Embed?.Value;
                if (blipRelateId == null)
                {
                    return(null);
                }

                var spContext = _shapeContextBuilder.Build(pShapeTreeChild);
                var picture   = new SlidePicture(slide, blipRelateId, spContext, pPicture);

                return(picture);
            }

            return(Successor?.Create(pShapeTreeChild, slide));
        }
Example #4
0
 private void SignInButton_Click_1(object sender, EventArgs e)
 {
     USERsignPANEL.SignupPanel.Visible  = false;
     USERsignPANEL.signupButton.Visible = false;
     addusercontrol(USERsignPANEL, panel3);
     gunaButton2.Enabled   = true;
     SlidePicture.Location = SlidePicture.Location = new Point(gunaButton2.Location.X + 27, gunaButton2.Location.Y - 8);
     SlidePicture.SendToBack();
 }
Example #5
0
  public SlidePicture GetCurrentSlide(string slideFilePath)
  {
    // wait for any (needed) prefetching to complete
    lock (_prefetchingThreadLock)
    {
      bool itemFiles = File.Exists(slideFilePath);

      if (!itemFiles)
      {
        CurrentSlide = new SlidePicture(slideFilePath, false);
        return CurrentSlide;
      }

      if (_prefetchingThread != null)
      {
        // only wait for the prefetching if it is for the slide file that we need
        if (_neededSlideFilePath == slideFilePath)
        {
          _prefetchingThread.Priority = ThreadPriority.AboveNormal;
        }
        else
        {
          // uneeded, abort
          _prefetchingThread.Abort();
          _prefetchingThread = null;
        }
      }
    }

    while (_prefetchingThread != null)
    {
      GUIWindowManager.Process();
    }

    lock (_slidesLock)
    {
      // try and use pre-fetched slide if appropriate
      if (NextSlide != null && NextSlide.FilePath == slideFilePath)
      {
        return NextSlide;
      }
      else if (PrevSlide != null && PrevSlide.FilePath == slideFilePath)
      {
        return PrevSlide;
      }
      else if (CurrentSlide != null && CurrentSlide.FilePath == slideFilePath)
      {
        return CurrentSlide;
      }
      else
      {
        // slide is not in cache, so get it now
        CurrentSlide = new SlidePicture(slideFilePath, false);
        return CurrentSlide;
      }
    }
  }
Example #6
0
    public SlidePicture GetCurrentSlide(string slideFilePath)
    {
        // wait for any (needed) prefetching to complete
        lock (_prefetchingThreadLock)
        {
            bool itemFiles = File.Exists(slideFilePath);

            if (!itemFiles)
            {
                CurrentSlide = new SlidePicture(slideFilePath, false);
                return(CurrentSlide);
            }

            if (_prefetchingThread != null)
            {
                // only wait for the prefetching if it is for the slide file that we need
                if (_neededSlideFilePath == slideFilePath)
                {
                    _prefetchingThread.Priority = ThreadPriority.AboveNormal;
                }
                else
                {
                    // uneeded, abort
                    _prefetchingThread.Abort();
                    _prefetchingThread = null;
                }
            }
        }

        while (_prefetchingThread != null)
        {
            GUIWindowManager.Process();
        }

        lock (_slidesLock)
        {
            // try and use pre-fetched slide if appropriate
            if (NextSlide != null && NextSlide.FilePath == slideFilePath)
            {
                return(NextSlide);
            }
            else if (PrevSlide != null && PrevSlide.FilePath == slideFilePath)
            {
                return(PrevSlide);
            }
            else if (CurrentSlide != null && CurrentSlide.FilePath == slideFilePath)
            {
                return(CurrentSlide);
            }
            else
            {
                // slide is not in cache, so get it now
                CurrentSlide = new SlidePicture(slideFilePath, false);
                return(CurrentSlide);
            }
        }
    }
Example #7
0
    public void PrefetchNextSlide(string prevPath, string currPath, string nextPath)
    {
        lock (_prefetchingThreadLock)
        {
            // assume that any incomplete prefetching is uneeded, abort
            if (_prefetchingThread != null)
            {
                _prefetchingThread.Abort();
                _prefetchingThread = null;
            }
        }

        lock (_slidesLock)
        {
            // shift slides and determine _neededSlideRelativeIndex
            if (NextSlide != null && NextSlide.FilePath == currPath)
            {
                PrevSlide                 = CurrentSlide;
                CurrentSlide              = NextSlide;
                _neededSlideFilePath      = nextPath;
                _neededSlideRelativeIndex = RelativeIndex.Next;
            }
            else if (PrevSlide != null && PrevSlide.FilePath == currPath)
            {
                NextSlide                 = CurrentSlide;
                CurrentSlide              = PrevSlide;
                _neededSlideFilePath      = prevPath;
                _neededSlideRelativeIndex = RelativeIndex.Prev;
            }
            else
            {
                // may need all 3, but just get next
                _neededSlideFilePath      = nextPath;
                _neededSlideRelativeIndex = RelativeIndex.Next;
            }
        }

        lock (_prefetchingThreadLock)
        {
            _prefetchingThread = new Thread(LoadNextSlideThread);
            _prefetchingThread.IsBackground = true;
            _prefetchingThread.Name         = "PicPrefetch";
            //string cacheString = String.Format("cache:{0}|{1}|{2} ",
            //  _slides[0] != null ? "1" : "0",
            //  _slides[1] != null ? "1" : "0",
            //  _slides[2] != null ? "1" : "0");
            //Trace.WriteLine(cacheString + String.Format("prefetching {0} slide {1}", _neededSlideRelativeIndex.ToString("G"), System.IO.Path.GetFileNameWithoutExtension(_neededSlideFilePath)));
            _prefetchingThread.Start();
        }
    }
Example #8
0
    public void InvalidateSlide(string slideFilePath)
    {
        lock (_slidesLock)
        {
            for (int i = 0; i < _slides.Length; i++)
            {
                SlidePicture slide = _slides[i];
                if (slide != null && slide.FilePath == slideFilePath)
                {
                    _slides[i] = null;
                }
            }
        }

        // Note that we could pre-fetch the invalidated slide, but if the new version
        // of the slide is going to be requested immediately (as with DoRotate) then
        // pre-fetching won't help.
    }
 private void PushCurrentTextureToBackground()
 {
   if (null != _backgroundSlide)
   {
     //_backgroundSlide.Texture.Dispose();
     _backgroundSlide = null;
   }
   _backgroundSlide = _currentSlide;
   _zoomFactorBackground = _currentZoomFactor;
   _zoomLeftBackground = _currentZoomLeft;
   _zoomTopBackground = _currentZoomTop;
   _zoomTypeBackground = _currentZoomType;
   _currentSlide = null;
   _slideTime = (int)(DateTime.Now.Ticks / 10000);
 }
 private void LoadRawPictureThread()
 {
   // load picture
   string slideFilePath = _slideList[_currentSlideIndex];
   _backgroundSlide = new SlidePicture(slideFilePath, true);
   ResetCurrentZoom(_backgroundSlide);
   _isLoadingRawPicture = false;
 }
    private void DoRotate(int degrees)
    {
      GUIPictures.DoRotatePicture(_backgroundSlide.FilePath, degrees);

      InvalidateSlide(_backgroundSlide.FilePath);

      if (null != _currentSlide)
      {
        //_currentSlide.Texture.Dispose();
        _currentSlide = null;
      }
      if (_backgroundSlide == null || _backgroundSlide.FilePath.Length == 0)
      {
        return;
      }

      LoadCurrentSlide();

      //int iMaxWidth = GUIGraphicsContext.OverScanWidth;
      //int iMaxHeight = GUIGraphicsContext.OverScanHeight;
      //int X, Y;
      //_currentTexture = MediaPortal.Util.Picture.Load(_backgroundSlideFileName, _rotation, iMaxWidth, iMaxHeight, true, true, out X, out Y);
      //_currentSlide.Width = X;
      //_currentSlide.Height = Y;
      //_currentSlideFileName = _backgroundSlideFileName;
      //_zoomFactorBackground = _defaultZoomFactor;
      //_kenBurnsEffect = 0;
      //_userZoomLevel = 1.0f;
      //_isPictureZoomed = false;
      //_zoomLeft = 0;
      //_zoomTop = 0;
      //_slideTime = (int)(DateTime.Now.Ticks / 10000);
      //_frameCounter = 0;
      _transitionMethod = 9;
    }
    private void ResetCurrentZoom(SlidePicture slide)
    {
      _kenBurnsEffect = 0;
      _currentZoomFactor = 1.0f;
      _currentZoomLeft = 0;
      _currentZoomTop = 0;
      _zoomInfoVisible = false;

      CalculateBestZoom(slide.Width, slide.Height);
    }
Example #13
0
 public void StartSlideShow(string path)
 {
   LoadSettings();
   _isBackgroundMusicPlaying = false;
   StartBackgroundMusic(path);
   GUIPictureSlideShow._slideDirection = 1;
   _isSlideShow = true;
   if (_autoShuffle && (_isSlideShow || _showRecursive))
   {
     Shuffle(false, false);
     // Reset currentSlideIndex when slideshow start from context menu
     _currentSlideIndex = 0;
     _currentSlide = _slideCache.GetCurrentSlide(_slideList[_currentSlideIndex]);
   }
 }
Example #14
0
  public void PrefetchNextSlide(string prevPath, string currPath, string nextPath)
  {
    lock (_prefetchingThreadLock)
    {
      // assume that any incomplete prefetching is uneeded, abort
      if (_prefetchingThread != null)
      {
        _prefetchingThread.Abort();
        _prefetchingThread = null;
      }
    }

    lock (_slidesLock)
    {
      // shift slides and determine _neededSlideRelativeIndex
      if (NextSlide != null && NextSlide.FilePath == currPath)
      {
        PrevSlide = CurrentSlide;
        CurrentSlide = NextSlide;
        _neededSlideFilePath = nextPath;
        _neededSlideRelativeIndex = RelativeIndex.Next;
      }
      else if (PrevSlide != null && PrevSlide.FilePath == currPath)
      {
        NextSlide = CurrentSlide;
        CurrentSlide = PrevSlide;
        _neededSlideFilePath = prevPath;
        _neededSlideRelativeIndex = RelativeIndex.Prev;
      }
      else
      {
        // may need all 3, but just get next
        _neededSlideFilePath = nextPath;
        _neededSlideRelativeIndex = RelativeIndex.Next;
      }
    }

    lock (_prefetchingThreadLock)
    {
      _prefetchingThread = new Thread(LoadNextSlideThread);
      _prefetchingThread.IsBackground = true;
      _prefetchingThread.Name = "PicPrefetch";
      //string cacheString = String.Format("cache:{0}|{1}|{2} ",
      //  _slides[0] != null ? "1" : "0",
      //  _slides[1] != null ? "1" : "0",
      //  _slides[2] != null ? "1" : "0");
      //Trace.WriteLine(cacheString + String.Format("prefetching {0} slide {1}", _neededSlideRelativeIndex.ToString("G"), System.IO.Path.GetFileNameWithoutExtension(_neededSlideFilePath)));
      _prefetchingThread.Start();
    }
  }
    public void Reset()
    {
      _slideList.Clear();
      _infoVisible = false;
      _zoomInfoVisible = false;
      _isSlideShow = false;
      _isPaused = false;
      _loadVideoPlayback = false;
      _zoomFactorBackground = _defaultZoomFactor;
      _currentZoomFactor = _defaultZoomFactor;
      _kenBurnsEffect = 0;
      //_isPictureZoomed = false;
      _currentZoomLeft = 0;
      _currentZoomTop = 0;
      _currentZoomLeft = 0;
      _currentZoomTop = 0;
      _frameCounter = 0;
      _currentSlideIndex = -1;
      _lastSlideShown = -1;
      _slideTime = 0;
      _userZoomLevel = 1.0f;
      _lastSegmentIndex = -1;

      if (null != _backgroundSlide)
      {
        //_backgroundSlide.Texture.Dispose();
        _backgroundSlide = null;
      }

      if (null != _currentSlide)
      {
        //_currentSlide.Texture.Dispose();
        _currentSlide = null;
      }

      if (_isBackgroundMusicPlaying)
      {
        g_Player.Stop();
      }
    }
Example #16
0
  /// <summary>
  /// Method to do the work of actually loading the image from file. This method
  /// should only be used by the prefetching thread.
  /// </summary>
  public void LoadNextSlideThread()
  {
    try
    {
      Debug.Assert(Thread.CurrentThread == _prefetchingThread);

      lock (_slidesLock)
      {
        NeededSlide = new SlidePicture(_neededSlideFilePath, false);
      }

      lock (_prefetchingThreadLock)
      {
        _prefetchingThread = null;
      }
    }
    catch (ThreadAbortException)
    {
      // abort is expected when slide changes outpace prefetch, ignore
      // Trace.WriteLine(String.Format("  ...aborted {0} slide {1}", _neededSlideRelativeIndex.ToString("G"), System.IO.Path.GetFileNameWithoutExtension(_neededSlideFilePath)));
    }
    catch (Exception) {}
  }
Example #17
0
        /// <summary>
        /// PPT产生缩略图
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="previewPath"></param>
        /// <returns></returns>
        private static bool GetThumbnailPpt(string filePath, string previewPath)
        {
            bool         result = false;
            Presentation ppt    = new Presentation();

            try
            {
                ppt.LoadFromFile(filePath);
                if (ppt.Slides.Count > 0)
                {
                    //生成图片
                    foreach (IShape s in ppt.Slides[0].Shapes)
                    {
                        if (s is SlidePicture)
                        {
                            SlidePicture ps = s as SlidePicture;
                            ps.PictureFill.Picture.EmbedImage.Image.Save(previewPath);
                            if (File.Exists(previewPath))
                            {
                                result = true;
                            }
                            ps.Dispose();
                        }
                        if (s is PictureShape)
                        {
                            PictureShape ps = s as PictureShape;
                            ps.EmbedImage.Image.Save(previewPath);
                            if (File.Exists(previewPath))
                            {
                                result = true;
                            }
                        }
                    }

                    if (!result)
                    {
                        string temImage = Path.GetDirectoryName(previewPath) + "\\" + Guid.NewGuid().ToString() + ".emf";
                        ppt.Slides[0].SaveAsEMF(temImage);
                        Image image = Bitmap.FromFile(temImage);
                        image.Save(previewPath);
                        image.Dispose();
                        File.Delete(temImage);
                        if (File.Exists(previewPath))
                        {
                            result = true;
                        }
                    }

                    if (!result)
                    {
                        result = GetThumbnailWritten("PPT", previewPath);
                    }
                }
                ppt.Dispose();
            }
            catch
            {
                ppt.Dispose();
                result = GetThumbnailWritten("PPT", previewPath);
            }


            return(result);
        }