private void getgroup() { try { gData = (group_response.Rootobject)JsonConvert.DeserializeObject <group_response.Rootobject>(facebook.get_group(fb)); int i = 0; foreach (group_response.Datum obj in gData.data) { groupid[i] = obj.id; groupnm[i] = obj.name; i++; Invoke(new Action(() => checkedListBox1.Items.Add(obj.name))); } Invoke(new Action(() => label10.Text = i.ToString() + " Groups")); } catch (Exception e1) { MessageBox.Show(e1.ToString()); } }
private void catsearch() { try { //string result = new System.Net.WebClient().DownloadString(https://graph.facebook.com/); Thread.Sleep(1000); // this.Invoke(new Action(() => dataGridView1.Rows.Clear())); //found = "--"; //cur = "Searching in Facebook Database"; var fbclient = new Facebook.FacebookClient(token); string result = (fbclient.Get("/me/groups?pretty=0&limit=1000")).ToString(); group_response.Rootobject jobj = (group_response.Rootobject)JsonConvert.DeserializeObject <group_response.Rootobject>(result); //a.Clear(); //b.Clear(); //this.Invoke(new Action(() => listBox1.Items.Clear())); //this.Invoke(new Action(() => listBox2.Items.Clear())); foreach (var data in jobj.data) { // richTextBox1.Text += data.name + Environment.NewLine; } //a1 = new HashSet<String>(a).ToList<String>(); //a1.Sort(); //this.Invoke(new Action(() => comboBox1.Items.Clear())); //if (a1.Count > 0) //{ // for (int i = 0; i < a1.Count; i++) // { // this.Invoke(new Action(() => comboBox1.Items.Add(a1[i]))); // } // this.Invoke(new Action(() => comboBox1.SelectedIndex = 0)); // if (dt.Rows.Count > 0) // dt.Rows.Clear(); // createtable(); // for (int i = 0; i < a1.Count; i++) // { // this.Invoke(new Action(() => listBox1.Items.Add(a1[i]))); // } // Thread.Sleep(3000); //} //cur = "Search Completed Successfully"; //cur1 = "Disconnected from Internet"; //this.Invoke(new Action(() => groupBox2.Enabled = true)); //this.Invoke(new Action(() => label4.Text = a1.Count.ToString())); } catch (Exception e1) { if (e1.ToString().Contains("The remote name could not be resolved")) { MessageBox.Show("We have found that your internet is not working. Kindly check and Try Again"); } else { MessageBox.Show(e1.ToString()); } } }