public void PostUpdateLiker(object parameter)
        {
            try
            {
                try
                {
                    if (!IsStop)
                    {
                        lstGroupUpdateThread.Add(Thread.CurrentThread);
                        lstGroupUpdateThread.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();
                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;
                string user = item.Key;

                Groups.GroupUpdate obj_GroupUpdate = new Groups.GroupUpdate(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                Login.logger.addToLogger += new EventHandler(AddToLogger_GroupStatus);
                obj_GroupUpdate.logger.addToLogger += new EventHandler(AddToLogger_GroupStatus);

                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                    //AddLoggerGroupAdd("Login Process completed..  ");
                }

                List<string> GetCheckedItems = new List<string>();

                if (chkUpdateCollection.InvokeRequired)
                {
                    chkUpdateCollection.Invoke(new MethodInvoker(delegate
                    {
                        foreach (string Userid in chkUpdateCollection.CheckedItems)
                        {
                            string[] Uid = Userid.Split('#');
                            GetCheckedItems.Add(Uid[1]);
                        }
                    }));
                }

                List<string> SelectedItem = new List<string>();

                foreach (KeyValuePair<string, Dictionary<string, string>> NewValue in GrpMess)
                {
                    if (NewValue.Key == item.Key)
                    {
                        foreach (KeyValuePair<string, string> GroupId in NewValue.Value)
                        {
                            foreach (string selectedgroup in GetCheckedItems)
                            {
                                if (GroupId.Key.Contains(selectedgroup))
                                {
                                    SelectedItem.Add(GroupId + "#" + selectedgroup);

                                }
                            }
                        }
                    }
                }

                int minDelay = 20;
                int maxDelay = 25;

                if (!string.IsNullOrEmpty(txtGroupUpdateMinDelay.Text) && NumberHelper.ValidateNumber(txtGroupUpdateMinDelay.Text))
                {
                    minDelay = Convert.ToInt32(txtGroupUpdateMinDelay.Text);
                }
                if (!string.IsNullOrEmpty(txtGroupUpdateMaxDelay.Text) && NumberHelper.ValidateNumber(txtGroupUpdateMaxDelay.Text))
                {
                    maxDelay = Convert.ToInt32(txtGroupUpdateMaxDelay.Text);
                }

                obj_GroupUpdate.PostCommentLikerUpdate(ref HttpHelper, SelectedItem, new object[] { item, user }, minDelay, maxDelay);

            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Update Liker --> PostUpdateLiker() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Update Liker --> PostUpdateLiker() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
            }
            finally
            {
                counter_GroupMemberSearch--;
                int cnt = LinkedInManager.linkedInDictionary.Count - 1;
                if (counter_GroupMemberSearch == cnt)
                {
                    if (btnUpdateLike.InvokeRequired)
                    {
                        btnUpdateLike.Invoke(new MethodInvoker(delegate
                        {
                            AddLoggerCommentLiker("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddLoggerCommentLiker("---------------------------------------------------------------------------------------------------------------------------");
                            btnUpdateLike.Cursor = Cursors.Default;

                        }));
                    }
                }
            }
        }
示例#2
0
        public void PostUpdateLiker(object parameter)
        {
            try
            {
                try
                {
                    if (!IsStop)
                    {
                        lstGroupUpdateThread.Add(Thread.CurrentThread);
                        lstGroupUpdateThread.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();
                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;
                string user = item.Key;

                Groups.GroupUpdate obj_GroupUpdate = new Groups.GroupUpdate(Login.accountUser, Login.accountPass, Login.proxyAddress, Login.proxyPort, Login.proxyUserName, Login.proxyPassword);

                Login.logger.addToLogger           += new EventHandler(AddToLogger_GroupStatus);
                obj_GroupUpdate.logger.addToLogger += new EventHandler(AddToLogger_GroupStatus);

                if (!Login.IsLoggedIn)
                {
                    Login.LoginHttpHelper(ref HttpHelper);
                    //AddLoggerGroupAdd("Login Process completed..  ");
                }

                List <string> GetCheckedItems = new List <string>();

                if (chkUpdateCollection.InvokeRequired)
                {
                    chkUpdateCollection.Invoke(new MethodInvoker(delegate
                    {
                        foreach (string Userid in chkUpdateCollection.CheckedItems)
                        {
                            string[] Uid = Userid.Split('#');
                            GetCheckedItems.Add(Uid[1]);
                        }
                    }));
                }

                List <string> SelectedItem = new List <string>();

                foreach (KeyValuePair <string, Dictionary <string, string> > NewValue in GrpMess)
                {
                    if (NewValue.Key == item.Key)
                    {
                        foreach (KeyValuePair <string, string> GroupId in NewValue.Value)
                        {
                            foreach (string selectedgroup in GetCheckedItems)
                            {
                                if (GroupId.Key.Contains(selectedgroup))
                                {
                                    SelectedItem.Add(GroupId + "#" + selectedgroup);
                                }
                            }
                        }
                    }
                }


                int minDelay = 20;
                int maxDelay = 25;

                if (!string.IsNullOrEmpty(txtGroupUpdateMinDelay.Text) && NumberHelper.ValidateNumber(txtGroupUpdateMinDelay.Text))
                {
                    minDelay = Convert.ToInt32(txtGroupUpdateMinDelay.Text);
                }
                if (!string.IsNullOrEmpty(txtGroupUpdateMaxDelay.Text) && NumberHelper.ValidateNumber(txtGroupUpdateMaxDelay.Text))
                {
                    maxDelay = Convert.ToInt32(txtGroupUpdateMaxDelay.Text);
                }

                obj_GroupUpdate.PostCommentLikerUpdate(ref HttpHelper, SelectedItem, new object[] { item, user }, minDelay, maxDelay);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Update Liker --> PostUpdateLiker() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Update Liker --> PostUpdateLiker() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinGetGroupMemberErrorLogs);
            }
            finally
            {
                counter_GroupMemberSearch--;
                int cnt = LinkedInManager.linkedInDictionary.Count - 1;
                if (counter_GroupMemberSearch == cnt)
                {
                    if (btnUpdateLike.InvokeRequired)
                    {
                        btnUpdateLike.Invoke(new MethodInvoker(delegate
                        {
                            AddLoggerCommentLiker("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                            AddLoggerCommentLiker("---------------------------------------------------------------------------------------------------------------------------");
                            btnUpdateLike.Cursor = Cursors.Default;
                        }));
                    }
                }
            }
        }