private void StartSendInvitationMultyThread_DivideUrlsAccordingAccount(object Parameter) { string Account = string.Empty; List<string> lstProfileUrl = new List<string>(); try { try { if (IsStop) { return; } if (!IsStop) { lstThread_AcceptInvitation.Add(Thread.CurrentThread); lstThread_AcceptInvitation = lstThread_AcceptInvitation.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } } catch { } Array paramsArray = new object[2]; paramsArray = (Array)Parameter; // KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0); lstProfileUrl = (List<string>)paramsArray.GetValue(1); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); LinkedinLogin Login = new LinkedinLogin(); LinkedInMaster item = (LinkedInMaster)paramsArray.GetValue(0); //item.Value; //string linkedInKey = item.Key; //Account = item.Key; //Login.accountUser = item.Key; //Login.accountPass = item.Value._Password; //Login.proxyAddress = item.Value._ProxyAddress; //Login.proxyPort = item.Value._ProxyPort; //Login.proxyUserName = item.Value._ProxyUsername; //Login.proxyPassword = item.Value._ProxyPassword; Login.accountUser = item._Username; Login.accountPass = item._Password; Login.proxyAddress = item._ProxyAddress; Login.proxyPort = item._ProxyPort; Login.proxyUserName = item._ProxyUsername; Login.proxyPassword = item._ProxyPassword; ClsInviteMemberThroughProfileURL obj_ClsInviteMemberThroughProfileURL = new ClsInviteMemberThroughProfileURL(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword); // Add Event Login.logger.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger); obj_ClsInviteMemberThroughProfileURL.acceptInvitationsLogEvents.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger); if (!Login.IsLoggedIn) { // AddAcceptInvitationsLogger("Logging In With Account" + Login.accountUser); Login.LoginHttpHelper(ref HttpHelper); } if (Login.IsLoggedIn) { obj_ClsInviteMemberThroughProfileURL.StartSendInvitations_DivideUrlsAccordingAccount(ref HttpHelper, lstProfileUrl); } else { AddInviteMemberThroughProfUrlLogger("[ " + DateTime.Now + " ] => [ Couldn't Login With Account " + Login.accountUser + " ]"); } // Remove Event Login.logger.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger); obj_ClsInviteMemberThroughProfileURL.acceptInvitationsLogEvents.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs); } finally { lock (lockr_ThreadController) { count_ThreadController--; Monitor.Pulse(lockr_ThreadController); } } }
private void StartSendInvitationMultyThread(object Parameter) { string Account = string.Empty; try { try { if (IsStop) { return; } if (!IsStop) { lstThread_AcceptInvitation.Add(Thread.CurrentThread); lstThread_AcceptInvitation = lstThread_AcceptInvitation.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } } catch { } Array paramsArray = new object[1]; paramsArray = (Array)Parameter; KeyValuePair<string, LinkedInMaster> item = (KeyValuePair<string, LinkedInMaster>)paramsArray.GetValue(0); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); LinkedinLogin Login = new LinkedinLogin(); LinkedInMaster LinkedIn_Master = item.Value; string linkedInKey = item.Key; Account = item.Key; Login.accountUser = item.Key; Login.accountPass = item.Value._Password; Login.proxyAddress = item.Value._ProxyAddress; Login.proxyPort = item.Value._ProxyPort; Login.proxyUserName = item.Value._ProxyUsername; Login.proxyPassword = item.Value._ProxyPassword; ClsInviteMemberThroughProfileURL obj_ClsInviteMemberThroughProfileURL = new ClsInviteMemberThroughProfileURL(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword); // Add Event Login.logger.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger); obj_ClsInviteMemberThroughProfileURL.acceptInvitationsLogEvents.addToLogger += new EventHandler(AcceptInvitationsLogEvents_addToLogger); if (!Login.IsLoggedIn) { Login.LoginHttpHelper(ref HttpHelper); } if (Login.IsLoggedIn) { obj_ClsInviteMemberThroughProfileURL.StartSendInvitations(ref HttpHelper); } else { AddInviteMemberThroughProfUrlLogger("[ " + DateTime.Now + " ] => [ Couldn't Login With Account " + item.Key + " ]"); } // Remove Event Login.logger.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger); obj_ClsInviteMemberThroughProfileURL.acceptInvitationsLogEvents.addToLogger -= new EventHandler(AcceptInvitationsLogEvents_addToLogger); } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Accept Invitation --> StartAcceptInvitation() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddConnectionErrorLogs); } finally { BtnSendInvitation.Invoke(new MethodInvoker(delegate { BtnSendInvitation.Cursor = Cursors.Default; })); } }