Example #1
0
        /// <summary>Snippet for UpdateIndex</summary>
        public void UpdateIndexRequestObject()
        {
            // Snippet: UpdateIndex(UpdateIndexRequest, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = IndexServiceClient.Create();
            // Initialize request argument(s)
            UpdateIndexRequest request = new UpdateIndexRequest
            {
                Index      = new gcav::Index(),
                UpdateMask = new FieldMask(),
            };
            // Make the request
            Operation <gcav::Index, UpdateIndexOperationMetadata> response = indexServiceClient.UpdateIndex(request);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, UpdateIndexOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            gcav::Index result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <gcav::Index, UpdateIndexOperationMetadata> retrievedResponse = indexServiceClient.PollOnceUpdateIndex(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcav::Index retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Example #2
0
        /// <summary>Snippet for CreateIndexAsync</summary>
        public async Task CreateIndexRequestObjectAsync()
        {
            // Snippet: CreateIndexAsync(CreateIndexRequest, CallSettings)
            // Additional: CreateIndexAsync(CreateIndexRequest, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateIndexRequest request = new CreateIndexRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Index = new gcav::Index(),
            };
            // Make the request
            Operation <gcav::Index, CreateIndexOperationMetadata> response = await indexServiceClient.CreateIndexAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, CreateIndexOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            gcav::Index result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <gcav::Index, CreateIndexOperationMetadata> retrievedResponse = await indexServiceClient.PollOnceCreateIndexAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcav::Index retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Example #3
0
        /// <summary>Snippet for UpdateIndexAsync</summary>
        public async Task UpdateIndexAsync()
        {
            // Snippet: UpdateIndexAsync(Index, FieldMask, CallSettings)
            // Additional: UpdateIndexAsync(Index, FieldMask, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            gcav::Index index      = new gcav::Index();
            FieldMask   updateMask = new FieldMask();
            // Make the request
            Operation <gcav::Index, UpdateIndexOperationMetadata> response = await indexServiceClient.UpdateIndexAsync(index, updateMask);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, UpdateIndexOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            gcav::Index result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <gcav::Index, UpdateIndexOperationMetadata> retrievedResponse = await indexServiceClient.PollOnceUpdateIndexAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcav::Index retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Example #4
0
        /// <summary>Snippet for CreateIndex</summary>
        public void CreateIndexResourceNames()
        {
            // Snippet: CreateIndex(LocationName, Index, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = IndexServiceClient.Create();
            // Initialize request argument(s)
            LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
            gcav::Index  index  = new gcav::Index();
            // Make the request
            Operation <gcav::Index, CreateIndexOperationMetadata> response = indexServiceClient.CreateIndex(parent, index);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, CreateIndexOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            gcav::Index result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <gcav::Index, CreateIndexOperationMetadata> retrievedResponse = indexServiceClient.PollOnceCreateIndex(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcav::Index retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Example #5
0
        public List <CsCasind> JSON_teseData()
        {
            IndexServiceClient service = new IndexServiceClient();

            return(service.RetourneListeDesCas(string.Empty, string.Empty));
            //return new List<CsEvenement>();
        }
Example #6
0
        /// <summary>Snippet for DeleteIndex</summary>
        public void DeleteIndex()
        {
            // Snippet: DeleteIndex(string, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = IndexServiceClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/indexes/[INDEX]";
            // Make the request
            Operation <Empty, DeleteOperationMetadata> response = indexServiceClient.DeleteIndex(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, DeleteOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, DeleteOperationMetadata> retrievedResponse = indexServiceClient.PollOnceDeleteIndex(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Example #7
0
        public List <CsEvenement> JSON_EvenementsData(string NumLot, string Centre, string Tournee)
        {
            IndexServiceClient service = new IndexServiceClient();

            return(service.RetourneListeLotSelonCritere(NumLot, Centre, Tournee));
            //return new List<CsEvenement>();
        }
Example #8
0
        /// <summary>Snippet for DeleteIndexAsync</summary>
        public async Task DeleteIndexResourceNamesAsync()
        {
            // Snippet: DeleteIndexAsync(IndexName, CallSettings)
            // Additional: DeleteIndexAsync(IndexName, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            IndexName name = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]");
            // Make the request
            Operation <Empty, DeleteOperationMetadata> response = await indexServiceClient.DeleteIndexAsync(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, DeleteOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, DeleteOperationMetadata> retrievedResponse = await indexServiceClient.PollOnceDeleteIndexAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Example #9
0
        private void ConnectToServer()
        {
            //default ports
            string NETport = "808";


            if (!string.IsNullOrEmpty(textBoxNetTcpPort.Text))
            {
                NETport = textBoxNetTcpPort.Text;
            }

            IndexServiceClient proxy = new IndexServiceClient();

            proxy.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
                X509CertificateValidationMode.None;
            proxy.ClientCredentials.UserName.UserName = textBoxUserName.Text;
            proxy.ClientCredentials.UserName.Password = textBoxPassword.Text;

            string NETUrl = "net.tcp://" + textBoxURL.Text + ":" + NETport + "/IndexService";

            string dnsIdentity = null; // use localhost for test certificate

            if (!string.IsNullOrEmpty(textBoxCertDomain.Text))
            {
                dnsIdentity = textBoxCertDomain.Text;
            }
            else
            {
                dnsIdentity = textBoxURL.Text;
            }

            EndpointIdentity identity = EndpointIdentity.CreateDnsIdentity(dnsIdentity);

            proxy.Endpoint.Address = new EndpointAddress(new Uri(NETUrl), identity);

            try
            {
                proxy.Open();
                proxy.GetIndexStatus();
                MessageBox.Show("Connection OK.");
                proxy.Close();
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    MessageBox.Show(e.InnerException.Message + Environment.NewLine + e.Message);
                }
                else
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
Example #10
0
 /// <summary>Snippet for GetIndex</summary>
 public void GetIndex()
 {
     // Snippet: GetIndex(string, CallSettings)
     // Create client
     IndexServiceClient indexServiceClient = IndexServiceClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/indexes/[INDEX]";
     // Make the request
     gcav::Index response = indexServiceClient.GetIndex(name);
     // End snippet
 }
Example #11
0
 /// <summary>Snippet for GetIndex</summary>
 public void GetIndexResourceNames()
 {
     // Snippet: GetIndex(IndexName, CallSettings)
     // Create client
     IndexServiceClient indexServiceClient = IndexServiceClient.Create();
     // Initialize request argument(s)
     IndexName name = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]");
     // Make the request
     gcav::Index response = indexServiceClient.GetIndex(name);
     // End snippet
 }
Example #12
0
        /// <summary>Snippet for ListIndexesAsync</summary>
        public async Task ListIndexesRequestObjectAsync()
        {
            // Snippet: ListIndexesAsync(ListIndexesRequest, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListIndexesRequest request = new ListIndexesRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Filter   = "",
                ReadMask = new FieldMask(),
            };
            // Make the request
            PagedAsyncEnumerable <ListIndexesResponse, gcav::Index> response = indexServiceClient.ListIndexesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((gcav::Index 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((ListIndexesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (gcav::Index item in page)
                {
                    // Do something with each item
                    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 <gcav::Index> 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 (gcav::Index item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Example #13
0
 public string JSON_saveEventData(string Event)
 {
     try
     {
         IndexServiceClient service = new IndexServiceClient();
         string[]           Param   = Event.Split(',');
         return(service.MiseAJourEvenementTSP(Param[0], Param[1], Param[2], Param[3], Param[4], Param[5], Param[6], Param[7], Param[8], Param[9], Param[10]));
         //return Event;
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Example #14
0
 /// <summary>Snippet for GetIndex</summary>
 public void GetIndexRequestObject()
 {
     // Snippet: GetIndex(GetIndexRequest, CallSettings)
     // Create client
     IndexServiceClient indexServiceClient = IndexServiceClient.Create();
     // Initialize request argument(s)
     GetIndexRequest request = new GetIndexRequest
     {
         IndexName = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]"),
     };
     // Make the request
     gcav::Index response = indexServiceClient.GetIndex(request);
     // End snippet
 }
Example #15
0
        /// <summary>Snippet for GetIndexAsync</summary>
        public async Task GetIndexAsync()
        {
            // Snippet: GetIndexAsync(string, CallSettings)
            // Additional: GetIndexAsync(string, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/indexes/[INDEX]";
            // Make the request
            gcav::Index response = await indexServiceClient.GetIndexAsync(name);

            // End snippet
        }
Example #16
0
        /// <summary>Snippet for GetIndexAsync</summary>
        public async Task GetIndexResourceNamesAsync()
        {
            // Snippet: GetIndexAsync(IndexName, CallSettings)
            // Additional: GetIndexAsync(IndexName, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            IndexName name = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]");
            // Make the request
            gcav::Index response = await indexServiceClient.GetIndexAsync(name);

            // End snippet
        }
Example #17
0
 /// <inheritdoc />
 public IndexApplicationService(
     IndexServiceClient indexServiceClient,
     UnitOfWork unitOfWork,
     ICaseRepository caseRepository,
     ILogger logger,
     PhoneHubMessageService phoneHubMessageService,
     IMapper mapper)
 {
     _indexServiceClient     = indexServiceClient;
     _unitOfWork             = unitOfWork;
     _caseRepository         = caseRepository;
     _logger                 = logger;
     _phoneHubMessageService = phoneHubMessageService;
     _mapper                 = mapper;
 }
Example #18
0
        private void button1_Click(object sender, EventArgs e)
        {
            //TODO :  add this to a list
            Server server = new Server
            {
                name     = "localhost",
                port     = "808",
                userName = "******",
                passWord = "******",
                url      = "net.tcp://localhost/IndexService" /// dela upp denna strängen
            };

            IndexServiceClient proxy = new IndexServiceClient();

            proxy.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
                X509CertificateValidationMode.None;
            proxy.ClientCredentials.UserName.UserName = server.userName;
            proxy.ClientCredentials.UserName.Password = server.passWord;

            proxy.Endpoint.Address = new EndpointAddress(new Uri(server.url));
            try
            {
                proxy.Open();
                if (!proxy.GetIndexStatus())
                {
                    MessageBox.Show("Server is not ready");
                }
                else
                {
                    var startTime = DateTime.Now;
                    var result    = proxy.Search(textBoxName.Text, textBoxExtension.Text);
                    List <IndexServiceReference.IndexFile> lst =
                        result.OfType <IndexServiceReference.IndexFile>().ToList();
                    var resultTime = (DateTime.Now - startTime);
                    labelSearchTimeValue.Text = resultTime.TotalMilliseconds + "millisec";
                    PopulateListView(lst);
                    labelFilesValue.Text = lst.Count.ToString();
                }

                proxy.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection failed: " + ex.Message);
            }
        }
Example #19
0
        /// <summary>Snippet for ListIndexes</summary>
        public void ListIndexesResourceNames()
        {
            // Snippet: ListIndexes(LocationName, string, int?, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = IndexServiceClient.Create();
            // Initialize request argument(s)
            LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
            // Make the request
            PagedEnumerable <ListIndexesResponse, gcav::Index> response = indexServiceClient.ListIndexes(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (gcav::Index 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 (ListIndexesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (gcav::Index item in page)
                {
                    // Do something with each item
                    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 <gcav::Index> 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 (gcav::Index item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Example #20
0
        public List <CsLotri> JSONData(string NumPortable)
        {
            IndexServiceClient service = new IndexServiceClient();

            return(service.RetourneListeLotNonTraiteParReleveur(NumPortable));
        }