public int InitProcess() { var fileName = this.features.Get("fileName"); var url = this.features.Get("url"); var name = this.features.Get("name"); var args = this.features.Get("args").Replace("{url}", url).Replace("{name}", name); var workspace = this.features.Get("workspace", Application.StartupPath); this.process.StartInfo.FileName = fileName; this.process.StartInfo.Arguments = args; this.process.StartInfo.WorkingDirectory = workspace; this.process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; this.process.Start(); this.process.WaitForInputIdle(); this.Handle = this.process.MainWindowHandle; var countDown = 1000; while (this.Handle == IntPtr.Zero) { if (countDown < 0) { break; } countDown--; Thread.Sleep(100); this.Handle = Process.GetProcessById(this.process.Id).MainWindowHandle; } //改变尺寸 IPCMessageManager.Send(this.Handle, MessageType.Size, this.features.Get("width"), this.features.Get("height")); IPCMessageManager.Send(this.Handle, MessageType.Site, this.features.GetInt("left"), this.features.GetInt("top")); IPCMessageManager.Send(this.Handle, MessageType.Show, this.features.Get("parent")); return(this.process.Id); }
public FormForScript open(string url, string features = "") { var handle = IPCMessageManager.Send(this.globalHandle, MessageType.GlobalOpen, url, features); if (string.IsNullOrEmpty(handle)) { return(null); } return(new FormForScript(Marshal.StringToHGlobalAnsi(handle))); }
public FormForScript find(string formName) { if (string.IsNullOrEmpty(formName)) { return(new FormForScript(this.formHandle)); } var handle = IPCMessageManager.Send(this.globalHandle, MessageType.GlobalFind, formName); if (string.IsNullOrEmpty(handle)) { return(null); } return(new FormForScript(Marshal.StringToHGlobalAnsi(handle))); }
private void Window_EventCallback(FormMessage message) { switch (message.Type) { case FormMessageType.None: break; case FormMessageType.Show: IPCMessageManager.Send(this.Handle, MessageType.Show, this.features.Get("name"), message.Data.GetString(0)); break; case FormMessageType.Close: IPCMessageManager.Send(this.Handle, MessageType.Close, this.features.Get("name")); break; case FormMessageType.Hide: IPCMessageManager.Send(this.Handle, MessageType.Hide, this.features.Get("name")); break; case FormMessageType.Size: IPCMessageManager.Send(this.Handle, MessageType.Size, this.features.Get("name"), message.Data.GetString(0), message.Data.GetString(1)); break; case FormMessageType.Site: IPCMessageManager.Send(this.Handle, MessageType.Site, this.features.Get("name"), message.Data.GetString(0), message.Data.GetString(1)); break; case FormMessageType.Mode: IPCMessageManager.Send(this.Handle, MessageType.Mode, this.features.Get("name"), message.Data.GetString(0)); break; case FormMessageType.Exec: IPCMessageManager.Send(this.Handle, MessageType.Exec, this.features.Get("name"), message.Data.GetString(0)); break; case FormMessageType.Refresh: IPCMessageManager.Send(this.Handle, MessageType.Refresh, this.features.Get("name"), message.Data.GetString(0)); break; default: break; } }
public void invoke(string name, string method, params string[] args) { IPCMessageManager.Send(this.globalHandle, MessageType.GlobalInvoke, name, method, args); }
public void exec(string name, string script) { IPCMessageManager.Send(this.globalHandle, MessageType.GlobalExec, name, script); }
public FormForScript exec(string script, bool asyn = false) { IPCMessageManager.Send(this.formHandle, MessageType.Exec, script); return(new FormForScript(formHandle)); }
public FormForScript mode(int status) { IPCMessageManager.Send(this.formHandle, MessageType.Mode, status); return(new FormForScript(formHandle)); }
public FormForScript refresh(string url) { IPCMessageManager.Send(this.formHandle, MessageType.Refresh, url); return(new FormForScript(formHandle)); }
public FormForScript site(int left, int top) { IPCMessageManager.Send(this.formHandle, MessageType.Site, left, top); return(new FormForScript(formHandle)); }
public FormForScript size(int width, int height) { IPCMessageManager.Send(this.formHandle, MessageType.Size, width, height); return(new FormForScript(formHandle)); }
public FormForScript hide() { IPCMessageManager.Send(this.formHandle, MessageType.Hide); return(new FormForScript(formHandle)); }
public FormForScript show(string parent) { IPCMessageManager.Send(this.formHandle, MessageType.Show, parent); return(new FormForScript(formHandle)); }