using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Grpc.Net.Client;
using Grpc.Core;
using Saleae.Automation;
using Google.Protobuf;

namespace Saleae_Interface
{
    public partial class Form1 : Form
    {
        private readonly Uri server = new Uri("http://localhost:10430", UriKind.Absolute);

        public Form1()
        {
            InitializeComponent();
        }

        private async void button1_Click(object sender, EventArgs e)
        {
            using (GrpcChannel channel = GrpcChannel.ForAddress(server))
            {
                Manager.ManagerClient client = new Manager.ManagerClient(channel);
                GetDevicesRequest gdr = new GetDevicesRequest { IncludeSimulationDevices = false };
                GetDevicesReply response = client.GetDevices(gdr);
                Task task = channel.ShutdownAsync();
                await task;
            }
        }
    }
}
