Пример #1
0
        async public Task <string> Tst(MovieServiceClient client)
        {
            Movie m = new Movie();

            m = await client.GetMovieAsync(1);

            Console.WriteLine(m.Protagonist);
            //await client.UpdateMovieAsync(m);
            return(null);
        }
Пример #2
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            MovieServiceClient proxy = new MovieServiceClient();

            IEnumerable <MovieData> datas = proxy.GetDirectorNames();

            if (datas != null)
            {
                LstDirectors.ItemsSource = datas;
            }

            proxy.Close();
        }
Пример #3
0
        private async void GetAllVideos_Click(object sender, EventArgs e)
        {
            MovieServiceClient client = new MovieServiceClient("NetTcpBinding_IMovieService");
            var videos = await client.GetAllAsync();

            client.Close();
            foreach (var video in videos)
            {
                ListViewItem item = new ListViewItem(video.Name);
                item.SubItems.Add(video.DateAdded.ToString());
                item.SubItems.Add(video.Description);
                VideoList.Items.Add(item);
            }
        }
        public void Setup()
        {
            // If you don't generate certificate -> use this code
            //var httpHandler = new HttpClientHandler();
            //// Return `true` to allow certificates that are untrusted/invalid
            //httpHandler.ServerCertificateCustomValidationCallback =
            //    HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

            channel = GrpcChannel.ForAddress("https://localhost:5001"); // new GrpcChannelOptions { HttpHandler = httpHandler }
            client  = new Greeter.GreeterClient(channel);

            channelMovie = GrpcChannel.ForAddress("https://localhost:5001"); // new GrpcChannelOptions { HttpHandler = httpHandler }
            movieClient  = new MovieServiceClient(channelMovie);
        }
Пример #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Press <Enter> to run the client...");
            Console.ReadLine();



            var client = new MovieServiceClient("WSHttpBinding_IMovieService");

            foreach (var movies in client.GetMovies())
            {
                Console.WriteLine(movies.Title + " / " + movies.Rating);
            }

            Console.ReadLine();
        }
        public async Task <IActionResult> OnGetAsync(int id)
        {
            MovieServiceClient client = new MovieServiceClient(MovieServiceClient.EndpointConfiguration.NetTcpBinding_IMovieService);
            var result = await client.GetByFilterAsync(new MovieFilter { Id = id });

            if (SearchText.Length >= 1)
            {
                this.ExtraProperties = result.FirstOrDefault().MovieExtraProperties.OrderBy(x => x.PropertyName)
                                       .Where(x => x.PropertyName.ToLower().Contains(SearchText) || x.PropertyValue.ToLower().Contains(SearchText))
                                       .ToArray();
            }
            else
            {
                this.ExtraProperties = result.FirstOrDefault().MovieExtraProperties.OrderBy(x => x.PropertyName).ToArray();
            }
            await client.CloseAsync();

            return(Page());
        }
Пример #7
0
        static void Main(string[] args)
        {
            MovieServiceClient client = new MovieServiceClient();

            // Use a variável 'client' para chamar as operações no serviço.

            // Sempre feche o cliente.
            //client.GetMovieAsync(2);
            //Movie m = new Movie();
            //client.UpdateMovieAsync(m);
            clsTst t = new clsTst();

            t.Tst(client);


            //Console.WriteLine(client.)

            //client.Close();

            // Console.WriteLine("Hello World!");
        }
Пример #8
0
        public async Task <IActionResult> OnGetAsync()
        {
            MovieServiceClient client = new MovieServiceClient(MovieServiceClient.EndpointConfiguration.NetTcpBinding_IMovieService);

            if (SearchText.Length >= 3)
            {
                DateTime dateSearch;
                try
                {
                    dateSearch = DateTime.Parse(SearchText);
                }
                catch
                {
                    dateSearch = new DateTime();
                }
                int idSearch;
                try
                {
                    idSearch = Convert.ToInt32(SearchText);
                }
                catch
                {
                    idSearch = 0;
                }
                this.Videos = (await client.GetAllAsync()).Where(x => x.Description.ToLower().Contains(SearchText) ||
                                                                 x.DateAdded == dateSearch ||
                                                                 x.Name.ToLower().Contains(SearchText) ||
                                                                 x.Path.ToLower().Contains(SearchText) ||
                                                                 x.PathChanged.ToString() == SearchText ||
                                                                 x.Id.ToString().Contains(idSearch.ToString())).ToArray();
            }
            else
            {
                this.Videos = await client.GetAllAsync();
            }
            await client.CloseAsync();

            return(Page());
        }
 public MovieGateway()
 {
     _grpcChannel        = GrpcChannel.ForAddress("https://localhost:5001");
     _movieServiceClient = new MovieServiceClient(_grpcChannel);
 }
 public MovieServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(MovieServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public MovieServiceClient(EndpointConfiguration endpointConfiguration) :
     base(MovieServiceClient.GetBindingForEndpoint(endpointConfiguration), MovieServiceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public MovieServiceClient() :
     base(MovieServiceClient.GetDefaultBinding(), MovieServiceClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IMovieService.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(MovieServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IMovieService));
 }
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(MovieServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IMovieService));
 }
Пример #15
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            MovieServiceClient proxy = new MovieServiceClient();

            IEnumerable<MovieData> datas = proxy.GetDirectorNames();

            if (datas != null)
            {
                LstDirectors.ItemsSource = datas;
            }

            proxy.Close();

        }