89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
// Copyright (c) 2017- schick Informatik
|
|
// Description: Dialog to confirm values during excel import (e.g. CREW/PAS)
|
|
//
|
|
|
|
using ENI2.Controls;
|
|
using System.Collections.Generic;
|
|
using System.Windows;
|
|
using bsmd.database;
|
|
|
|
namespace ENI2.EditControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for FixImportDialog.xaml
|
|
/// </summary>
|
|
public partial class FixImportDialog : EditWindowBase
|
|
{
|
|
public FixImportDialog()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool LocodeMode
|
|
{
|
|
get { return this.locodeControl.Visibility == Visibility.Visible; }
|
|
set
|
|
{
|
|
this.locodeControl.Visibility = value ? Visibility.Visible : Visibility.Hidden;
|
|
this.comboBoxValues.Visibility = value ? Visibility.Hidden : Visibility.Visible;
|
|
}
|
|
}
|
|
|
|
public string SelectedValue
|
|
{
|
|
get
|
|
{
|
|
if (LocodeMode) return this.locodeControl.LocodeValue;
|
|
return this.comboBoxValues.SelectedValue as string;
|
|
}
|
|
}
|
|
|
|
public string Value
|
|
{
|
|
get { return this.textBlockValue.Text; }
|
|
set { this.textBlockValue.Text = value.Trim(); }
|
|
}
|
|
|
|
public string ValueType
|
|
{
|
|
get { return this.textBlockType.Text; }
|
|
set { this.textBlockType.Text = value; }
|
|
}
|
|
|
|
public Dictionary<string, string> SelectionValues { get; set; }
|
|
|
|
#region event handler
|
|
|
|
private void EditWindowBase_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
this.EnableOK(false);
|
|
|
|
if (LocodeMode)
|
|
{
|
|
this.locodeControl.SetFocus();
|
|
this.locodeControl.PropertyChanged += LocodeControl_PropertyChanged;
|
|
}
|
|
else
|
|
{
|
|
this.comboBoxValues.ItemsSource = this.SelectionValues;
|
|
this.comboBoxValues.SelectionChanged += ComboBoxValues_SelectionChanged;
|
|
this.comboBoxValues.Focus();
|
|
}
|
|
}
|
|
|
|
private void ComboBoxValues_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
|
{
|
|
string val = this.comboBoxValues.SelectedValue as string;
|
|
this.EnableOK(!val.IsNullOrEmpty());
|
|
}
|
|
|
|
private void LocodeControl_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
|
{
|
|
this.EnableOK(!locodeControl.LocodeValue.IsNullOrEmpty());
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|