Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using SKYPE4COMLib;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- Skype skype = new Skype();
- private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) // User laden
- {
- System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(loadContacts));
- thread.IsBackground = true;
- thread.Priority = System.Threading.ThreadPriority.AboveNormal;
- thread.Name = "Load Skype Contacts";
- thread.Start();
- }
- private void button1_Click(object sender, EventArgs e) // spammen
- {
- try
- {
- for (int i = 0; i < numericUpDown1.Value; i++)
- {
- skype.SendMessage(label1.Text, textBox1.Text);
- }
- }
- catch (Exception exc) { MessageBox.Show("Aktion fehlgeschlagen " + exc.Message); }
- }
- List<string> alleKontakte = new List<string>();
- public void loadContacts() // Radiobutton2 = online | radiobutton1 = alle
- {
- alleKontakte.Clear();
- if (radioButton1.Checked)
- {
- foreach(User user in skype.Friends)
- {
- alleKontakte.Add(user.Handle);
- }
- }
- else if (radioButton2.Checked)
- {
- foreach (User user in skype.Friends)
- {
- if (user.OnlineStatus == TOnlineStatus.olsOnline | user.OnlineStatus == TOnlineStatus.olsNotAvailable | user.OnlineStatus == TOnlineStatus.olsDoNotDisturb | user.OnlineStatus == TOnlineStatus.olsAway)
- {
- alleKontakte.Add(user.Handle);
- }
- }
- }
- MethodInvoker lvUpdate = delegate
- {
- listView1.Items.Clear();
- foreach (var user in alleKontakte)
- {
- listView1.Items.Add(user);
- }
- listView1.Sorting = SortOrder.Ascending;
- if (radioButton2.Checked)
- radioButton2.Text = String.Format("nur online Kontakte ({0})", listView1.Items.Count);
- else if(radioButton1.Checked)
- radioButton1.Text = String.Format("alle Kontakte ({0})", listView1.Items.Count);
- };
- Invoke(lvUpdate);
- }
- private void listView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- label1.Text = listView1.SelectedItems[0].Text;
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment