Ejemplo n.º 1
0
        public static void addGroup()
        {
            GroupServiceClient client = new GroupServiceClient();

            AuthHeader authHeader = new AuthHeader();

            HeaderUtil.loadHeader(authHeader);

            GroupType[] groups = new GroupType[1];
            GroupType   group  = new GroupType();

            group.campaignId          = 984757L;
            group.campaignIdSpecified = true;
            group.groupName           = "Demo_" + DateTime.Now.Ticks % 100000;
            group.price          = 1000;
            group.priceSpecified = true;
            group.status         = 0;
            group.type           = 0;
            groups[0]            = group;

            ResHeader resHeader = client.addGroup(authHeader, ref groups);

            Console.WriteLine("GroupService.addGroup(): ");
            ObjectDumper.WriteResponse(resHeader, groups);
        }
        public void ListGroupMembers()
        {
            // Snippet: ListGroupMembers(string,string,int?,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatGroupName("[PROJECT]", "[GROUP]");
            // Make the request
            IPagedEnumerable <ListGroupMembersResponse, MonitoredResource> response =
                groupServiceClient.ListGroupMembers(formattedName);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (MonitoredResource item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over fixed-sized pages, lazily performing RPCs as required
            int pageSize = 10;

            foreach (FixedSizePage <MonitoredResource> page in response.AsPages().WithFixedSize(pageSize))
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (MonitoredResource item in page)
                {
                    Console.WriteLine(item);
                }
            }
            // End snippet
        }
 /// <summary>Snippet for UpdateGroup</summary>
 public void UpdateGroup()
 {
     // Snippet: UpdateGroup(Group,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     Group group = new Group();
     // Make the request
     Group response = groupServiceClient.UpdateGroup(group);
     // End snippet
 }
 /// <summary>Snippet for GetGroup</summary>
 public void GetGroup()
 {
     // Snippet: GetGroup(GroupName,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     GroupName name = new GroupName("[PROJECT]", "[GROUP]");
     // Make the request
     Group response = groupServiceClient.GetGroup(name);
     // End snippet
 }
        public void DeleteGroup()
        {
            // Snippet: DeleteGroup(string,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatGroupName("[PROJECT]", "[GROUP]");

            // Make the request
            groupServiceClient.DeleteGroup(formattedName);
            // End snippet
        }
 /// <summary>Snippet for CreateGroup</summary>
 public void CreateGroup()
 {
     // Snippet: CreateGroup(ProjectName,Group,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     ProjectName name  = new ProjectName("[PROJECT]");
     Group       group = new Group();
     // Make the request
     Group response = groupServiceClient.CreateGroup(name, group);
     // End snippet
 }
        public async Task GetGroupAsync()
        {
            // Snippet: GetGroupAsync(string,CallSettings)
            // Additional: GetGroupAsync(string,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatGroupName("[PROJECT]", "[GROUP]");
            // Make the request
            Group response = await groupServiceClient.GetGroupAsync(formattedName);

            // End snippet
        }
        public async Task UpdateGroupAsync()
        {
            // Snippet: UpdateGroupAsync(Group,CallSettings)
            // Additional: UpdateGroupAsync(Group,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            Group group = new Group();
            // Make the request
            Group response = await groupServiceClient.UpdateGroupAsync(group);

            // End snippet
        }
        /// <summary>Snippet for DeleteGroupAsync</summary>
        public async Task DeleteGroupAsync()
        {
            // Snippet: DeleteGroupAsync(GroupName,CallSettings)
            // Additional: DeleteGroupAsync(GroupName,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = await GroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            GroupName name = new GroupName("[PROJECT]", "[GROUP]");
            // Make the request
            await groupServiceClient.DeleteGroupAsync(name);

            // End snippet
        }
Ejemplo n.º 10
0
        public static void getGroupIdByCampaignId()
        {
            GroupServiceClient client = new GroupServiceClient();

            AuthHeader authHeader = new AuthHeader();

            HeaderUtil.loadHeader(authHeader);

            long[]    result    = null;
            ResHeader resHeader = client.getGroupIdByCampaignId(authHeader, 984757L, out result);

            Console.WriteLine("GroupService.getGroupIdByCampaignId(): ");
            ObjectDumper.WriteResponse(resHeader, result);
        }
 /// <summary>Snippet for UpdateGroup</summary>
 public void UpdateGroup_RequestObject()
 {
     // Snippet: UpdateGroup(UpdateGroupRequest,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     UpdateGroupRequest request = new UpdateGroupRequest
     {
         Group = new Group(),
     };
     // Make the request
     Group response = groupServiceClient.UpdateGroup(request);
     // End snippet
 }
 /// <summary>Snippet for GetGroup</summary>
 public void GetGroup_RequestObject()
 {
     // Snippet: GetGroup(GetGroupRequest,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     GetGroupRequest request = new GetGroupRequest
     {
         GroupName = new GroupName("[PROJECT]", "[GROUP]"),
     };
     // Make the request
     Group response = groupServiceClient.GetGroup(request);
     // End snippet
 }
        public async Task CreateGroupAsync()
        {
            // Snippet: CreateGroupAsync(string,Group,CallSettings)
            // Additional: CreateGroupAsync(string,Group,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatProjectName("[PROJECT]");
            Group  group         = new Group();
            // Make the request
            Group response = await groupServiceClient.CreateGroupAsync(formattedName, group);

            // End snippet
        }
Ejemplo n.º 14
0
        // [END monitoring_get_resource]

        public static object ListGroups(string projectId)
        {
            GroupServiceClient client      = GroupServiceClient.Create();
            ProjectName        projectName = new ProjectName(projectId);
            ListGroupsRequest  request     = new ListGroupsRequest {
                Name = projectName.ToString()
            };
            PagedEnumerable <ListGroupsResponse, Group> groups = client.ListGroups(request);

            foreach (Group group in groups.Take(10))
            {
                Console.WriteLine($"{group.Name}: {group.DisplayName}");
            }
            return(0);
        }
 /// <summary>Snippet for CreateGroup</summary>
 public void CreateGroup_RequestObject()
 {
     // Snippet: CreateGroup(CreateGroupRequest,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     CreateGroupRequest request = new CreateGroupRequest
     {
         ProjectName = new ProjectName("[PROJECT]"),
         Group       = new Group(),
     };
     // Make the request
     Group response = groupServiceClient.CreateGroup(request);
     // End snippet
 }
Ejemplo n.º 16
0
        public static void getGroupByGroupId()
        {
            GroupServiceClient client = new GroupServiceClient();

            AuthHeader authHeader = new AuthHeader();

            HeaderUtil.loadHeader(authHeader);

            GroupType[] result = null;

            ResHeader resHeader = client.getGroupByGroupId(authHeader, new long[] { 3066118, 3066103 }, out result);

            Console.WriteLine("GroupService.getGroupByGroupId(): ");
            ObjectDumper.WriteResponse(resHeader, result);
        }
Ejemplo n.º 17
0
        /// <summary>Snippet for DeleteGroupAsync</summary>
        public async Task DeleteGroupAsync_RequestObject()
        {
            // Snippet: DeleteGroupAsync(DeleteGroupRequest,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = await GroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteGroupRequest request = new DeleteGroupRequest
            {
                GroupName = new GroupName("[PROJECT]", "[GROUP]"),
            };
            // Make the request
            await groupServiceClient.DeleteGroupAsync(request);

            // End snippet
        }
Ejemplo n.º 18
0
        /// <summary>Snippet for UpdateGroupAsync</summary>
        public async Task UpdateGroupAsync_RequestObject()
        {
            // Snippet: UpdateGroupAsync(UpdateGroupRequest,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = await GroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateGroupRequest request = new UpdateGroupRequest
            {
                Group = new Group(),
            };
            // Make the request
            Group response = await groupServiceClient.UpdateGroupAsync(request);

            // End snippet
        }
