Skip to content

Instantly share code, notes, and snippets.

@JoanComasFdz
Created December 28, 2011 10:27
Show Gist options
  • Save JoanComasFdz/1527490 to your computer and use it in GitHub Desktop.
Save JoanComasFdz/1527490 to your computer and use it in GitHub Desktop.
Basic Skype Manager for C#
public delegate void SkypeIncomingCall(string user_id);
public class SkypeManager
{
/// <summary>
/// The ActiveX component to control the current
/// running instance of Skype.
/// </summary>
private Skype _skype;
/// <summary>
/// This flag indicates if the last call to the
/// ActiveX component was ok.
/// </summary>
private bool _attached;
/// <summary>
/// Occurs when a user starts a call with the
/// user ho started the current running Skype
/// instance.
/// </summary>
public event SkypeIncomingCall IncomingCall;
/// <summary>
/// Creates a new instance of <see cref="SkypeManager"/>,
/// which means that it would connect to the current
/// running Skpye instance.
/// </summary>
/// <exception cref="SkypeInstanceNotFoundException">Thrown
/// when there was imposible to connect to the current
/// running Skpype instance.</exception>
public SkypeManager()
{
_attached = false;
try
{
// Construct skype
_skype = new Skype();
// Make a call that needs to connect
// to the running isntance of skype
// to ensure the manager can interact
// with it.
UserCollection friends = _skype.Friends;
// All gone ok.
_attached = true;
}
catch (Exception ex)
{
CatchGeneralException(ex, "Constructor");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment