本文整理汇总了C#中LiveConnectClient.UploadAsync方法的典型用法代码示例。如果您正苦于以下问题:C# LiveConnectClient.UploadAsync方法的具体用法?C# LiveConnectClient.UploadAsync怎么用?C# LiveConnectClient.UploadAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LiveConnectClient
的用法示例。
在下文中一共展示了LiveConnectClient.UploadAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnUploadDirectory_Click
private void btnUploadDirectory_Click(object sender, RoutedEventArgs e)
{
//Show folder picker...
var dialog = new System.Windows.Forms.FolderBrowserDialog();
dialog.ShowDialog();
//END Show folder picker...
//Get a recusive list of all files...
if (dialog.SelectedPath == "")
{
System.Windows.MessageBox.Show("No folder selected.");
return;
}
string[] files = Directory.GetFiles(dialog.SelectedPath, "*.*", SearchOption.AllDirectories);
foreach (string file in files)
{
txtRaw.Text += file + "\r\n";
LiveConnectClient client = new LiveConnectClient(Properties.session);
client.UploadCompleted += this.ConnectClient_UploadCompleted;
var stream = default(Stream);
stream = File.OpenRead(file);
client.UploadAsync(Properties.UltiDriveFolderID + "/files", file, stream, stream);
stream.Close();
//System.Windows.MessageBox.Show(file);
}
//END Get a recursive list of all files...
}
示例2: UploadFile
public static bool UploadFile(string guid, string filePath)
{
validateSession();
try
{
LiveConnectClient client = new LiveConnectClient(Properties.session);
client.UploadCompleted += UltiDrive.SkyDrive.Utilities.ConnectClient_UploadCompleted;
var stream = default(Stream);
stream = File.OpenRead(filePath);
string directoryName = Path.GetDirectoryName(filePath) + "\\";
client.UploadAsync(Properties.UltiDriveFolderID + "/files", directoryName + guid, stream, stream);
//System.Windows.MessageBox.Show(stream.ToString());
//stream.Close();
return true;
}
catch (Exception e)
{
Console.WriteLine("SkyDriveApi.UploadFile() failed. --> " + e.ToString());
return false;
}
}
示例3: btnUploadFile_Click
private void btnUploadFile_Click(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog picker = new Microsoft.Win32.OpenFileDialog();
picker.Filter = "All Files (*.*)|*.*";
picker.ShowDialog();
string filePath = picker.FileName;
if (filePath != "")
{
LiveConnectClient liveClient = new LiveConnectClient(Properties.session);
liveClient.UploadCompleted += this.ConnectClient_UploadCompleted;
var stream = default(Stream);
stream = File.OpenRead(filePath);
liveClient.UploadAsync("folder.6f717ff8a3b1a691.6F717FF8A3B1A691!192/files", filePath, stream, stream);
}
else
{
System.Windows.Forms.MessageBox.Show("You didn't select a file.");
}
}