Example #1
0
 void bgwk_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         if (e.Argument is int)
         {
             int iGridIndex        = (int)e.Argument;
             FaceBookController fb = new FaceBookController();//new LoginContain(gridData[ChangePassGridConst.Login, iGridIndex].Value.ToString(), gridData[ChangePassGridConst.CurrentPass, iGridIndex].Value.ToString()));
             fb.StatusChanged += (objs, obje) =>
             {
                 gridData.Invoke((Action)(() =>
                 {
                     gridData[ChangePassGridConst.Status, iGridIndex].Value = obje.Status;
                 }));
             };
             if (fb.CheckLogin())
             {
                 if (!bgwk.CancellationPending)
                 {
                     fb.ChangePass(gridData[ChangePassGridConst.NewPass, iGridIndex].Value.ToString());
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Example #2
0
        private void btnImportFacebook_Click(object sender, EventArgs e)
        {
            string strAccount = Clipboard.GetText();

            if (string.IsNullOrEmpty(strAccount))
            {
                TMessage.ShowInfomation("Nothing in clipboad");
                return;
            }
            if (TMessage.ShowQuestion("Are you sure to import there account", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            foreach (string strLogin in strAccount.Split('\n'))
            {
                if (string.IsNullOrEmpty(strLogin.Trim()))
                {
                    continue;
                }
                FaceBookController fb = new FaceBookController();
                fb.Models       = new FaceBook();
                fb.Models.Login = strLogin.Split('|')[0].Trim();
                fb.Models.Pass  = "******";//"random8&^";
                Clipboard.SetText(fb.Models.Login);
                if (fb.CheckLogin())
                {
                    var existFB = DataProvider.DB.FaceBook.Where(m => m.UserID == fb.Models.UserID).ToList();
                    if (existFB != null && existFB.Count == 0)
                    {
                        fb.Models.Cookies = Serializer.ConvertObjectToBlob(fb.WebClient.CookieContainer);
                        fb.Models.Status  = 1;
                        DataProvider.DB.FaceBook.Add(fb.Models);
                        DataProvider.DB.SaveChanges();
                    }
                }
                else
                {
                    if (fb.WebClient.Error != null)
                    {
                    }
                    else if (fb.WebClient.ResponseText.Contains("Email bạn Ä‘Ă£ nhập khĂ´ng thuá»™c bất kỳ tĂ i khoản nĂ o."))
                    {
                    }
                    else if (fb.WebClient.ResponseText.Contains("If this account reflects your real name and personal information, please help us verify it"))
                    {
                    }
                }
            }
        }