public MainWindow()
        {
            InitializeComponent();

            ArrayCompare.Init();
            arrayData.ItemsSource = ArrayCompare.algorithmPerformancesAverage;
            for (int i = 0; i < ArrayCompare.numberOfArrays; i++)
            {
                arrayData.Columns.Add(new DataGridTextColumn
                {
                    Header   = "Array " + i,
                    Binding  = new Binding(string.Format("ticksElapsed[{0}]", i)),
                    MinWidth = 50
                });
            }
            ICollectionView cvAlgorithmPerformances = CollectionViewSource.GetDefaultView(arrayData.ItemsSource);

            if (cvAlgorithmPerformances != null && cvAlgorithmPerformances.CanGroup == true)
            {
                cvAlgorithmPerformances.GroupDescriptions.Clear();
                cvAlgorithmPerformances.GroupDescriptions.Add(new PropertyGroupDescription("algorithmName"));
            }

            AddAlgorithmCheckBoxesToList();
            for (int c = 0; c < algorithmSelectCheckBoxes.Count; c++)
            {
                algorithmSelectCheckBoxes[c].Visibility = Visibility.Hidden;
            }

            graphData = new GraphData(canGraph);

            ArrayCompare.UpdateArraySize(arraySizeNew);
            RefreshArraySizeSelectionList();
            RefreshMeasurementAmountSelectionList();
        }
        public void RunTests()
        {
            ArrayCompare.RunTestbench(measurements);
            toUpdate = true;

            arrayData.Items.Refresh();
            AddAlgorithmsDataToGraph();
        }
 private void RestartButton_Click(object sender, RoutedEventArgs e)
 {
     if (arraySizeNew != arraySizeCurrent)
     {
         ArrayCompare.UpdateArraySize(arraySizeNew);
         arraySizeCurrent = arraySizeNew;
     }
     ArrayCompare.ClearAlgorithmPerformances();
     graphData.ResetGraph();
     arrayData.Items.Refresh();
     //measurementAmountLabel.Content = "Average values based on " + ArrayCompare.algorithmPerformances.Count + " measurements";
     measurementAmountLabel.Content = "Average values based on " + ArrayCompare.algorithmPerformances.Count +
                                      " measurements,\narray size = " + ArrayCompare.arraySize;
 }
        public void AddSingleArrayDataToGraph(int arrayIndex)
        {
            List <double[]> algorithmPerformanceList = new List <double[]>();

            // Get data of every algorithm for a single array
            for (int i = 0; i < ArrayCompare.algorithmNames.Count; i++)
            {
                algorithmPerformanceList.Add(ArrayCompare.GetResultArrayDouble(i, arrayIndex));

                if (algorithmSelectCheckBoxes.Count > i)
                {
                    algorithmSelectCheckBoxes[i].Content = ArrayCompare.algorithmNames[i];
                    if (graphData.canvasData.brushes.Length > i)
                    {
                        algorithmSelectCheckBoxes[i].Background = graphData.canvasData.brushes[i];
                    }
                    algorithmSelectCheckBoxes[i].Visibility = Visibility.Visible;
                }
            }

            graphData.AddAlgorithmsDataToGraph(arrayIndex, algorithmPerformanceList);
        }