private void Run(object parameter) { string name = string.Format("<{0}>", parameter.ToString()); try { ISkype skype = new Skype(); IUser user = (IUser)skype.get_User(parameter.ToString()); name = string.Format("{0} <{1}>", user.FullName, user.Handle); logfile = user.Handle + ".log"; Dispatcher.Invoke(new Action<string>(SetNewLog), user.Handle); Log("stalking {0}", name); TOnlineStatus last = TOnlineStatus.olsUnknown; while (true) { TOnlineStatus now = user.OnlineStatus; if (now != last) { Log("{0}: {1}", name, GetStatusText(now)); last = now; } Thread.Sleep(1000); } } catch (COMException ce) { switch ((uint)ce.ErrorCode) { case 0x8100030a: Log("User {0} not available.", name); break; default: Log("Error 0x{0:x} happened", ce.ErrorCode); break; } } catch (ThreadAbortException) { Log("stopping {0}", name); } catch (Exception e) { Log("Unknown error: {0}", e.Message); } finally { logfile = null; Dispatcher.Invoke(new Action<DependencyProperty, object>(Identifier.SetValue), Control.IsEnabledProperty, true); Dispatcher.Invoke(new Action<DependencyProperty, object>(StalkButton.SetValue), Control.VisibilityProperty, Visibility.Visible); Dispatcher.Invoke(new Action<DependencyProperty, object>(StopButton.SetValue), Control.VisibilityProperty, Visibility.Collapsed); } }
public void Should_send_message_to_group() { var oSkype = new Skype(); if (oSkype.Client.IsRunning == false) { oSkype.Client.Start(false, true); } UserCollection users = oSkype.Friends; foreach (User f in users) { Console.WriteLine(f.DisplayName + "|" + f.FullName + "|" + f.Handle); } //var msg = oSkype.SendMessage("testgogroups", "some text..."); var om = new UserCollection(); om.Add(oSkype.get_User("testgogroups")); om.Add(oSkype.get_User("jonny.plankton")); var oc = oSkype.CreateChatMultiple(om); oc.OpenWindow(); //oc.Topic = "Build is broken"; oc.SendMessage("Build is broken"); oc.Leave(); }
public static User GetUser(string handler) { return(Skype.get_User(handler)); }