public void  AccounLoad()
		{
			try
			{				
				string accountUser = string.Empty;
				string accountPass = string.Empty;
				string niches = string.Empty;
				string proxyAddress = string.Empty;
				string proxyPort = string.Empty;
				string proxyUserName = string.Empty;
				string proxyPassword = string.Empty;
				string BoardsName = string.Empty;
				string ScreenName = string.Empty;
				string LoginStatus = string.Empty;
				string Followers = string.Empty;
				string Following = string.Empty;
				QueryExecuter QME = new QueryExecuter();
				DataSet ds = QME.getAccount();
				accountData.Clear();
				//DataTable dt = QME.getAccount (module);
				if (ds.Tables[0].Rows.Count != 0)
				{
					PDGlobals.listAccounts.Clear();
					for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++)
					{
						string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[6].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
						PDGlobals.listAccounts.Add(account);
						//  dv.AllowNew = false;
						accountUser = ds.Tables[0].Rows[noRow].ItemArray[0].ToString();
						accountPass = ds.Tables[0].Rows[noRow].ItemArray[1].ToString();
						niches = ds.Tables[0].Rows[noRow].ItemArray[2].ToString();
						proxyAddress = ds.Tables[0].Rows[noRow].ItemArray[3].ToString();
						proxyPort = ds.Tables[0].Rows[noRow].ItemArray[4].ToString();
						proxyUserName = ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
						proxyPassword = ds.Tables[0].Rows[noRow].ItemArray[6].ToString();
						ScreenName = ds.Tables[0].Rows[noRow].ItemArray[9].ToString();
						Followers = ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
						Following = ds.Tables[0].Rows[noRow].ItemArray[8].ToString();
						LoginStatus = ds.Tables[0].Rows[noRow].ItemArray[10].ToString();

						// Accounts objPinInterestUser = new Accounts();
						PinInterestUser objPinInterestUser = new PinInterestUser("", "", "", "");
						objPinInterestUser.Username = accountUser;
						objPinInterestUser.Password = accountPass;
						objPinInterestUser.Niches = niches;
						objPinInterestUser.ProxyAddress = proxyAddress;
						objPinInterestUser.ProxyPort = proxyPort;
						objPinInterestUser.ProxyUsername = proxyUserName;
						objPinInterestUser.ProxyPassword = proxyPassword;
						try
						{
							PDGlobals.loadedAccountsDictionary.Add(objPinInterestUser.Username, objPinInterestUser);
							AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus);
						}
						catch (Exception ex)
						{ 
							AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus);
						};
					}

					Addtologger ("[ " + DateTime.Now + " ] => [ " + PDGlobals.listAccounts.Count + " Accounts Loaded ]");
				}
				else
				{
					AddDataInGridView (accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, Followers, Following, LoginStatus);
					Addtologger ("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
				}
			}
			catch(Exception ex)
			{
				Console.Write (ex.Message);
			}
		}
        public bool LoginPinterestAccount1forlee(ref PinInterestUser objPinUser, string Username, string Password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string ss)
        {
            try
            {
                lock (this)
                {
                    objPinUser.globusHttpHelper = new GlobusHttpHelper();
                    string Name          = string.Empty;
                    string ProxyAddress  = proxyAddress;
                    string ProxyPort     = proxyPort;
                    string ProxyUsername = proxyUsername;
                    string ProxyPassword = proxyPassword;
                    string LoginStatus   = string.Empty;

                    string AfterLoginPageSource = string.Empty;
                    try
                    {
                        string PinPage = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/"), ProxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword);

                        /// string _MainSourcePage = globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com/resource/NoopResource/get/?source_url=%2Flogin%2F%3Fnext%3Dhttps%253A%252F%252Fwww.pinterest.com%252F%26prev%3Dhttps%253A%252F%252Fwww.pinterest.com%252F&data=%7B%22options%22%3A%7B%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EHomePage()%3EUnauthHomePage(signup_email%3Dnull%2C+tab%3Dfollowing%2C+cmp%3Dnull%2C+resource%3DInspiredWallResource())&_=1424169081757"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword);
                        ///Get App Version
                        if (PinPage.Contains("app_version"))
                        {
                            try
                            {
                                string[] ArrAppVersion = System.Text.RegularExpressions.Regex.Split(PinPage, "app_version");
                                if (ArrAppVersion.Count() > 0)
                                {
                                    string DataString = ArrAppVersion[ArrAppVersion.Count() - 1];

                                    int    startindex = DataString.IndexOf("\"");
                                    string start      = DataString.Substring(startindex).Replace("\": \"", "").Replace("}", string.Empty).Replace("\"", string.Empty);
                                    int    endindex   = start.IndexOf(",");

                                    App_version = start.Substring(0, endindex);
                                    if (!string.IsNullOrEmpty(App_version))
                                    {
                                        objPinUser.App_version = App_version;
                                    }
                                }
                            }
                            catch { };
                        }
                        else
                        {
                            ///App version is not available in page source
                        }


                        string referer = "https://www.pinterest.com/";
                        string login   = string.Empty;
                        try
                        {
                            string PostData1 = "source_url=%2F&data=%7B%22options%22%3A%7B%22username_or_email%22%3A%22" + Uri.EscapeDataString(Username) + "%22%2C%22password%22%3A%22" + Uri.EscapeDataString(Password) + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EPlainSignupModal%3ESignupForm%3EUserRegister(next%3D%2F%2C+wall_class%3DgrayWall%2C+container%3Dplain_signup_modal%2C+unified_auth%3Dundefined%2C+is_login_form%3Dtrue%2C+show_personalize_field%3Dundefined%2C+auto_follow%3Dundefined%2C+register%3Dtrue)";
                            login = objPinUser.globusHttpHelper.postFormDataProxy(new Uri("https://www.pinterest.com/resource/UserSessionResource/create/"), PostData1, referer, proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword);
                        }
                        catch (Exception ex)
                        { }

                        try
                        {
                            AfterLoginPageSource = objPinUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.pinterest.com"), proxyAddress, Convert.ToInt32(proxyPort), proxyUsername, proxyPassword);
                        }
                        catch (Exception ex)
                        { }
                        if (AfterLoginPageSource.Contains("Logout") || AfterLoginPageSource.Contains("pinHolder") || AfterLoginPageSource.Contains("header1\": \"What are you interested in?") || AfterLoginPageSource.Contains("\"error\": null") || login.Contains("\"error\": null"))
                        {
                            // GlobusLogHelper.log.Info(" => [ Successfully Login for " + Username + " ]");
                            //objPinUser.globusHttpHelper = globusHttpHelper;
                            this.LoggedIn          = true;
                            objPinUser.isloggedin  = true;
                            objPinUser.LoginStatus = "Success";
                        }
                        else
                        {
                            //GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]");
                            this.LoggedIn          = false;
                            objPinUser.LoginStatus = "Fail";
                            try
                            {
                                try
                                {
                                    QueryExecuter.updatetb_emails("", "", "", "", objPinUser.ScreenName, Username, objPinUser.LoginStatus);
                                }
                                catch
                                {
                                }
                                //objUploadAccount.AccounLoad();
                                //objDelegateAccountLoad();
                            }
                            catch { }
                            return(false);
                        }
                    }
                    catch (Exception ex)
                    {
                        //GlobusLogHelper.log.Info(" => [ Login Failed for " + Username + " ]");
                        this.LoggedIn          = false;
                        objPinUser.LoginStatus = "Fail";
                        try
                        {
                            try
                            {
                                QueryExecuter.updatetb_emails("", "", "", "", objPinUser.ScreenName, Username, objPinUser.LoginStatus);
                            }
                            catch
                            {
                            }
                            //objUploadAccount.AccounLoad();
                            //objDelegateAccountLoad();
                        }
                        catch { }

                        return(false);
                    }

                    try
                    {
                        List <string> listFollowersFromDatabse = new List <string>();
                        try
                        {
                            string screen_Name = Getscreen_Name(ref objPinUser);
                            objPinUser.ScreenName = screen_Name;
                            DataSet ds = QME.getFollower(screen_Name);

                            foreach (System.Data.DataRow dRow in ds.Tables[0].Rows)
                            {
                                try
                                {
                                    listFollowersFromDatabse.Add(dRow["FollwerName"].ToString());
                                }
                                catch { }
                            }
                        }
                        catch { }

                        try
                        {
                            string follower  = GetFollowercount(objPinUser.ScreenName, ref objPinUser);
                            string following = GetFollowingCount(objPinUser.ScreenName, ref objPinUser);
                            //string BOARDS = GetBoard(objPinUser.ScreenName, ref objPinUser);


                            //Globals.followingCountLogin = int.Parse(PinterestAccountManager.getBetween(following, "value'>", "</span>"));

                            string        followingCount = Utils.Utils.getBetween(following, "value'>", "</span>");
                            string        BOARDS         = string.Empty;
                            string        BoardsName     = string.Empty;
                            List <string> BOARDSNAMES    = new List <string>();
                            if (inviteStart)
                            {
                                BOARDSNAMES = GetAllBoardNames_new1(objPinUser.ScreenName);

                                foreach (var itemBoardNames in BOARDSNAMES)
                                {
                                    lstBoardNames.Add(itemBoardNames.ToLower().Replace(" ", "-"));
                                }
                            }
                            inviteStart = true;


                            try
                            {
                                foreach (string item_BoardNames in BOARDSNAMES)
                                {
                                    BoardsName += item_BoardNames + (":").ToString();
                                }
                            }
                            catch { }

                            try
                            {
                                try
                                {
                                    QueryExecuter.updatetb_emails(follower, followingCount, BOARDS, BoardsName, objPinUser.ScreenName, Username, objPinUser.LoginStatus);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                                }
                                //objUploadAccount.AccounLoad();
                                //objDelegateAccountLoad();
                            }
                            catch { }
                        }

                        catch { }

                        string[] ArrData = System.Text.RegularExpressions.Regex.Split(AfterLoginPageSource, "username");

                        foreach (var item in ArrData)
                        {
                            try
                            {
                                if (item.Contains("{\"page_info"))
                                {
                                    continue;
                                }
                                if (!item.StartsWith("\": null,") && !item.StartsWith("{\"request_identifier\""))
                                {
                                    int startindex = item.IndexOf(":");
                                    int endindex   = item.IndexOf("\", \"");

                                    this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                                    break;
                                }
                                if (item.Contains("locale"))                                // && item.Contains("P.currentUser.set"))
                                {
                                    int startindex = item.IndexOf(":");
                                    int endindex   = item.IndexOf("\", \"");

                                    this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                                    break;
                                }
                                else if (item.Contains("name\": \"AuthHomePage"))
                                {
                                    int startindex = item.IndexOf(":");
                                    int endindex   = item.IndexOf("\", \"");

                                    this.Name = item.Substring(startindex + 1, endindex - startindex).Replace("\"", string.Empty).Trim();
                                }
                            }
                            catch (Exception ex)
                            { }
                        }
                        try
                        {
                            if (ArrData.Count() == 2 && string.IsNullOrEmpty(Name))
                            {
                                int startindex = ArrData[1].IndexOf(":");
                                int endindex   = ArrData[1].IndexOf("\", \"");

                                this.Name = ArrData[1].Substring(startindex + 1, endindex - startindex).Replace("id=\"UserNav\"", string.Empty).Replace("a ", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Replace("'", string.Empty).Replace("href=", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                            }
                        }
                        catch (Exception ex)
                        { }
                    }
                    catch (Exception ex)
                    {
                        this.Name = string.Empty;
                    }
                }
                if (this.LoggedIn)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            { }
            return(false);
        }
        public void DeleteSingleAccount()
        {
            try
            {
                QueryExecuter QME = new QueryExecuter();             
                DataSet ds = QME.getAccount();
                int i = dgvAccounts.SelectedIndex;
                if (i < 0)
                {
                    GlobusLogHelper.log.Info("Please Select Account For Deletion !");
                    var ResultMessageBox = ModernDialog.ShowMessage("Please Select Account For Deletion !", " Delete Account ",  MessageBoxButton.OKCancel);
                    return;
                }                     

                if (ModernDialog.ShowMessage("Are You Want To Delete This Accounts Permanently?", " Delete Account ", MessageBoxButton.YesNo)==MessageBoxResult.Yes)
                {
                    foreach (AccountNotifyPropertyChanged  objAccountNotifyPropertyChanged in dgvAccounts.SelectedItems)
                    {
                        try
                        {
                           // AccountViewModel._listOfAccount
                            //DataRowView row = (DataRowView)selection;

                            string Username = objAccountNotifyPropertyChanged.Username.ToString();
                            string Password = objAccountNotifyPropertyChanged.Password.ToString();
                            QueryManager.DeleteAccounts(Username);
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error :" + ex.Message);
                        }
                    }
                    AccounLoad();
                }
                
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
            }
        }
        public void  AccounLoad()
        {
            try
            {
                string accountUser = string.Empty;
                string accountPass = string.Empty;
                string niches = string.Empty;
                string proxyAddress = string.Empty;
                string proxyPort = string.Empty;
                string proxyUserName = string.Empty;
                string proxyPassword = string.Empty;
                //string Useragent = string.Empty;
                string BoardsName = string.Empty;
                string ScreenName = string.Empty;
                string LoginStatus = string.Empty;
                string Followers = string.Empty;
                string Following = string.Empty;
                QueryExecuter QME = new QueryExecuter();
                DataSet ds = QME.getAccount();
                this.Dispatcher.Invoke(new Action(delegate
                {
                    AccountViewModel._listOfAccount.Clear();
                }));
                if (ds.Tables[0].Rows.Count != 0)
                {
                    PDGlobals.listAccounts.Clear();
                    for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++)
                    {
                        string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[6].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
                        PDGlobals.listAccounts.Add(account);
                        //  dv.AllowNew = false;
                        accountUser = ds.Tables[0].Rows[noRow].ItemArray[0].ToString();
                        accountPass = ds.Tables[0].Rows[noRow].ItemArray[1].ToString();
                        niches = ds.Tables[0].Rows[noRow].ItemArray[2].ToString();
                        proxyAddress = ds.Tables[0].Rows[noRow].ItemArray[3].ToString();
                        proxyPort = ds.Tables[0].Rows[noRow].ItemArray[4].ToString();
                        proxyUserName = ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
                        proxyPassword = ds.Tables[0].Rows[noRow].ItemArray[6].ToString();
                        ScreenName = ds.Tables[0].Rows[noRow].ItemArray[9].ToString();
                        Followers = ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
                        Following = ds.Tables[0].Rows[noRow].ItemArray[8].ToString();
                        LoginStatus = ds.Tables[0].Rows[noRow].ItemArray[10].ToString();

                        // Accounts objPinInterestUser = new Accounts();
                        PinInterestUser objPinInterestUser = new PinInterestUser("", "", "", "");
                        objPinInterestUser.Username = accountUser;
                        objPinInterestUser.Password = accountPass;
                        objPinInterestUser.Niches = niches;
                        objPinInterestUser.ProxyAddress = proxyAddress;
                        objPinInterestUser.ProxyPort = proxyPort;
                        objPinInterestUser.ProxyUsername = proxyUserName;
                        objPinInterestUser.ProxyPassword = proxyPassword;
                       // objPinInterestUser.LoginStatus = LoginStatus;
                        try
                        {
                            AccountNotifyPropertyChanged objAccountNotifyPropertyChanged = new AccountNotifyPropertyChanged();

                            objAccountNotifyPropertyChanged.Username = accountUser;
                            objAccountNotifyPropertyChanged.Password = accountPass;
                            objAccountNotifyPropertyChanged.Niche = niches;
                            objAccountNotifyPropertyChanged.ScreenName = ScreenName;
                            objAccountNotifyPropertyChanged.FollowerCount = Followers;
                            objAccountNotifyPropertyChanged.FollowingCount = Following;
                            objAccountNotifyPropertyChanged.ProxyAddress = proxyAddress;
                            objAccountNotifyPropertyChanged.ProxyPassword = proxyPassword;
                            objAccountNotifyPropertyChanged.ProxyPort = proxyPort;
                            objAccountNotifyPropertyChanged.ProxyUserName = proxyUserName;
                            if (LoginStatus.Contains("Success"))
                            {
                                objAccountNotifyPropertyChanged.LoginStatus = "Success";
                                objAccountNotifyPropertyChanged.BackgroundColor = "Green";
                                this.Dispatcher.Invoke(new Action(delegate
                                    {
                                        AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                    }));                               
                            }
                            else if (LoginStatus.Contains("Fail"))
                            {
                                objAccountNotifyPropertyChanged.LoginStatus = "Fail";
                                objAccountNotifyPropertyChanged.BackgroundColor = "Red";
                                this.Dispatcher.Invoke(new Action(delegate
                                    {
                                        AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                    }));                               
                            }
                            else if (LoginStatus.Contains("Not"))
                            {
                                objAccountNotifyPropertyChanged.LoginStatus = "Not Checked";
                                objAccountNotifyPropertyChanged.BackgroundColor = "";
                                this.Dispatcher.Invoke(new Action(delegate
                                    {
                                        AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                    }));                               
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                        }


                        try
                        {
                            PDGlobals.loadedAccountsDictionary.Add(objPinInterestUser.Username, objPinInterestUser);
                            try
                            {
                                this.Dispatcher.Invoke(new Action(delegate
                                {
                                   // dgvAccounts.ItemsSource = ds.Tables[0].DefaultView;
                                    dgvAccounts.ItemsSource = AccountViewModel._listOfAccount;
                                   // AccountViewModel._listOfAccount.Clear();
                                }));
                            }
                            catch (Exception ex)
                            { };
                        }
                        catch (Exception ex)
                        { };
                    }
                    try
                    {
                        this.Dispatcher.Invoke(new Action(delegate
                        {
                           // dgvAccounts.ItemsSource = ds.Tables[0].DefaultView;
                            dgvAccounts.ItemsSource = AccountViewModel._listOfAccount;
                            //AccountViewModel._listOfAccount.Clear();
                        }));
                    }
                    catch { };
                    GlobusLogHelper.log.Info(" => [ " + PDGlobals.listAccounts.Count + " Accounts Loaded ]");
                }
                else
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        //dgvAccounts.ItemsSource = ds.Tables[0].DefaultView;
                        dgvAccounts.ItemsSource = AccountViewModel._listOfAccount;
                       // AccountViewModel._listOfAccount.Clear();
                    }));
                    GlobusLogHelper.log.Info(" [  No Accounts Loaded ]");
                }
            }
            catch(Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
        public void AccounLoadaCCOUNTcHEKER()
        {
            try
            {
                this.Dispatcher.Invoke(new Action(delegate
                {
                    AccountViewModel._listOfAccount.Clear();
                }));
                NoOfAccountLoading++;
                string accountUser = string.Empty;
                string accountPass = string.Empty;
                string proxyAddress = string.Empty;
                string proxyPort = string.Empty;
                string proxyUserName = string.Empty;
                string proxyPassword = string.Empty;
                string LogInStatus = string.Empty;
                string FollowerCount = string.Empty;
                string FollwingCount = string.Empty;
                string Authorized = string.Empty;
                string Post = string.Empty;
                string path = string.Empty;                
                QueryExecuter QME = new QueryExecuter();
                DataSet ds = QME.getAccount();
                if (ds.Tables[0].Rows.Count != 0)
                {

                    this.Dispatcher.Invoke(new Action(delegate
                        {
                            IGGlobals.listAccounts.Clear();
                        }));

                    for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++)
                    {
                        this.Dispatcher.Invoke(new Action(delegate
                        {

                            string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
                            IGGlobals.listAccounts.Add(account);                            
                            accountUser = ds.Tables[0].Rows[noRow].ItemArray[0].ToString();
                            accountPass = ds.Tables[0].Rows[noRow].ItemArray[1].ToString();
                            proxyAddress = ds.Tables[0].Rows[noRow].ItemArray[2].ToString();
                            proxyPort = ds.Tables[0].Rows[noRow].ItemArray[3].ToString();
                            proxyUserName = ds.Tables[0].Rows[noRow].ItemArray[4].ToString();
                            proxyPassword = ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
                            LogInStatus = ds.Tables[0].Rows[noRow].ItemArray[7].ToString();
                            FollowerCount = ds.Tables[0].Rows[noRow].ItemArray[9].ToString();
                            FollwingCount = ds.Tables[0].Rows[noRow].ItemArray[10].ToString();
                            path = ds.Tables[0].Rows[noRow].ItemArray[6].ToString();
                            Authorized = ds.Tables[0].Rows[noRow].ItemArray[11].ToString();
                            Post = ds.Tables[0].Rows[noRow].ItemArray[8].ToString();

                            InstagramUser objInstagramUser = new InstagramUser("", "", "", "");
                            objInstagramUser.username = accountUser;
                            objInstagramUser.password = accountPass;
                            objInstagramUser.proxyip = proxyAddress;
                            objInstagramUser.proxyport = proxyPort;
                            objInstagramUser.proxyusername = proxyUserName;
                            objInstagramUser.proxypassword = proxyPassword;
                            objInstagramUser.LogInStatus = LogInStatus;
                            objInstagramUser.FollowerCount = FollowerCount;
                            objInstagramUser.FollwingCount = FollwingCount;
                            objInstagramUser.Path = path;
                            objInstagramUser.Authorized = Authorized;
                            objInstagramUser.Post = Post;

                            try
                            {
                                GramDominator.ViewModule.AccountNotifyPropertyChanged objAccountNotifyPropertyChanged = new GramDominator.ViewModule.AccountNotifyPropertyChanged();

                                objAccountNotifyPropertyChanged.Username = accountUser;
                                objAccountNotifyPropertyChanged.Password = accountPass;
                                objAccountNotifyPropertyChanged.LoginStatus = LogInStatus;
                                objAccountNotifyPropertyChanged.FollowerCount = FollowerCount;
                                objAccountNotifyPropertyChanged.FollowingCount = FollwingCount;
                                objAccountNotifyPropertyChanged.ProxyAddress = proxyAddress;
                                objAccountNotifyPropertyChanged.ProxyPassword = proxyPassword;
                                objAccountNotifyPropertyChanged.ProxyPort = proxyPort;
                                objAccountNotifyPropertyChanged.ProxyUserName = proxyUserName;                                
                                objAccountNotifyPropertyChanged.Authorized = Authorized;
                                objAccountNotifyPropertyChanged.Post = Post;
                                objAccountNotifyPropertyChanged.Path = path;
                               

                                if (LogInStatus.Contains("Success"))
                                {
                                    objAccountNotifyPropertyChanged.LoginStatus = "Success";
                                    objAccountNotifyPropertyChanged.BackgroundColor = "Green";
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {
                                        if (!AccountViewModel._listOfAccount.Contains(objAccountNotifyPropertyChanged))
                                        {
                                            AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                        }
                                    }));
                                    
                                }
                                else if (LogInStatus.Contains("Fail"))
                                {
                                    objAccountNotifyPropertyChanged.LoginStatus = "Fail";
                                    objAccountNotifyPropertyChanged.BackgroundColor = "Red";
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {

                                        if (!AccountViewModel._listOfAccount.Contains(objAccountNotifyPropertyChanged))
                                        {
                                            AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                        }
                                    }));
                                }
                                else if (LogInStatus.Contains("Not"))
                                {
                                    objAccountNotifyPropertyChanged.LoginStatus = "Not Checked";
                                    objAccountNotifyPropertyChanged.BackgroundColor = "";
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {

                                        if (!AccountViewModel._listOfAccount.Contains(objAccountNotifyPropertyChanged))
                                        {

                                            AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged);
                                        }
                                    }));
                                }
                            }
                            catch (Exception ex)
                            {

                            }

                            try
                            {

                               
                                    IGGlobals.loadedAccountsDictionary.Add(objInstagramUser.username, objInstagramUser);
                                
                                try
                                {
                                    this.Dispatcher.Invoke(new Action(delegate
                                    {
                                        grvAccounts_AccountCreator_AccountDetails.ItemsSource = AccountViewModel._listOfAccount;

                                    }));
                                }
                                catch { };
                            }
                            catch { };
                        }));

                    }
                    try
                    {
                        this.Dispatcher.Invoke(new Action(delegate
                        {
                            grvAccounts_AccountCreator_AccountDetails.ItemsSource = AccountViewModel._listOfAccount;

                        }));
                    }
                    catch { };

                    if (NoOfAccountLoading >= NoOfAccountLoaded)
                    {
                        GlobusLogHelper.log.Info("[ " + IGGlobals.listAccounts.Count + " Accounts Loaded ]");
                    }
                }
                else
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                    }));
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
                }


            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error ==> " + ex.StackTrace);
            }

        }
        public void  AccounLoad()
        {
             string accountUser = string.Empty;
             string accountPass = string.Empty;
             string proxyAddress = string.Empty;
             string proxyPort = string.Empty;
             string proxyUserName = string.Empty;
             string proxyPassword = string.Empty;
             string status = string.Empty;
            QueryExecuter QME = new QueryExecuter();
            DataSet ds = QME.getAccount();
            if (ds.Tables[0].Rows.Count != 0)
            {
                //try
                //{
                //    path = ds.Tables[0].Rows[0].ItemArray[6].ToString();
                //    if (!string.IsNullOrEmpty(path))
                //    {
                //        try
                //        {
                //            //txtAddAccounts1.Text = path;
                //        }
                //        catch { };
                //    }
                //}
                //catch { }
                IGGlobals.listAccounts.Clear();
                for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++)
                {
                    string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString();
                    IGGlobals.listAccounts.Add(account);
                  //  dv.AllowNew = false;
                    accountUser =ds.Tables[0].Rows[noRow].ItemArray[0].ToString();
                    accountPass =ds.Tables[0].Rows[noRow].ItemArray[1].ToString();
                    proxyAddress =ds.Tables[0].Rows[noRow].ItemArray[2].ToString();
                    proxyPort = ds.Tables[0].Rows[noRow].ItemArray[3].ToString();
                    proxyUserName=ds.Tables[0].Rows[noRow].ItemArray[4].ToString();
                    proxyPassword=ds.Tables[0].Rows[noRow].ItemArray[5].ToString();

                    InstagramUser objInstagramUser = new InstagramUser("","","","");
                    objInstagramUser.username = accountUser;
                    objInstagramUser.password = accountPass;
                    objInstagramUser.proxyip = proxyAddress;
                    objInstagramUser.proxyport = proxyPort;
                    objInstagramUser.proxyusername = proxyUserName;
                    objInstagramUser.proxypassword = proxyPassword;
                    try
                    {
                        IGGlobals.loadedAccountsDictionary.Add(objInstagramUser.username, objInstagramUser);
                        try
                        {
                            this.Dispatcher.Invoke(new Action(delegate
                            {
                                grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                            }));
                        }
                        catch { };
                    }
                    catch { };                  
                 
                }
                try
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                    }));
                }
                catch { };



                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ " + IGGlobals.listAccounts.Count + " Accounts Loaded ]");
            }
            else
            {
                this.Dispatcher.Invoke(new Action(delegate
                {
                    grvAccounts_AccountCreator_AccountDetails.ItemsSource = ds.Tables[0].DefaultView;

                }));
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [  No Accounts Loaded ]");
            }
<<<<<<< HEAD

          
=======
<<<<<<< HEAD

          
=======
>>>>>>> 040a8d35fce59f25e2f75d75646c50226d83374f
>>>>>>> origin/master
        }