コード例 #1
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     this.dGVData.Rows.Clear();
     Pilha       = new CPilha(Tamanho);
     Fila        = new CFila(Tamanho);
     Lista       = new CLista(Tamanho);
     Arvore      = new Arvore(Tamanho);
     Hash        = new TabelaHash(Tamanho);
     this.indice = 0;
 }
コード例 #2
0
        private void btnopen_OnClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            if (open.ShowDialog() == true)
            {
                txtfile.Text = open.FileName;
                if (System.IO.Path.GetFileNameWithoutExtension(open.FileName).ToUpper() == "PASSAGEIROS")
                {
                    table = new TabelaHash(1600);
                    using (StreamReader read = new StreamReader(open.FileName))
                    {
                        string line;
                        while ((line = read.ReadLine()) != null)
                        {
                            string[]   spt = line.Split(';');
                            Passageiro aux = new Passageiro(spt[0], spt[1]);
                            passageiros.Add(aux);
                            table.Inserir(aux);
                        }
                        listpassageiros.ItemsSource = passageiros;
                    }
                }
                else if (System.IO.Path.GetFileNameWithoutExtension(open.FileName).ToUpper() == "RESERVAS")
                {
                    using (StreamReader read = new StreamReader(open.FileName))
                    {
                        string line;
                        while ((line = read.ReadLine()) != null)
                        {
                            string[]   spt = line.Split(';');
                            Passageiro aux = table.Buscar(spt[0]);
                            if (aux != null)
                            {
                                aux.Reservas.Add(spt[1]);
                            }
                        }
                        listpassageiros.ItemsSource = passageiros;
                    }
                }
            }
        }