Converter error was fixed
This commit is contained in:
@@ -7,22 +7,33 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal abstract class UnitBase : IValueConverter
|
||||
{
|
||||
public abstract UnitTypes unitType { get; }
|
||||
public abstract IUnit currentUnit { get; }
|
||||
public abstract string unitName { get;}
|
||||
public abstract UnitTypes UnitType { get; }
|
||||
public abstract IUnit CurrentUnit { get; }
|
||||
public abstract string UnitName { get;}
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return CommonOperation.Convert(currentUnit, unitName, value);
|
||||
return CommonOperation.Convert(CurrentUnit, UnitName, value);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return CommonOperation.ConvertBack(unitType, currentUnit, value);
|
||||
try
|
||||
{
|
||||
return CommonOperation.ConvertBack(UnitType, CurrentUnit, value);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show($"Value of {UnitName}={(string)value} is not correct", "Error of conversion", MessageBoxButtons.OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user