Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
 public void invoke(string name, string method, params string[] args)
 {
     IPCMessageManager.Send(this.globalHandle, MessageType.GlobalInvoke, name, method, args);
 }
Exemplo n.º 6
0
 public void exec(string name, string script)
 {
     IPCMessageManager.Send(this.globalHandle, MessageType.GlobalExec, name, script);
 }
Exemplo n.º 7
0
 public FormForScript exec(string script, bool asyn = false)
 {
     IPCMessageManager.Send(this.formHandle, MessageType.Exec, script);
     return(new FormForScript(formHandle));
 }
Exemplo n.º 8
0
 public FormForScript mode(int status)
 {
     IPCMessageManager.Send(this.formHandle, MessageType.Mode, status);
     return(new FormForScript(formHandle));
 }
Exemplo n.º 9
0
 public FormForScript refresh(string url)
 {
     IPCMessageManager.Send(this.formHandle, MessageType.Refresh, url);
     return(new FormForScript(formHandle));
 }
Exemplo n.º 10
0
 public FormForScript site(int left, int top)
 {
     IPCMessageManager.Send(this.formHandle, MessageType.Site, left, top);
     return(new FormForScript(formHandle));
 }
Exemplo n.º 11
0
 public FormForScript size(int width, int height)
 {
     IPCMessageManager.Send(this.formHandle, MessageType.Size, width, height);
     return(new FormForScript(formHandle));
 }
Exemplo n.º 12
0
 public FormForScript hide()
 {
     IPCMessageManager.Send(this.formHandle, MessageType.Hide);
     return(new FormForScript(formHandle));
 }
Exemplo n.º 13
0
 public FormForScript show(string parent)
 {
     IPCMessageManager.Send(this.formHandle, MessageType.Show, parent);
     return(new FormForScript(formHandle));
 }