SharpFlash.cs
上传用户:lctyggxszx
上传日期:2022-06-30
资源大小:280k
文件大小:4k
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data;
- using System.Threading;
- namespace SharpFlash
- {
- /// <summary>
- /// SharpFlash GUI
- /// </summary>
- public class SharpFlash : System.Windows.Forms.Form
- {
- // :TODO: since most of the libraries
- // reference Mueller.WDDX for serializing data, it would
- // probably be best to create an instance once here, and
- // then just keep re-using that instance in every library
- // to save on memory.
-
-
- private AxShockwaveFlashObjects.AxShockwaveFlash flashApp;
-
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- public SharpFlash()
- {
- InitializeComponent();
- // register the .swf file for the active-x object
- flashApp.Movie = Application.StartupPath + "\SharpFlash.swf";
- // register the fscommand handler
- flashApp.FSCommand += new AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEventHandler(flashApp_FSCommandEventHandler);
-
- }
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if (components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows Form Designer generated code
- private void InitializeComponent()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SharpFlash));
- this.flashApp = new AxShockwaveFlashObjects.AxShockwaveFlash();
- ((System.ComponentModel.ISupportInitialize)(this.flashApp)).BeginInit();
- this.SuspendLayout();
- //
- // flashApp
- //
- this.flashApp.Enabled = true;
- this.flashApp.Location = new System.Drawing.Point(0, 0);
- this.flashApp.Name = "flashApp";
- this.flashApp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("flashApp.OcxState")));
- this.flashApp.Size = new System.Drawing.Size(500, 400);
- this.flashApp.TabIndex = 0;
- //
- // SharpFlash
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(500, 400);
- this.Controls.Add(this.flashApp);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Name = "SharpFlash";
- this.Text = "SharpFlash";
- this.Closing += new System.ComponentModel.CancelEventHandler(this.SharpFlash_Closing);
- ((System.ComponentModel.ISupportInitialize)(this.flashApp)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- [STAThread]
- static void Main()
- {
- Application.Run(new SharpFlash());
- }
- private void flashApp_FSCommandEventHandler(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
- {
- // figure out which library is being invoked
- string library = e.command.Substring(0,e.command.IndexOf("."));
- // figure out which method of the library is being invoked
- string methodName = e.command.Substring(e.command.IndexOf(".")+1);
-
- // pass off the information to the library and let it
- // do it's job.
- switch(library) {
- case "sfFile":
- sfFile.Command(this, flashApp, e.args, methodName);
- break;
-
- case "sfPrivate":
- sfPrivate.Command(this, flashApp, e.args, methodName);
- break;
-
- // sfSystem has a similar switch statement
- // to handle things like sfSystem.Registry
- // and sfSystem.MessageBox
- case "sfSystem":
- sfSystem.Command(this, flashApp, e.args, methodName);
- break;
- case "sfUI":
- sfUI.Command(this, flashApp, e.args, methodName);
- break;
- case "sfWindow":
- sfWindow.Command(this, flashApp, e.args, methodName);
- break;
- }
- }
- // exit the application when the x button is clicked
- private void SharpFlash_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- Application.Exit();
- }
- }
- }