Project Description
This library include below library.
1.Pop3,Smtp mail library (.net 4)
2.Twitter
3.Dropbox
4.SugarSync
5.Rss
6.Facebook (Not complete)
7.WindowsAzure Management RestService (Not complete)
8.WindowsLive RestService (Not complete)
(All library except mail work on .net4,Silverlight4,WindowsPhone7)
These library is written by C# on .net 4.
You can use these library on WPF,silverlight 4,windows phone 7.
We plan to progress implementation
1.Windows Azure Rest service api.
2.Facebook graph api.
Document is here
http://higlabo.codeplex.com/documentation
If you want to support other api, please mail to
higuchihiguchihiguchi@hotmail.com
//----Mail sample----------------------------
//Receive mail
Pop3Client cl = new
Pop3Client();
cl.ServerName = "your server name";
cl.UserName = "your name";
cl.Password = "pass";
cl.Ssl = false;
if (cl.Authenticate() == true)
{
Int32 MailIndex = 1;
Pop3Message mg = cl.GetMessage(MailIndex);
String mailTo = mg.To;
String mailCc = mg.Cc;
String title = mg.Subject;
String bodyText = mg.BodyText;
//Save Image to your local hard disk
foreach(Pop3Content
ct in mg.Contents)
{
String filePath =
"C:\MyFolder\" + ct.ContentDisposition.FileName;
ct.DecodeData(filePath);
}
}
//Delete selected mail from mailbox
Pop3Client pop = new
Pop3Client("mymail@mydomain.com",
"mypass", "mail.myserver.com");
pop.Port = 110;
pop.AuthenticateMode = Pop3AuthenticateMode.Pop;
Int64[] DeleteIndexList =
new.....//It depend on your needs
cl.DeleteEMail(DeleteIndexList);
//Send mail
SmtpClient cl = new
SmtpClient();
cl.ServerName = "your server name";
cl.Port = 25;
cl.Ssl = false;
SmtpMessage mg = new
SmtpMessage();
mg.Subject = "title";
mg.BodyText = "Hi.my mail body text!";
mg.From = "my_address@mail.com";
mg.To.Add(new MailAddress("address@mail.com"));
//Add attachment file from local disk
SmtpContent ct = new SmtpContent();
ct.LoadData("C:\\myFile.xls");
mg.Contents.Add(ct);
cl.SendMail(mg);
//----Twitter Sync sample--------------------
var cl = new
TwitterClient(consumerKey, consumerSecret, accessToken, accessTokenSecret);
var rr = cl.GetHomeTimeline();
foreach (var
r in rr)
{
Console.WriteLine(r.CreatedAt +
":" + r.Text);
}
cl.UpdateStatus("I feel happy!!");
//Add new tweet
//----Twitter Async sample(You can use this method on silverlight or WindowsPhone7)----------------------
var cl = new
TwitterClient(consumerKey, consumerSecret, accessToken, accessTokenSecret);
//Execute callback on UI thread
cl.OAuthClient.SetDispatcher(dispatcher);
//Observe error event when async call
cl.OAuthClient.Error += new EventHandler<AsyncCallErrorEventArgs>(OAuthClient_Error);
cl.GetHomeTimeline(rr =>
{
foreach (var
r in rr)
{
Console.WriteLine(r.CreatedAt +
":" + r.Text);
}
});
cl.UpdateStatus("I feel happy!!", status =>
Console.WriteLine(status.CreatedAt +
":" + status.Text));
//----Dropbox Sync sample---------------------
var t =
DropboxClient.GetAccessTokenInfo("consumerKey",
"email", "password");//Get access token
var cl = new DropboxClient("consumerKey",
"consumerSecret", t.Token, t.TokenSecret);
var ai = cl.GetAccountInfo();
var cm1 = new
GetMetadataCommand();
cm1.Path = "/MyFile.txt";
var rr = cl.GetMetadata(cm1);
var cm2 = new
UploadFileCommand();
cm2.FolderPath = "/";
cm2.FileName = "FileNameOnDropbox.txt";
Byte[] bb = ...//You get byte data from your data source.
cm2.LoadFileData(bb);
cl.UploadFile(cm2);
//----Dropbox Async sample(You can use this method on silverlight or WindowsPhone7)---------------------------------------------
var cl = new
DropboxClient("consumerKey",
"consumerSecret", accessToken, accessTokenSecret);
//Execute callback on UI thread
cl.OAuthClient.SetDispatcher(dispatcher);
//Observe error event when async call
cl.OAuthClient.Error += new EventHandler<AsyncCallErrorEventArgs>(OAuthClient_Error);
cl.GetAccountInfo(new GetAccountCommand(), ai =>
Console.WriteLine(ai.EMail));
var cm1 = new
GetMetadataCommand();
cm1.Path = "/";
cl.GetMetadata(cm1, metaData => Console.WriteLine(metaData.Path));
//Observe Uploading data size.You can use it for progress bar feature.
cl.OAuthClient.Uploading += (o, e) => Console.WriteLine("Total upload size is " + e.TotalSize);
var cm2 = new
UploadFileCommand();
cm2.FolderPath = "/";
cm2.FileName = "FileNameOnDropbox.txt";
Byte[] bb = ...//You get byte data from your data source.
cm2.LoadFileData(bb);
cl.UploadFile(cm2, response => Console.WriteLine(response.BodyText));
//----Rss Sync sample-------------------------
var cl = new
RssClient();
var fd = cl.GetRssFeed("http://www.website.com/rss.xml");
foreach (var
item in fd.Items)
{
//Read item property(Title,Link,PubDate) and do something.
}
//You can create new RssFeed instance from text data.
var fd1 = new
RssFeed(System.IO.File.ReadAllText("C:\\rss.xml");
//----Rss Async sample-------------------------
var cl = new
RssClient();
cl.GetRssFeed("http://www.website.com/rss.xml",
fd =>
{
foreach (var
item in fd.Items)
{
//Read item property(Title,Link,PubDate) and do something.
}
});