本文整理汇总了C#中Microsoft.Live.LiveConnectClient.PutAsync方法的典型用法代码示例。如果您正苦于以下问题:C# LiveConnectClient.PutAsync方法的具体用法?C# LiveConnectClient.PutAsync怎么用?C# LiveConnectClient.PutAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Live.LiveConnectClient
的用法示例。
在下文中一共展示了LiveConnectClient.PutAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunButton_Click
private async void RunButton_Click(object sender, RoutedEventArgs e)
{
try
{
// Validate parameters
string path = pathTextBox.Text;
string destination = destinationTextBox.Text;
string requestBody = requestBodyTextBox.Text;
var scope = (authScopesComboBox.SelectedValue as ComboBoxItem).Content as string;
var method = (methodsComboBox.SelectedValue as ComboBoxItem).Content as string;
// acquire auth permissions
var authClient = new LiveAuthClient();
var authResult = await authClient.LoginAsync(new string[] { scope });
if (authResult.Session == null)
{
throw new InvalidOperationException("You need to login and give permission to the app.");
}
var liveConnectClient = new LiveConnectClient(authResult.Session);
LiveOperationResult operationResult = null;
switch (method)
{
case "GET":
operationResult = await liveConnectClient.GetAsync(path);
break;
case "POST":
operationResult = await liveConnectClient.PostAsync(path, requestBody);
break;
case "PUT":
operationResult = await liveConnectClient.PutAsync(path, requestBody);
break;
case "DELETE":
operationResult = await liveConnectClient.DeleteAsync(path);
break;
case "COPY":
operationResult = await liveConnectClient.CopyAsync(path, destination);
break;
case "MOVE":
operationResult = await liveConnectClient.MoveAsync(path, destination);
break;
}
if (operationResult != null)
{
Log("Operation succeeded: \r\n" + operationResult.RawResult);
}
}
catch (Exception ex)
{
Log("Got error: " + ex.Message);
}
}
示例2: ButtonOK_Click
void ButtonOK_Click(object sender, RoutedEventArgs e)
{
//Is 'new list name' TextBox.Text Empty?
if (editNameDlg.DialogData.Text.Trim() != String.Empty)
{
Dictionary<string, object> fileData = new Dictionary<string, object>();
fileData.Add("name", editNameDlg.DialogData.Text.Trim() + ".txt");
editNameDlg.Deactivate();
//Set SystemTray.ProgressIndicator
ProgressIndicator prog = new ProgressIndicator();
prog.IsIndeterminate = true;
prog.IsVisible = true;
prog.Text = "File renaming...";
SystemTray.SetProgressIndicator(this, prog);
LiveConnectClient client = new LiveConnectClient(this.LiveSession);
client.PutCompleted += new EventHandler<LiveOperationCompletedEventArgs>(client_PutCompleted);
client.PutAsync(this.renameFileId, fileData);
}
}