30 lines
		
	
	
		
			971 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			971 B
		
	
	
	
		
			C#
		
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Globalization;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
using System.Threading.Tasks;
 | 
						|
using System.Windows.Data;
 | 
						|
 | 
						|
namespace DM_Weight.Converter
 | 
						|
{
 | 
						|
    public class InputQuantityConverter : IValueConverter
 | 
						|
    {
 | 
						|
        public bool ReadOnlyValue { get; set; } = true;
 | 
						|
        public bool NotReadOnlyValue { get; set; } = false;
 | 
						|
 | 
						|
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            int iResult;
 | 
						|
            int.TryParse(value.ToString(), out iResult);
 | 
						|
            //return int.Parse(value.ToString()) == 2 || int.Parse(value.ToString()) == 6 ? ReadOnlyValue : NotReadOnlyValue;
 | 
						|
            return iResult == 2 || iResult == 6 ? ReadOnlyValue : NotReadOnlyValue;
 | 
						|
        }
 | 
						|
 | 
						|
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            return Binding.DoNothing;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |