sfUI.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 Class1.
- /// </summary>
- public class sfUI
- {
- private static WddxSerializer wddxSerializer = new WddxSerializer();
-
- //These libraries can be static for now.. depends on what their use is.
- public sfUI() {
-
- }
- //Handles any command.. Will exist for any library. Main library loop
- public static void Command(Form form, AxShockwaveFlash flashApp, string list, String method) {
- switch(method) {
- case "addButton":
- sfUI.addButton(form, flashApp, list);
- break;
- }
- }
- //Method in library. Can pick and choose what to pass in if you want.
- public static void addButton(Form form, AxShockwaveFlash flashApp, string list) {
- //flashApp.Enabled = true;
-
- string[] temp = list.Split('|')[0].Split(',');
-
- string txt = temp[0];
- string name = temp[1];
- int x = Int32.Parse(temp[2]);
- int y = Int32.Parse(temp[3]);
- string callback = list.Substring(list.IndexOf("|")+1);
- Button button = new System.Windows.Forms.Button();
- button.Name = name;
- button.Location = new System.Drawing.Point(x, y);
- button.Text = txt;
- button.Visible = true;
- form.Controls.Add(button);
- //flashApp.Visible = false;
- Console.WriteLine("added button with text = " + temp[0]);
-
-
- flashApp.SetVariable("$SFData", "<sf><callback><id>" + callback + "</id><args><arg>" + wddxSerializer.Serialize(true).ToString() + "</arg></args></callback></sf>");
- }
- }
- }