private void StartConnectSession(RemoteSession session) { Thread connectSession = new Thread(new ThreadStart(() => { Chrome chrome = new Chrome(); chrome.Connect(session.webSocketDebuggerUrl); lock (locker) { int browserid = CountAdded + 1; chrome.SetBrowserId(browserid); string name = this.CoinsIndexed[this.CountAdded]; this.Browsers.Add(name, chrome); this.CountAdded++; this.OnSocketConnected(this, new SocketConnectedEventArgs(this.CountAdded, this.Coins.Count * 2)); if (this.CountAdded == this.Coins.Count * 2) { this.OnComplete(this, new AttachBrowsersCompleteEventArgs(this.Browsers)); } } })); connectSession.Start(); }
private void StartConnectSession(Chrome chrome, string webSocketDebuggerUrl) { new Thread(new ThreadStart(() => { chrome.Connect(webSocketDebuggerUrl); lock (locker) { int browserid = CountAdded + 1; chrome.SetBrowserId(browserid); this.CountAdded++; this.OnSocketConnected(this, new SocketConnectedEventArgs(this.CountAdded, this.CountTotal)); if (this.CountAdded == this.CountTotal) { this.OnComplete(this, new AttachBrowsersCompleteEventArgs(this.Browsers)); } } })).Start(); }
private void StartConnectSessionAndGotoPage(Chrome chrome, string webSocketDebuggerUrl, string pairUri) { new Thread(new ThreadStart(() => { chrome.Connect(webSocketDebuggerUrl); chrome.Eval(Commands.NavigateTo("https://upbit.com/exchange?code=CRIX.UPBIT." + pairUri)); lock (locker) { int browserid = CountAdded + 1; chrome.SetBrowserId(browserid); this.CountAdded++; this.OnSocketConnected(this, new SocketConnectedEventArgs(this.CountAdded, this.CountTotal)); if (this.CountAdded == this.CountTotal) { this.OnComplete(this, new AttachBrowsersCompleteEventArgs(this.Browsers)); } } })).Start(); }