Esempio n. 1
0
        private async void Calculate_Click(object aSender, RoutedEventArgs aE)
        {
            ClearHighlights();
            btn_Calculate.IsEnabled = false;
            btn_Continue.IsEnabled  = true;

            Sweep = new ClosestPairSweep(prv_Points, (StepSize)cmb_StepSize.SelectedItem);

            try {
                var(lcl_P1, lcl_P2) = await Sweep.Sweep(this);

                Line lcl_Line = new Line();
                lcl_Line.X1 = lcl_P1.X;
                lcl_Line.Y1 = lcl_P1.Y;
                lcl_Line.X2 = lcl_P2.X;
                lcl_Line.Y2 = lcl_P2.Y;
                lcl_Line.StrokeThickness = 2;
                lcl_Line.Stroke          = Brushes.DarkGreen;
                cnv_Canvas.Children.Add(lcl_Line);
                UpdateGUI();
                prv_Shapes.Add(lcl_Line);
                //} catch (ArgumentException) {
                //    MessageBox.Show("Enter at least two Points!");
            } finally {
                btn_Calculate.IsEnabled = true;
                btn_Continue.IsEnabled  = false;
            }
        }
Esempio n. 2
0
 public MainWindow()
 {
     Sweep = new ClosestPairSweep(prv_Points);
     InitializeComponent();
     cmb_StepSize.ItemsSource             = Enum.GetValues(typeof(StepSize)).Cast <StepSize>();
     cmb_StepSize.SelectedItem            = StepSize.LineContent;
     itc_SweepStatusStructure.ItemsSource = SweepStatusStructure;
     this.Title = "Closest Pair Sweep";
 }