sfWindow.cs
上传用户:lctyggxszx
上传日期:2022-06-30
资源大小:280k
文件大小:2k
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using AxShockwaveFlashObjects;
- using Mueller.Wddx;
- namespace SharpFlash
- {
- /// <summary>
- /// Summary description for sfWindow.
- /// </summary>
- public class sfWindow
- {
- private static WddxSerializer wddxSerializer = new WddxSerializer();
-
- public sfWindow() {}
- // Main library method, determines what was sent from Flash and
- // calls the appropriate worker function.
- public static void Command(Form form, AxShockwaveFlash flashApp, string list, string method) {
- switch(method) {
- case "getApplicationPath":
- sfWindow.getApplicationPath(form, flashApp, list);
- break;
-
- case "getWindowText":
- sfWindow.getWindowText(form, flashApp, list);
- break;
- case "hide":
- sfWindow.hide(form);
- break;
-
- case "moveTo":
- sfWindow.moveTo(form, flashApp, list);
- break;
-
- case "setWindowText":
- sfWindow.setWindowText(form, flashApp, list);
- break;
-
- case "show":
- sfWindow.show(form);
- break;
- case "toggleVisibility":
- sfWindow.toggleVisibility(form);
- break;
- }
- }
- public static void moveTo(Form form, AxShockwaveFlash flashApp, string list) {
- string[] temp = list.Split(',');
-
- int x = Int32.Parse(temp[0]);
- int y = Int32.Parse(temp[1]);
-
- form.Location = new System.Drawing.Point(x,y);
- }
- public static void getWindowText(Form form, AxShockwaveFlash flashApp, string list)
- {
- flashApp.SetVariable("$SFData", "<sf><callback><id>" + list + "</id>"
- + "<args>"
- + "<arg>" + wddxSerializer.Serialize(form.Text).ToString() + "</arg>"
- + "</args></callback></sf>");
- }
- public static void getApplicationPath(Form form, AxShockwaveFlash flashApp, string list)
- {
- flashApp.SetVariable("$SFData", "<sf><callback><id>" + list + "</id>"
- + "<args>"
- + "<arg>" + wddxSerializer.Serialize(Application.StartupPath).ToString() + "</arg>"
- + "</args></callback></sf>");
- }
- public static void setWindowText(Form form, AxShockwaveFlash flashApp, string list)
- {
- form.Text = list;
- }
- public static void hide(Form form)
- {
- form.Visible = false;
- }
- public static void show(Form form)
- {
- form.Visible = true;
- }
- public static void toggleVisibility(Form form)
- {
- form.Visible = !form.Visible;
- }
- }
- }