/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="campaignId">The campaign ID.</param> /// <param name="videoId">The Youtube video ID.</param> public void Run(AdWordsUser user, long campaignId, string videoId) { // Get the VideoTargetingGroupService. VideoTargetingGroupService videoTargetingGroupService = (VideoTargetingGroupService)user.GetService( AdWordsService.v201406.VideoTargetingGroupService); TargetingGroup targetingGroup = new TargetingGroup(); targetingGroup.campaignId = campaignId; targetingGroup.name = "My Targeting Group " + ExampleUtilities.GetRandomString(); try { TargetingGroupOperation operation = new TargetingGroupOperation(); operation.operand = targetingGroup; operation.@operator = Operator.ADD; TargetingGroupReturnValue retval = videoTargetingGroupService.mutate( new TargetingGroupOperation[] { operation }); if (retval != null && retval.value != null && retval.value.Length > 0) { TargetingGroup newTargetingGroup = retval.value[0]; Console.WriteLine("New targeting group with id = {0}, name = {1} was created in " + "campaign id {2}", newTargetingGroup.id, newTargetingGroup.name, newTargetingGroup.campaignId); } else { Console.WriteLine("No targeting group was created."); } } catch (Exception ex) { throw new System.ApplicationException("Failed to create targeting group.", ex); } }
public void SetTargetingGroup(TargetingGroup newTG) { TargetingGroup oldTG = targetingGroup; // check if the change in targeting groups means it has gone active > inactive or vice versa if (activeTargetingGroups.Contains(oldTG) && !activeTargetingGroups.Contains(newTG)) { OnTGNewlyRemoved(); } if (!activeTargetingGroups.Contains(oldTG) && activeTargetingGroups.Contains(newTG)) { OnTGNewlyAdded(); } targetingGroup = newTG; }
void OnPickUp() { // make valid card slots targetable TargetingGroup emptyTG = TargetingGroup.NOT_ASSIGNED; if (template.cat == CardCategory.Operative) { emptyTG = TargetingGroup.EmptyMyOperativeSlot; } else if (template.cat == CardCategory.Policy) { emptyTG = TargetingGroup.EmptyPolicySlot; } MouseTargetable.SetActiveTargetingGroups(new List <TargetingGroup> { TargetingGroup.DraggedObject, emptyTG }); sortingLayerManager.SetSortingLayer("DraggedCard"); }
/// Helper method for when setting single TGs public static void SetActiveTargetingGroup(TargetingGroup targetingGroup) { SetActiveTargetingGroups(new List <TargetingGroup> { targetingGroup }); }