예제 #1
0
        /// <summary>
        /// confirms util options
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void confirm_util(object sender, RoutedEventArgs e)// TODO
        {
            try
            {
                switch (util_cmbx.SelectedItem.ToString())
                {
                case "Caminho mínimo":
                    msgdi = new MessageDialog(Graph.Dijkstra(Graph.BuscaVertice(from_utils_dkstra.Text)._id, Graph.BuscaVertice(to_utils_dkstra.Text)._id));
                    await msgdi.ShowAsync();

                    break;

                case "Ler arquivo":
                    break;

                case "BFS":
                    msgdi = new MessageDialog(Graph.BuscaEmLargura(0));
                    await msgdi.ShowAsync();

                    break;

                case "Gerenciador de Grafo":

                    Grafo_manager.Visibility = Visibility.Visible;
                    if (Graph.Vertices.Count > 0)
                    {
                        Vertex_list.ItemsSource = Graph.VerticeToListString();
                    }
                    else
                    {
                        Vertex_list.ItemsSource = null;
                    }

                    if (Graph.Arestas.Count > 0)
                    {
                        Aresta_list.ItemsSource = Graph.ArestaToListString();
                    }
                    else
                    {
                        Aresta_list.ItemsSource = null;
                    }

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                msgdi = new MessageDialog($"Erro {ex.Message}");
                await msgdi.ShowAsync();
            }
        }