Created
December 28, 2011 10:27
-
-
Save JoanComasFdz/1527490 to your computer and use it in GitHub Desktop.
Basic Skype Manager for C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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