diff --git a/OptimizationIssues/Views/KnapsackView.xaml.cs b/OptimizationIssues/Views/KnapsackView.xaml.cs index 7de7978..314e311 100644 --- a/OptimizationIssues/Views/KnapsackView.xaml.cs +++ b/OptimizationIssues/Views/KnapsackView.xaml.cs @@ -45,6 +45,20 @@ private void SolveButton_Click(object sender, RoutedEventArgs e) Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFD700")) }); + ResultTextBlock.Inlines.Add(new Run("\nZużyta pojemność plecaka: ") + { + Foreground = new SolidColorBrush(Colors.White) + }); + + double fillPercentage = ((double)usedCapacity / capacity) * 100; + + ResultTextBlock.Inlines.Add(new Run($"{usedCapacity}/{capacity} ({fillPercentage:F2}%)") + { + Foreground = new SolidColorBrush(usedCapacity == capacity + ? (Color)ColorConverter.ConvertFromString("#98FF98") + : (Color)ColorConverter.ConvertFromString("#FF9898")) + }); + ResultTextBlock.Inlines.Add(new Run("\n\nWybrane przedmioty:\n") { Foreground = new SolidColorBrush(Colors.White) @@ -77,22 +91,6 @@ private void SolveButton_Click(object sender, RoutedEventArgs e) Foreground = new SolidColorBrush(Colors.White) }); } - - ResultTextBlock.Inlines.Add(new Run("\nZużyta pojemność plecaka: ") - { - Foreground = new SolidColorBrush(Colors.White) - }); - - if (usedCapacity == capacity) - ResultTextBlock.Inlines.Add(new Run($"{usedCapacity}/{capacity}") - { - Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#98FF98")) - }); - else - ResultTextBlock.Inlines.Add(new Run($"{usedCapacity}/{capacity}") - { - Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF9898")) - }); } else ResultTextBlock.Text = "Podano błędne dane. Upewnij się, że wszystkie pola są poprawnie wypełnione."; diff --git a/OptimizationIssues/Views/TSPView.xaml.cs b/OptimizationIssues/Views/TSPView.xaml.cs index 16e2309..6d67ef5 100644 --- a/OptimizationIssues/Views/TSPView.xaml.cs +++ b/OptimizationIssues/Views/TSPView.xaml.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Media; namespace OptimizationIssues.Views @@ -33,7 +34,27 @@ private void SolveButton_Click(object sender, RoutedEventArgs e) (int result, List path) = viewModel.SolveTravelingSalesmanProblem(); path.Add(path[0]); string pathString = string.Join(" -> ", path); - ResultTextBlock.Text = $"Minimalna długość trasy: {result}\nTrasa: {pathString}"; + ResultTextBlock.Inlines.Clear(); + + ResultTextBlock.Inlines.Add(new Run("Minimalna długość trasy: ") + { + Foreground = new SolidColorBrush(Colors.White) + }); + + ResultTextBlock.Inlines.Add(new Run(result.ToString()) + { + Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#98FF98")) + }); + + ResultTextBlock.Inlines.Add(new Run("\nTrasa: ") + { + Foreground = new SolidColorBrush(Colors.White) + }); + + ResultTextBlock.Inlines.Add(new Run(pathString) + { + Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFD700")) + }); } else ResultTextBlock.Text = "Podano błędne dane. Upewnij się, że wszystkie pola są poprawnie wypełnione."; diff --git a/OptimizationIssues/Views/TaskAllocationView.xaml.cs b/OptimizationIssues/Views/TaskAllocationView.xaml.cs index d3e7285..b09fde5 100644 --- a/OptimizationIssues/Views/TaskAllocationView.xaml.cs +++ b/OptimizationIssues/Views/TaskAllocationView.xaml.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Media; namespace OptimizationIssues.Views @@ -32,7 +33,27 @@ private void SolveButton_Click(object sender, RoutedEventArgs e) viewModel.CostMatrix = costMatrix; var (minCost, maxValue) = viewModel.SolveTaskAllocation(); - ResultTextBlock.Text = $"Minimalny koszt: {minCost}\nMaksymalna wartość: {maxValue}"; + ResultTextBlock.Inlines.Clear(); + + ResultTextBlock.Inlines.Add(new Run("Minimalny koszt: ") + { + Foreground = new SolidColorBrush(Colors.White) + }); + + ResultTextBlock.Inlines.Add(new Run(minCost.ToString()) + { + Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#98FF98")) + }); + + ResultTextBlock.Inlines.Add(new Run("\nMaksymalna wartość: ") + { + Foreground = new SolidColorBrush(Colors.White) + }); + + ResultTextBlock.Inlines.Add(new Run(maxValue.ToString()) + { + Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF9898")) + }); } else ResultTextBlock.Text = "Podano błędne dane. Upewnij się, że wszystkie pola są poprawnie wypełnione.";