本文整理汇总了C#中LiveConnectClient类的典型用法代码示例。如果您正苦于以下问题:C# LiveConnectClient类的具体用法?C# LiveConnectClient怎么用?C# LiveConnectClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LiveConnectClient类属于命名空间,在下文中一共展示了LiveConnectClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StreamCopyOperation
public StreamCopyOperation(
LiveConnectClient client,
ApiMethod method,
Stream inputStream,
Stream outputStream,
long contentLength,
object progress,
SynchronizationContextWrapper syncContext,
Action<bool, Exception> onCopyCompleted)
: base(syncContext)
{
Debug.Assert(client != null, "client must not be null.");
Debug.Assert(
method == ApiMethod.Download || method == ApiMethod.Upload,
"Only Download and Upload methods are allowed.");
Debug.Assert(inputStream.CanRead, "Input stream is not readable.");
Debug.Assert(outputStream.CanWrite, "Output stream is not writable.");
this.LiveClient = client;
this.Method = method;
this.InputStream = inputStream;
this.OutputStream = outputStream;
this.ContentLength = contentLength;
this.buffer = new byte[StreamCopyOperation.BufferSize];
this.copyCompletedCallback = onCopyCompleted;
this.progress = progress;
}
示例2: 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...
}
示例3: ForegroundUploadOperation
public ForegroundUploadOperation(LiveConnectClient client, Uri url, string filename, IFileSource inputFile, OverwriteOption option, IProgress<LiveOperationProgress> progress, SynchronizationContextWrapper syncContext)
: base(client, url, ApiMethod.Upload, null, syncContext)
{
this.Filename = filename;
this.Progress = progress;
this.OverwriteOption = option;
this.FileSource = inputFile;
}
示例4: CreateBackgroundDownloadOperation
/// <summary>
/// Creates a new TailoredDownloadOperation instance.
/// </summary>
public CreateBackgroundDownloadOperation(
LiveConnectClient client,
Uri url,
IStorageFile outputFile)
: base(client, url, ApiMethod.Download, null, null)
{
this.OutputFile = outputFile;
}
示例5: DownloadOperation
public DownloadOperation(
LiveConnectClient client,
Uri url,
object progress,
SynchronizationContextWrapper syncContext)
: base(client, url, ApiMethod.Download, null, syncContext)
{
this.progress = progress;
}
示例6: ApiWriteOperation
public ApiWriteOperation(
LiveConnectClient client,
Uri url,
ApiMethod method,
string body,
SynchronizationContextWrapper syncContext)
: base(client, url, method, body, syncContext)
{
}
示例7: GetUploadLinkOperation
public GetUploadLinkOperation(
LiveConnectClient client,
Uri url,
string fileName,
OverwriteOption option,
SynchronizationContextWrapper syncContext)
: base(client, url, ApiMethod.Get, null, syncContext)
{
this.FileName = fileName;
this.OverwriteOption = option;
}
示例8: TailoredDownloadOperation
/// <summary>
/// Creates a new TailoredDownloadOperation instance.
/// </summary>
public TailoredDownloadOperation(
LiveConnectClient client,
Uri url,
IStorageFile outputFile,
IProgress<LiveOperationProgress> progress,
SynchronizationContextWrapper syncContext)
: base(client, url, ApiMethod.Download, null, syncContext)
{
this.OutputFile = outputFile;
this.Progress = progress;
}
示例9: ApiOperation
/// <summary>
/// Constructs a new ApiOperation object.
/// </summary>
public ApiOperation(
LiveConnectClient client,
Uri url,
ApiMethod method,
string body,
SynchronizationContextWrapper syncContext)
: base(url, body, syncContext)
{
this.Method = method;
this.LiveClient = client;
}
示例10: TestExecute
public void TestExecute()
{
WebRequestFactory.Current = new TestWebRequestFactory();
LiveConnectClient connectClient = new LiveConnectClient(new LiveConnectSession());
Uri requestUri = new Uri("http://foo.com");
string fileName = string.Empty;
OverwriteOption overwriteOption = OverwriteOption.Overwrite;
SynchronizationContextWrapper syncContextWrapper = SynchronizationContextWrapper.Current;
var apiOperation =
new GetUploadLinkOperation(connectClient, requestUri, fileName, overwriteOption, syncContextWrapper);
}
示例11: TestExecute
public void TestExecute()
{
WebRequestFactory.Current = new TestWebRequestFactory();
LiveConnectClient connectClient = new LiveConnectClient(new LiveConnectSession());
Uri requestUri = new Uri("http://foo.com");
ApiMethod apiMethod = ApiMethod.Copy;
string body = string.Empty;
SynchronizationContextWrapper syncContextWrapper = SynchronizationContextWrapper.Current;
var apiOperation =
new ApiWriteOperation(connectClient, requestUri, apiMethod, body, syncContextWrapper);
}
示例12: checkSkyDriveInitiatedStart
public static void checkSkyDriveInitiatedStart(object sender, RoutedEventArgs e)
{
//Check to see if user is logged in
if (SkyDrive.Properties.LoggedIn)
{
//Check to see if SkyDrive is initiated for UltiDrive
LiveConnectClient client = new LiveConnectClient(SkyDrive.Properties.session);
client.GetCompleted += skydrive_checkInitiated;
client.GetAsync("me/skydrive/files"); //Get list of files in root directory of SkyDrive.
//END Check to see if SkyDrive is initiated for UltiDrive
}
}
示例13: TestDeleteNullPath
public void TestDeleteNullPath()
{
var connectClient = new LiveConnectClient(new LiveConnectSession());
try
{
connectClient.DeleteAsync(null);
Assert.Fail("Expected ArguementNullException to be thrown.");
}
catch (ArgumentNullException)
{
}
}
示例14: TestGetWhiteSpaceStringPath
public void TestGetWhiteSpaceStringPath()
{
var connectClient = new LiveConnectClient(new LiveConnectSession());
try
{
connectClient.GetAsync("\t\n ");
Assert.Fail("Expected ArguementException to be thrown.");
}
catch (ArgumentException)
{
}
}
示例15: TestExecute
public void TestExecute()
{
WebRequestFactory.Current = new TestWebRequestFactory();
var connectClient = new LiveConnectClient(new LiveConnectSession());
var requestUrl = new Uri("http://foo.com");
IStorageFile outputFile = new StorageFileStub();
IProgress<LiveOperationProgress> progress = new Progress<LiveOperationProgress>();
SynchronizationContextWrapper syncContext = SynchronizationContextWrapper.Current;
var tailoredDownloadOperation =
new TailoredDownloadOperation(connectClient, requestUrl, outputFile, progress, syncContext);
}