Пример #1
0
        /// <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);
                    }
                }
            }
        }
Пример #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);
        }
Пример #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);
            }
        }
Пример #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);
        }
Пример #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);
            }
        }
Пример #6
0
 protected virtual void OnTextureReferenceAdded(NewTextureReferenceEventArgs e)
 {
     if (this.TextureReferenceAdded != null)
         this.TextureReferenceAdded(this, e);
 }
Пример #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);
                    }
                }
            }
        }