Beispiel #1
0
        private void btnInserirAresta_Click(object sender, RoutedEventArgs e)
        {
            thriftGrafo.Aresta a = new thriftGrafo.Aresta();

            a.VerticeInicio    = Convert.ToInt32(txtVerticeOrigemAresta.Text);
            a.VerticeFim       = Convert.ToInt32(txtVerticeDestinoAresta.Text);
            a.Descricao        = txtDescricaoAresta.Text;
            a.Peso             = Convert.ToDouble(txtPesoAresta.Text);
            a.FlagBidirecional = (cbBidirecionalAresta.SelectedIndex == 0 ? true : false);

            Retorno r = client.insertAresta(a);

            if (r.Sucesso)
            {
                txtVerticeOrigemAresta.Text        = "";
                txtVerticeDestinoAresta.Text       = "";
                txtDescricaoAresta.Text            = "";
                txtPesoAresta.Text                 = "";
                cbBidirecionalAresta.SelectedIndex = 1;
                MessageBox.Show(r.Mensagem);
            }
            else
            {
                MessageBox.Show(r.Mensagem);
            }
        }
Beispiel #2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.List)
                        {
                            {
                                Vertices = new List <Vertice>();
                                TList _list0 = iprot.ReadListBegin();
                                for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                                {
                                    Vertice _elem2;
                                    _elem2 = new Vertice();
                                    _elem2.Read(iprot);
                                    Vertices.Add(_elem2);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                Arestas = new List <Aresta>();
                                TList _list3 = iprot.ReadListBegin();
                                for (int _i4 = 0; _i4 < _list3.Count; ++_i4)
                                {
                                    Aresta _elem5;
                                    _elem5 = new Aresta();
                                    _elem5.Read(iprot);
                                    Arestas.Add(_elem5);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }