/// <summary>
        /// Handles the Click event of the uxImport control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void uxImport_Click(object sender, EventArgs e)
        {
            if (this.uxImportDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string filePath in this.uxImportDialog.FileNames)
                {
                    var args = new NewTextureReferenceEventArgs(filePath);

                    this.NewTextureReferenceHandler(this, args);

                    if (args.AddedTextureReference != null)
                    {
                        var texRef = args.AddedTextureReference;

                        Image image = Image.FromFile(texRef.FilePath, true);

                        this.uxTextureImageList.Images.Add(texRef.GetAssetName(), image.GetThumbnailImage(128, 128, null, IntPtr.Zero));

                        ListViewItem item = new ListViewItem
                        {
                            Text        = texRef.GetAssetName(),
                            ImageIndex  = this.uxTextureImageList.Images.IndexOfKey(texRef.GetAssetName()),
                            ToolTipText = texRef.FilePath,
                            Tag         = texRef
                        };

                        this.uxTextureReferences.Items.Add(item);
                    }
                }
            }
        }
Exemple #2
0
        protected virtual void OnTextureReferenceAdded(NewTextureReferenceEventArgs e)
        {
            Trace.WriteLine("User requires adding a texture reference...", "UI");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Filepath: " + e.FilePath);
            }

            using (new HourglassCursor())
            {
                var handler = Interlocked.CompareExchange(ref this.TextureReferenceAdded, null, null);

                if (handler != null)
                {
                    handler.Invoke(this, e);
                }
            }

            this.AssertOperationOK(e.Result);
        }
Exemple #3
0
        /// <summary>
        /// Handles the TextureReferenceAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewTextureReferenceEventArgs"/> instance containing the event data.</param>
        private void Interface_TextureReferenceAdded(object sender, NewTextureReferenceEventArgs e)
        {
            Trace.WriteLine("Adding new texture reference...", "CORE");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Filepath: " + e.FilePath);
            }

            try
            {
                TextureReference reference = new TextureReference(e.FilePath);

                e.AddedTextureReference = reference;

                this.TextureReferences.Add(reference);

                e.Result = CoreOperationResult.OK;
            }
            catch (Exception error)
            {
                e.Result = new CoreOperationResult(error);
            }
        }
Exemple #4
0
        protected virtual void OnTextureReferenceAdded(NewTextureReferenceEventArgs e)
        {
            Trace.WriteLine("User requires adding a texture reference...", "UI");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Filepath: " + e.FilePath);
            }

            using (new HourglassCursor())
            {
                var handler = Interlocked.CompareExchange(ref this.TextureReferenceAdded, null, null);

                if (handler != null)
                    handler.Invoke(this, e);
            }

            this.AssertOperationOK(e.Result);
        }
Exemple #5
0
        /// <summary>
        /// Handles the TextureReferenceAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewTextureReferenceEventArgs"/> instance containing the event data.</param>
        private void Interface_TextureReferenceAdded(Object sender, NewTextureReferenceEventArgs e)
        {
            Trace.WriteLine("Adding new texture reference...", "CORE");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Filepath: " + e.FilePath);
            }

            try
            {
                TextureReference reference = new TextureReference(e.FilePath);

                e.AddedTextureReference = reference;

                this.TextureReferences.Add(reference);

                e.Result = CoreOperationResult.OK;
            }
            catch (Exception error)
            {
                e.Result = new CoreOperationResult(error);
            }
        }
 protected virtual void OnTextureReferenceAdded(NewTextureReferenceEventArgs e)
 {
     if (this.TextureReferenceAdded != null)
         this.TextureReferenceAdded(this, e);
 }
Exemple #7
0
        /// <summary>
        /// Handles the TextureReferenceAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewTextureReferenceEventArgs"/> instance containing the event data.</param>
        private void Interface_TextureReferenceAdded(object sender, NewTextureReferenceEventArgs e)
        {
            TextureReference reference = new TextureReference(e.FilePath);

            e.AddedTextureReference = reference;

            this.TextureReferences.Add(reference);
        }
        /// <summary>
        /// Handles the Click event of the uxImport control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void uxImport_Click(object sender, EventArgs e)
        {
            if (this.uxImportDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string filePath in this.uxImportDialog.FileNames)
                {
                    var args = new NewTextureReferenceEventArgs(filePath);

                    this.NewTextureReferenceHandler(this, args);

                    if (args.AddedTextureReference != null)
                    {
                        var texRef = args.AddedTextureReference;

                        Image image = Image.FromFile(texRef.FilePath, true);

                        this.uxTextureImageList.Images.Add(texRef.GetAssetName(), image.GetThumbnailImage(128, 128, null, IntPtr.Zero));

                        ListViewItem item = new ListViewItem
                        {
                            Text = texRef.GetAssetName(),
                            ImageIndex = this.uxTextureImageList.Images.IndexOfKey(texRef.GetAssetName()),
                            ToolTipText = texRef.FilePath,
                            Tag = texRef
                        };

                        this.uxTextureReferences.Items.Add(item);
                    }
                }
            }
        }