반응형
string _SendUrl = "";
string _GetUrl = "";
bool _isMssiExit = true;
bool _isImoExit = true;
Thread thread = new Thread(new ThreadStart(GetWebPageWorker));
Thread thread2 = new Thread(new ThreadStart(GetWebPageWorker));
_SendUrl = ""; //초기화
_GetUrl = ""; //초기화
_SendUrl = "URL링크"
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Wating Thread
while(_isMssiExit)
{
if (_GetUrl.IndexOf("shipid:") > -1)
{
_isMssiExit = false;
thread.Abort();
}
else if (_GetUrl == _SendUrl)
{
thread.Abort();
_SendUrl = "URL링크"
thread2.SetApartmentState(ApartmentState.STA);
thread2.Start();
thread2.Join();
while (_isImoExit)
{
if(_GetUrl.IndexOf("shipid:") > -1)
{
_isMssiExit = false;
_isImoExit = false;
thread2.Abort();
}
else if (_GetUrl == _SendUrl)
{
throw new ArgumentNullException("오류");
}
}
}
}
//URL 가져오는 함수
protected void GetWebPageWorker()
{
using (WebBrowser browser = new WebBrowser())
{
// browser.ClientSize = new Size(_width, _height);
browser.ScrollBarsEnabled = false;
browser.ScriptErrorsSuppressed = true;
browser.Navigate(_SendUrl);
// Wait for control to load page
while (browser.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
_GetUrl = browser.Url.AbsoluteUri; //Redirct 한 URL
}
}
'IT > C#' 카테고리의 다른 글
[C#]Vs 2019에서 nuget 리스트 보이지 않을 경우 (0) | 2020.07.29 |
---|---|
[C#]Oracle.ManagedDataAccess.Client Connection (0) | 2020.07.29 |
[C#]Youtube Rss 파싱(parse)하기 (0) | 2020.03.16 |
[C#]Ionic을 이용한 압축 (한글 인코딩 O) (0) | 2020.03.12 |
[C#]폴더 생성 , 폴더 내 데이터 압축 (한글X) (0) | 2020.03.12 |