コード例 #1
0
        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler                                                              //
        ///////////////////////////////////////////////////////////////////////////////
        #region EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for UI, Menu, Buttons, Toolbars etc.                         //
        ///////////////////////////////////////////////////////////////////////////////
        #region WINDOWSEVENTHANDLER
        #endregion //WINDOWSEVENTHANDLER

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for Custom Defined Events                                    //
        ///////////////////////////////////////////////////////////////////////////////
        #region CUSTOMEVENTHANDLER
        #endregion //CUSTOMEVENTHANDLER

        #endregion //EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Methods and Eventhandling for Background tasks                            //
        ///////////////////////////////////////////////////////////////////////////////
        #region BACKGROUNDWORKER
        #endregion //BACKGROUNDWORKER

        ///////////////////////////////////////////////////////////////////////////////
        // Methods for doing main class job                                          //
        ///////////////////////////////////////////////////////////////////////////////
        #region METHODS

        /// <summary>
        /// This method updates the given element with the new resources path
        /// </summary>
        /// <param name="newResourcesPath">The new resource path</param>
        /// <param name="element">The <see cref="VGElement"/> to update.</param>
        private static void UpdateElement(string newResourcesPath, VGElement element)
        {
            // check all element for sounds
            if (element.Sound == null)
            {
                element.Sound = new AudioFile();
            }

            if (element.Sound.Filename != null)
            {
                if (element.Sound.Filename.Contains(@"\"))
                {
                    element.Sound.Filename = System.IO.Path.GetFileName(element.Sound.Filename);
                }

                element.Sound.Filepath = newResourcesPath;
            }

            // check file based elements
            if (element is VGScrollImage)
            {
                var scrollImage = (VGScrollImage)element;
                if (scrollImage.Filepath != newResourcesPath)
                {
                    scrollImage.Filename = System.IO.Path.GetFileName(scrollImage.Filename);
                    scrollImage.Filepath = newResourcesPath;
                    scrollImage.Canvas   = Document.ActiveDocument.PresentationSize;
                }

                scrollImage.CreateInternalImage();
            }
            else if (element is VGImage)
            {
                VGImage image = (VGImage)element;
                if (image.Filepath != newResourcesPath)
                {
                    image.Filename = System.IO.Path.GetFileName(image.Filename);
                    image.Filepath = newResourcesPath;
                    image.Canvas   = Document.ActiveDocument.PresentationSize;
                    image.CreateInternalImage();
                }
            }
            else if (element is VGFlash)
            {
                VGFlash flash = (VGFlash)element;
                if (flash.Filepath != newResourcesPath)
                {
                    flash.Filename = System.IO.Path.GetFileName(flash.Filename);
                    flash.Filepath = newResourcesPath;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// <see cref="Control.TextChanged"/> event handler for the
 /// <see cref="TextBox"/> <see cref="txbImageFilename"/>.
 /// Updates the image file of a selected <see cref="VGImage"/> element with the new value.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">A empty <see cref="EventArgs"/></param>
 private void txbImageFilename_TextChanged(object sender, EventArgs e)
 {
     if (this.designPicture.SelectedElement != null && !this.isInitializingSelectedShape)
     {
         if (this.designPicture.SelectedElement is VGImage)
         {
             VGImage image = (VGImage)this.designPicture.SelectedElement;
             image.Filename = Path.GetFileName(this.txbImageFilename.Text);
             image.CreateInternalImage();
             this.designPicture.DrawForeground(true);
         }
     }
 }