31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using Elwig.Helpers;
|
|
using Elwig.Models.Entities;
|
|
using System.Collections.Generic;
|
|
using System.Windows;
|
|
|
|
namespace Elwig.Dialogs {
|
|
public partial class NewSeasonDialog : Window {
|
|
|
|
public IEnumerable<Currency> Currencies { get; set; }
|
|
public int Year { get; set; }
|
|
|
|
public string CurrencyCode => (CurrencyInput.SelectedItem as Currency)!.Code;
|
|
public byte Precision => (byte)(PrecisionInput.SelectedIndex + 2);
|
|
public bool CopyModifiers { get; set; }
|
|
|
|
public NewSeasonDialog(Season? s, IEnumerable<Currency> currencies) {
|
|
Currencies = currencies;
|
|
CopyModifiers = s != null;
|
|
InitializeComponent();
|
|
CopyModifiersInput.IsEnabled = s != null;
|
|
ControlUtils.SelectItemWithPk(CurrencyInput, s?.CurrencyCode ?? "EUR");
|
|
PrecisionInput.SelectedIndex = (s?.Precision ?? 4) - 2;
|
|
}
|
|
|
|
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
|
DialogResult = true;
|
|
Close();
|
|
}
|
|
}
|
|
}
|