/// <summary> /// Creates a label for test purposes. /// </summary> /// <param name="user">The AdWords user.</param> /// <returns>ID of the newly created label.</returns> public long CreateLabel(AdWordsUser user) { LabelService labelService = (LabelService)user.GetService(AdWordsService.v201806.LabelService); // Create the campaign budget. TextLabel label = new TextLabel() { name = "Interplanetary Cruise Label #" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"), }; LabelOperation labelOperation = new LabelOperation() { @operator = Operator.ADD, operand = label }; LabelReturnValue labelRetval = labelService.mutate(new LabelOperation[] { labelOperation }); return(labelRetval.value[0].id); }
//--------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Handles the Click event of the button_TestConnection control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void button_TestConnection_Click(object sender, EventArgs e) { label_connection.Show(); this.Refresh(); LabelOperation labelOperation = new LabelOperation(TestConnection); labelOperation.BeginInvoke(LabelOperationCallBack, null); }
//--------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Hides the connection label. /// </summary> private void HideConnectionLabel() { if (label_connection.InvokeRequired) { LabelOperation labelOperation = new LabelOperation(HideConnectionLabel); label_connection.Invoke(labelOperation); } else { label_connection.Visible = false; } }
/// <summary>Snippet for MutateLabels</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateLabels() { // Create client LabelServiceClient labelServiceClient = LabelServiceClient.Create(); // Initialize request argument(s) string customerId = ""; IEnumerable <LabelOperation> operations = new LabelOperation[] { new LabelOperation(), }; // Make the request MutateLabelsResponse response = labelServiceClient.MutateLabels(customerId, operations); }
/// <summary>Snippet for MutateLabelsAsync</summary> public async Task MutateLabelsAsync() { // Snippet: MutateLabelsAsync(string, IEnumerable<LabelOperation>, CallSettings) // Additional: MutateLabelsAsync(string, IEnumerable<LabelOperation>, CancellationToken) // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <LabelOperation> operations = new LabelOperation[] { new LabelOperation(), }; // Make the request MutateLabelsResponse response = await labelServiceClient.MutateLabelsAsync(customerId, operations); // End snippet }
//--------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Handles the Click event of the button_TestConnection control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void button_TestConnection_Click(object sender, EventArgs e) { label_connection.Show(); this.Refresh(); LabelOperation labelOperation = new LabelOperation(TestConnection); labelOperation.BeginInvoke(LabelOperationCallBack, null); }
//--------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Hides the connection label. /// </summary> private void HideConnectionLabel() { if (label_connection.InvokeRequired) { LabelOperation labelOperation = new LabelOperation(HideConnectionLabel); label_connection.Invoke(labelOperation); } else { label_connection.Visible = false; } }