private async void ExecuteButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(this.pathTextBox.Text))
{
this.LogOutput("Path cannot be empty.");
return;
}
try
{
LiveOperationResult result = null;
switch (this.methodComboBox.Text)
{
case "GET":
result = await this.liveConnectClient.GetAsync(this.pathTextBox.Text);
break;
case "PUT":
result = await this.liveConnectClient.PutAsync(this.pathTextBox.Text, this.requestBodyTextBox.Text);
break;
case "POST":
result = await this.liveConnectClient.PostAsync(this.pathTextBox.Text, this.requestBodyTextBox.Text);
break;
case "DELETE":
result = await this.liveConnectClient.DeleteAsync(this.pathTextBox.Text);
break;
case "MOVE":
result = await this.liveConnectClient.MoveAsync(this.pathTextBox.Text, this.destPathTextBox.Text);
break;
case "COPY":
result = await this.liveConnectClient.CopyAsync(this.pathTextBox.Text, this.destPathTextBox.Text);
break;
case "UPLOAD":
result = await this.UploadFile(this.pathTextBox.Text);
break;
case "DOWNLOAD":
await this.DownloadFile(this.pathTextBox.Text);
this.LogOutput("The download operation is completed.");
break;
}
if (result != null)
{
this.LogOutput(this.methodComboBox.Text + "\t" + this.pathTextBox.Text);
this.LogOutput(JsonHelper.FormatJson(result.RawResult));
this.LogOutput(string.Empty);
}
}
catch (Exception ex)
{
this.LogOutput("Received an error. " + ex.Message);
}
}
|