예제 #1
0
 public MainPage()
 {
     this.InitializeComponent();
     aster         = AStar.getInstance();
     bb            = BranchAndBound.getInstance();
     start         = this.FindName("startStr_textBox") as TextBox;
     finish        = this.FindName("finalStr_textBox") as TextBox;
     astar_lv      = this.FindName("astar_listView") as ListView;
     BandB_lv      = this.FindName("BandB_listView") as ListView;
     submit        = this.FindName("submit_Btn") as Button;
     submit.Click += submitButton_Click;
     //when new paths are found, display the paths in the pathList
     aster.NewPathFound1 += OnNewPathFound1;
     bb.NewPathFound0    += OnNewPathFound0;
 }
예제 #2
0
 private void submitButton_Click(object sender, RoutedEventArgs args)
 {
     astar_lv.Items.Clear();
     BandB_lv.Items.Clear();
     if (ValidInput(start.Text, finish.Text))
     {
         AStar.FindPath(start.Text, finish.Text);
         if (AStar.Solvable)
         {
             BranchAndBound.FindPath(start.Text, finish.Text);
         }
     }
     else
     {
         astar_lv.Items.Add(NewItem("Unsolvable", true));
         BandB_lv.Items.Add(NewItem("Unsolvable", true));
     }
 }