private void FillData(string watchValue, ObservableCollection <Box> tmp) { UnusedBoxes.StworzListeUnused(Boxes.GetBoxList(), tmp); CalculatedBoxes.SetBoxList(tmp); CalculatedBoxes.ReorderBoxList(); // Filling labels int used = tmp.Count(); int unused = UnusedBoxes.GetBoxNumber(); BoxesLabel.Content = "" + (used + unused); BoxesUsedLabel.Content = "" + used; BoxesUnusedLabel.Content = "" + unused; TimeTakenLabel.Content = watchValue + " miliseconds"; // Redrawing graph reDrawAll(); GridView.IsVisible = true; }
private void _Start_Click(object sender, RoutedEventArgs e) { if (IsCalculated) { return; } if (Boxes.GetBoxNumber() == 0) { return; } Boxes.UstawPionowo(); BoxList A = new BoxList(); BoxList B = new BoxList(); A.DodajPudelka(Boxes.GetBoxList()); B.DodajPudelka(Boxes.GetBoxList()); A.SortujPudelka(true); B.SortujPudelka(false); var watch = Stopwatch.StartNew(); var tmp = Algorithm.NajdluzszyWspolnyPodciag(A.GetBoxList(), B.GetBoxList()); watch.Stop(); IsCalculated = true; FillData(watch.ElapsedMilliseconds.ToString(), tmp); SortedBoxes.ListBox = tmp; fillCanvas(SortedCanvas, SortedBoxes); }