|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionThis sample shows how to use Skype features in your ASP.NET 2.0 website. Based upon the Skype user name and standard phone number, you type in the appropriate fields. Six
Creating this sampleI started this sample by creating a new empty website, selected the Add New Item Under Website option, and selected a new
Further, I have added a folder Images to the project, and downloaded a set of images developers can use from the Skype website (Click here to download the images), and chosen the buttons I needed, and added them to the created image map. I set the path of my controls For Button1, I created an event called //Get Spype Status
try
{
this.SetSkype();
}
catch
{
//
}
finally
{
//
}
Then I clicked on the UserControl to go to the code-behind, and created a method called protected void SetSkype()
{
//Set the Images on the website to unvisible
Image1.Visible = true;
Image2.Visible = true;
Image3.Visible = true;
Image4.Visible = true;
Image5.Visible = true;
Image6.Visible = true;
//Create the Strings that will hold
//the needed values and actions
string SkypeName = txtSkypeName.Text;
string LandPhone = txtPhoneNr.Text;
string PathSkypeStatusString = "";
string SkypeAddContactString = "";
string SkypeCallString = "";
string SkypeLandCall = "";
string SkypeChattString = "";
string SkypeProfileString = "";
string SkypeSendFileString = "";
To populate the strings with values, I created //Get Spype Status
try
{
string s1 = "http://mystatus.skype.com/mediumicon/";
string s2 = SkypeName;
string sT = s1 + s2;
PathSkypeStatusString = sT;
Image1.ImageUrl = PathSkypeStatusString;
}
catch
{
//
}
finally
{
//
}
In the next part, I need more strings because the Skype user name will be in the middle of the string, so creating the complete string is a little more complicated. //Set CallString
try
{
//string s1 = "see code";
string s2 = "skype:";
string s3 = SkypeName;
string s4 = "?call";
string s5 = '"'.ToString();
string s6 = ">Skype Me";
string sT = s1 + s2 + s3 + s4 + s5 + s6;
SkypeCallString = sT;
LinkButton1.Text = SkypeCallString;
}
catch
{
//Todo
}
finally
{
//Todo
}
I repeat this for all the actions that can be performed by the user, setting the values of the Running the sample codeTo run the sample code, you just open the SkypeSample folder with Visual Studio, under the menu option File, Open, and the select the website. The code should be loaded, and when you hit F5, the sample application should run. Further useThis sample is easy to use dynamically when you store the Skype user name and phone number in a database and present these values in your website, with, for example, a //Set SkypeName and SkypeLandCall string values dynamically
try
{
//Set String SkypeName
string SkypeName = DetailsView1.DataKey["Skype"].ToString();
//Set string SkypeLandCall
string SkypeLandCall = DetailsView1.DataKey["CompanyPhone"].ToString();
}
catch
{
//Todo
}
finally
{
//Todo
}
Points of InterestI am not saying that the code is perfect but it works well from my laptop. When I request the website from my local server, all Skype options work. The name Skype is copyright of Skype Limited.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||