예제 #1
0
        public async Task CarregarDados()
        {
            string dados = LeitorArquivo.Ler("/CompreAqui;component/Resources/dados.txt");

            Loja.Dados = JsonConvert.DeserializeObject <Loja>(dados);
            await Task.Delay(3000);
        }
예제 #2
0
        /// <summary>
        /// Lê o arquivo com as informações das aulas, gera o grafo e exibe ele na tela
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGerarGrafo_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                FileInfo info = new FileInfo(openFile.FileName);
                txtFilePath.Text = info.FullName;

                try
                {
                    List <string> arquivo = LeitorArquivo.Ler(info.FullName);
                    this.LimparValoresTela();

                    List <Aula> aulas = this.aulaService.CriarListaDeAulas(arquivo);
                    this.lblTotalAulasArquivo.Text = "Total Aulas arquivo: " + this.CalcularTotalAulasArquivo(aulas);
                    List <IDado> dadosAula = new List <IDado>();

                    dadosAula.AddRange(aulas);
                    List <string> grafo = this.grafoService.GerarHorariosFormatados(Vertice.ConverterParaVertice(dadosAula), out this.aulasSemHorario);
                    this.groupFiltro.Enabled = true;
                    this.InserirResultadosNaTabela(grafo);
                    this.InserirListasNoComboBox();
                    this.PreencherValoresLabel(grafo.Count);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Houve um problema na leitura do arquivo. Erro retornado: " + error.Message,
                                    "Falha leitura arquivo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (this.aulasSemHorario.Count > 0)
                {
                    DialogResult resultado = MessageBox.Show("Existem aulas que não foram encaixadas em um horário. Deseja ve-las agora ?",
                                                             "Aulas", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (resultado == DialogResult.Yes)
                    {
                        this.btnMateriasSemHorario.Visible = true;
                        this.formMateriasSemAula           = new FormMateriasSemAula(this.aulasSemHorario);
                        this.formMateriasSemAula.ShowDialog();
                    }
                }
            }
        }
예제 #3
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            string dados = LeitorArquivo.Ler("/CompreAqui;component/Resources/dados.txt");

            Loja.Dados = JsonConvert.DeserializeObject <Loja>(dados);
        }