/// <summary> /// Hesap Oluşturma Butonu /// </summary> private void Button_HesapOlustur_Click(object sender, EventArgs e) { try { // Task açıldı Task HesapAc = Task.Run(() => { // Bilgi Mesajı BilgiMesaji("bilgi", "Instagram hesabı oluşturuluyor, lütfen bekleyin.", this.Text, false); // Genel Kontroller // Eposta boş mu? if (textBox_Insta_Eposta.Text == "" || textBox_Insta_Eposta.Text == null) { // Bilgi Mesajı BilgiMesaji("hata", "Epostayı boş bırakamazsınız.", this.Text, true); } // Kullanıcı adı boş mu? else if (textBox_Insta_Kadi.Text == "" || textBox_Insta_Kadi.Text == null) { // Bilgi Mesajı BilgiMesaji("hata", "Kullanıcı adını boş bırakamazsınız.", this.Text, true); } // Hiçbiri değilse devam else { // ADIMLAR /* * 1- Eposta kontrol ettir */ string EpostaKontrol = Insta.Insta_EpostaKontrol(textBox_Insta_Eposta.Text); if (EpostaKontrol == "false") { // Bilgi Mesajı BilgiMesaji("hata", "Eposta Instagram için uygun değil.", this.Text, true); } else { /* * 2- Kullanıcı adı uygunkuk kontrol ettir */ string KadiKontrol = Insta.Insta_KadiKontrol(textBox_Insta_Kadi.Text); if (KadiKontrol == "false") { // Bilgi Mesajı BilgiMesaji("hata", "Kullanıcı adı Instagram için uygun değil.", this.Text, true); } else { // Bilgi Mesajı BilgiMesaji("bilgi", "Instagram eposta ve kullanıcı adı uygunlukları tamamlandı.", this.Text); /* * 3- Hesap Oluşturma İşlemi */ #region Proxy /*var proxy = new WebProxy() * { * Address = new Uri($"https://165.22.236.64:8080"), * BypassProxyOnLocal = false, * UseDefaultCredentials = false * }; * var httpClientHandler = new HttpClientHandler() * { * Proxy = proxy, * };*/ #endregion // Session Başlatma var kullaniciOturum = new UserSessionData { UserName = textBox_Insta_Kadi.Text, Password = textBox_Insta_Sifre.Text }; InstaApi = InstaApiBuilder.CreateBuilder() .SetUser(kullaniciOturum) //.UseHttpClientHandler(httpClientHandler) .SetRequestDelay(RequestDelay.FromSeconds(0, 1)) .Build(); // Hesap oluşturma metodu var hesapOlustur = InstaApi.CreateNewAccountAsync( textBox_Insta_Kadi.Text, textBox_Insta_Sifre.Text, textBox_Insta_Eposta.Text, textBox_Insta_AdSoyad.Text ); /* * MessageBox.Show(hesapOlustur.Status.ToString()); * MessageBox.Show(hesapOlustur.Result.Info.Message.ToString()); * MessageBox.Show(hesapOlustur.Result.Succeeded.ToString()); */ // Hesap açılma durumu if (!hesapOlustur.Result.Succeeded) { // Başarısız BilgiMesaji("bilgi", textBox_Insta_Kadi.Text + " hesap oluşturulamadı.", this.Text, true); } else { // Başarılı /* * 4- Hesabı Düzenle ve Güncelle */ string adSoyad = ""; string eposta = ""; string site_adresi = textBox_Insta_InternetSitesi.Text; string telefon = ""; string biyografi = richTextBox_Insta_Biyografi.Text; string yeniKadi = ""; InstaGenderType?cinsiyet; if (combo_Insta_Cinsiyet.Text == "Erkek") { cinsiyet = InstaGenderType.Male; } else if (combo_Insta_Cinsiyet.Text == "Kadın") { cinsiyet = InstaGenderType.Female; } else { cinsiyet = InstaGenderType.Unknown; } // Profil Düzenleme try { var profilDuzenle = InstaApi.AccountProcessor .EditProfileAsync(adSoyad, biyografi, site_adresi, eposta, telefon, cinsiyet, yeniKadi); if (!profilDuzenle.Result.Succeeded) { // Başarılı BilgiMesaji("bilgi", textBox_Insta_Kadi.Text + " profil güncellendi.", this.Text); } else { // Başarısız BilgiMesaji("hata", textBox_Insta_Kadi.Text + " profil güncellenemedi.", this.Text); } } catch { BilgiMesaji("hata", textBox_Insta_Kadi.Text + " profil güncellenemedi.", this.Text); } // Profil Foto Güncelleme try { if (textBox_Insta_SeciliProfilResmiYolu.Text != "") { var picturePath = textBox_Insta_SeciliProfilResmiYolu.Text; var pictureBytes = File.ReadAllBytes(picturePath); var changeProfilePicture = InstaApi.AccountProcessor .ChangeProfilePictureAsync(pictureBytes); if (changeProfilePicture.Result.Succeeded) { // Başarılı BilgiMesaji("bilgi", textBox_Insta_Kadi.Text + " profil fotoğrafı güncellendi.", this.Text); } else { // Başarısız BilgiMesaji("hata", textBox_Insta_Kadi.Text + " profili güncellenemedi.", this.Text); } } } catch { BilgiMesaji("hata", textBox_Insta_Kadi.Text + " profili güncellenemedi.", this.Text); } // 2 sn bekle Task.Delay(2000); // Gönderileri paylaşma foreach (ListViewItem gonderi in listView_Insta_GonderiListesi.Items) { string mesaj = gonderi.SubItems[0].Text; string yol = gonderi.SubItems[1].Text; try { string instaUpload = instaResimUploadFonk(yol, mesaj); if (instaUpload == "true") { // Başarılı BilgiMesaji("bilgi", textBox_Insta_Kadi.Text + " gönderi paylaşıldı.", this.Text); } else { // Başarısız BilgiMesaji("hata", textBox_Insta_Kadi.Text + " gönderi paylaşılamadı.", this.Text); } } catch { // Başarısız BilgiMesaji("hata", textBox_Insta_Kadi.Text + " gönderi paylaşılamadı.", this.Text); } // 2 sn bekle Task.Delay(2000); } // Bilgi Mesajı BilgiMesaji("bilgi", "İşlem tamamlandı", this.Text, true); } // end if } // end if } // end if } // end if }); } catch (Exception ex) { // Bilgi Mesajı BilgiMesaji("hata", "Instagram hesabı oluşturulurken sorun oluştu;\n\n" + ex.Message, this.Text, true); } }