Simplify client check in code
This commit is contained in:
@ -29,7 +29,7 @@ namespace Elwig {
|
||||
public static string? BranchFaxNr { get; private set; }
|
||||
public static string? BranchMobileNr { get; private set; }
|
||||
public static IList<IScale> Scales { get; private set; }
|
||||
public static ClientParameters Client { get; private set; }
|
||||
public static ClientParameters Client { get; private set; }
|
||||
|
||||
public static bool IsPrintingReady => Documents.Html.IsReady && Documents.Pdf.IsReady;
|
||||
public static Dispatcher MainDispatcher { get; private set; }
|
||||
|
@ -7,6 +7,9 @@ namespace Elwig.Helpers {
|
||||
|
||||
public enum Type { Matzen, GWK };
|
||||
|
||||
public bool IsMatzen => Client == Type.Matzen;
|
||||
public bool IsGWK => Client == Type.GWK;
|
||||
|
||||
public string NameToken;
|
||||
public string NameShort;
|
||||
public string NameShortened;
|
||||
|
@ -79,7 +79,7 @@ namespace Elwig.Windows {
|
||||
WeighingDButton.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
if (App.Client.Client == ClientParameters.Type.Matzen) {
|
||||
if (App.Client.IsMatzen) {
|
||||
SetDefaultValue(GerebeltGewogenInput, true);
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace Elwig.Windows {
|
||||
private void InitialInputs() {
|
||||
HandPickedInput.IsChecked = null;
|
||||
SetDefaultValue(HandPickedInput, null);
|
||||
if (App.Client.Client == ClientParameters.Type.Matzen) {
|
||||
if (App.Client.IsMatzen) {
|
||||
GerebeltGewogenInput.IsChecked = true;
|
||||
GerebeltGewogenInput.IsEnabled = false;
|
||||
} else {
|
||||
@ -1109,7 +1109,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private void ModifiersInput_SelectionChanged(object sender, ItemSelectionChangedEventArgs evt) {
|
||||
if ((IsEditing || IsCreating) && App.Client.Client == ClientParameters.Type.Matzen) {
|
||||
if ((IsEditing || IsCreating) && App.Client.IsMatzen) {
|
||||
var mod = ModifiersInput.SelectedItems.Cast<Modifier>();
|
||||
var kl = mod.Where(m => m.Name.StartsWith("Klasse "));
|
||||
if (kl.Count() > 1) {
|
||||
@ -1119,7 +1119,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private void LesewagenInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
if ((IsEditing || IsCreating) && App.Client.Client == ClientParameters.Type.Matzen) {
|
||||
if ((IsEditing || IsCreating) && App.Client.IsMatzen) {
|
||||
var mod = ModifiersInput.SelectedItems.Cast<Modifier>();
|
||||
var kl = mod.Where(m => m.Name.StartsWith("Klasse ")).Select(m => m.ModId).LastOrDefault("A")[0];
|
||||
if (LesewagenInput.IsChecked == true) kl++; else kl--;
|
||||
|
Reference in New Issue
Block a user