public MainPage(int observerServerPort, Client myClient)
        {
            this.myClient = myClient;
            InitializeComponent();
            this.observerServerPort = observerServerPort;
            Task.Run(() => checkForUpdate());


            TTransport transport = new TSocket("localhost", 9091);
            TProtocol  protocol  = new TBinaryProtocol(transport);

            transport.Open();

            TransformerService.Client client = new TransformerService.Client(protocol);
            List <MeciDTO>            dtos   = client.findAllMeci();

            meciuriData = retreive(dtos);
            transport.Close();

            MessageServer messageServer = new MessageServer(observerServerPort); // start mini-server as observer on the client

            PopulateMeciTable();
            this.locuriCBox.Text            = "0";
            this.listaMeciuri.FullRowSelect = true;
        }
        private void checkForUpdatesImpl(bool isUpdate)
        {
            if (isUpdate)
            {
                PopulateMeciTable();
            }
            else
            {
                TTransport transport = new TSocket("localhost", 9091);
                TProtocol  protocol  = new TBinaryProtocol(transport);
                transport.Open();

                TransformerService.Client client = new TransformerService.Client(protocol);
                var dtos = client.findAllMeci();
                transport.Close();
                meciuriData = retreive(dtos);

                PopulateMeciTable();
            }
        }
        private void PopulateMeciTable()
        {
            listaMeciuri.Items.Clear();



            TTransport transport = new TSocket("localhost", 9091);
            TProtocol  protocol  = new TBinaryProtocol(transport);

            transport.Open();

            TransformerService.Client client = new TransformerService.Client(protocol);
            var dtos = client.findAllMeci();

            transport.Close();

            var all = retreive(dtos);

            foreach (Meci s in all)
            {
                if (s.numarBileteDisponibile > 0)
                {
                    var row = new string[] { s.id, s.home, s.away, s.date.ToShortDateString(), s.numarBileteDisponibile.ToString() };
                    var lvi = new ListViewItem(row);
                    listaMeciuri.Items.Add(lvi);
                    lvi.Tag = s;
                }
                else
                {
                    var          row = new string[] { s.id, s.home, s.away, s.date.ToShortDateString(), "SOLD OUT" };
                    ListViewItem lvi = new ListViewItem(row);
                    lvi.ForeColor = Color.Red;
                    listaMeciuri.Items.Add(lvi);
                    lvi.Tag = s;
                }
            }
        }