Ejemplo n.º 19
0
        public void ListGroups()
        {
            string projectId = _fixture.ProjectId;

            // Sample: ListGroups
            // Additional: ListGroups(*,*)
            GroupServiceClient client      = GroupServiceClient.Create();
            ProjectName        projectName = ProjectName.FromProject(projectId);
            PagedEnumerable <ListGroupsResponse, Group> groups = client.ListGroups(projectName);

            foreach (Group group in groups.Take(10))
            {
                Console.WriteLine($"{group.Name}: {group.DisplayName}");
            }
            // End sample
        }
        /// <summary>Snippet for ListGroupMembersAsync</summary>
        public async Task ListGroupMembersAsync_RequestObject()
        {
            // Snippet: ListGroupMembersAsync(ListGroupMembersRequest,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = await GroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListGroupMembersRequest request = new ListGroupMembersRequest
            {
                GroupName = new GroupName("[PROJECT]", "[GROUP]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListGroupMembersResponse, MonitoredResource> response =
                groupServiceClient.ListGroupMembersAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((MonitoredResource item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListGroupMembersResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (MonitoredResource item in page)
                {
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <MonitoredResource> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (MonitoredResource item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        private void btnAsyn_Click(object sender, EventArgs e)
        {
            try
            {
                GroupServiceClient gscAsyn = new GroupServiceClient();

                lblStatus.Visible = true;
                lblStatus.Text = "You can drag slider!";

                gscAsyn.GetGroupCompleted+=new EventHandler<GetGroupCompletedEventArgs>(gscAsyn_GetGroupCompleted);
                gscAsyn.GetGroupAsync();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 22
0
        private GroupForm(int profileId)
        {
            #region Initialize
            InitializeComponent();
            client   = new GroupServiceClient();
            cmGroups = new ContextMenu();
            cmGroups.MenuItems.Add(new MenuItem("Remove", MenuItemNewRemoveGroup_Click));
            cmMembers = new ContextMenu();
            cmMembers.MenuItems.Add(new MenuItem("Remove", MenuItemNewRemoveMember_Click));
            this.profileId = profileId;
            #endregion

            ButtonRefresh_Click(null, null);
            GetUsers(onlineCheckBox.Checked == true);
            txtUserName.Enabled = false;
            BtnAddUser.Enabled  = false;
        }
        /// <summary>Snippet for ListGroups</summary>
        public void ListGroups_RequestObject()
        {
            // Snippet: ListGroups(ListGroupsRequest,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            ListGroupsRequest request = new ListGroupsRequest
            {
                ProjectName = new ProjectName("[PROJECT]"),
            };
            // Make the request
            PagedEnumerable <ListGroupsResponse, Group> response =
                groupServiceClient.ListGroups(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Group item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListGroupsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Group item in page)
                {
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int          pageSize   = 10;
            Page <Group> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Group item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for GetGroupAsync</summary>
        public async Task GetGroupAsync_RequestObject()
        {
            // Snippet: GetGroupAsync(GetGroupRequest,CallSettings)
            // Additional: GetGroupAsync(GetGroupRequest,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = await GroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetGroupRequest request = new GetGroupRequest
            {
                GroupName = new GroupName("[PROJECT]", "[GROUP]"),
            };
            // Make the request
            Group response = await groupServiceClient.GetGroupAsync(request);

            // End snippet
        }
        /// <summary>Snippet for CreateGroupAsync</summary>
        public async Task CreateGroupAsync_RequestObject()
        {
            // Snippet: CreateGroupAsync(CreateGroupRequest,CallSettings)
            // Additional: CreateGroupAsync(CreateGroupRequest,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = await GroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateGroupRequest request = new CreateGroupRequest
            {
                ProjectName = new ProjectName("[PROJECT]"),
                Group       = new Group(),
            };
            // Make the request
            Group response = await groupServiceClient.CreateGroupAsync(request);

            // End snippet
        }
        private void btnSync_Click(object sender, EventArgs e)
        {
            try
            {
                GroupServiceClient gscSync = new GroupServiceClient();

                lblStatus.Visible = true;
                lblStatus.Text = "You cannot drag slider now!";

                lblGroupName.Visible = true;
                lblGroupName.Text = gscSync.GetGroup().GroupName;
                lblMembersName.Visible = true;
                lblMembersName.Text = gscSync.GetGroup().GroupMembers;

                lblStatus.Text = "You can drag slider now!";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 27
0
        public static void updateGroup()
        {
            GroupServiceClient client = new GroupServiceClient();

            AuthHeader authHeader = new AuthHeader();

            HeaderUtil.loadHeader(authHeader);

            GroupType[] parameters = new GroupType[1];
            GroupType   type       = new GroupType();

            parameters[0]         = type;
            type.groupId          = 3066118L;
            type.groupIdSpecified = true;
            type.status           = 0;
            type.price            = 10;
            type.statusSpecified  = true;
            type.groupName        = "Demo_" + DateTime.Now.Ticks % 100000;

            ResHeader resHeader = client.updateGroup(authHeader, ref parameters);

            Console.WriteLine("GroupService.updateGroup(): ");
            ObjectDumper.WriteResponse(resHeader, parameters);
        }