using Avalonia; using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using DemoService.Models; namespace DemoService; public partial class ServiceWindow : Window { private readonly bool AdminMode; public ServiceWindow() { InitializeComponent(); ServicesListBox.ItemsSource = Utils.Context.Services; } public ServiceWindow(bool admin) { InitializeComponent(); AdminMode = admin; if (!admin) { AddButton.IsVisible = false; } ServicesListBox.ItemsSource = Utils.Context.Services; foreach (var service in ServicesListBox.ItemsSource) { } } public void AddButtonClick(object sender, RoutedEventArgs args) { AddEditWindow addEditWindow = new(); addEditWindow.Show(); Close(); } private decimal? CostAfterDiscount(decimal previousCost, decimal? discount) { if (discount.HasValue || discount != 0) { decimal actualCost = previousCost - previousCost * discount.Value; return actualCost; } return null; } }