38 lines
		
	
	
		
			946 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			946 B
		
	
	
	
		
			C#
		
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Globalization;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
using System.Threading.Tasks;
 | 
						|
using System.Windows;
 | 
						|
using System.Windows.Data;
 | 
						|
 | 
						|
namespace DM_Weight.Converter
 | 
						|
{
 | 
						|
    internal class DrawerAuthorityConverter : IValueConverter
 | 
						|
    {
 | 
						|
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            if (value != null && value.ToString().Equals("1"))
 | 
						|
            {
 | 
						|
                return true;
 | 
						|
            }
 | 
						|
            else
 | 
						|
                return false;
 | 
						|
        }
 | 
						|
 | 
						|
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            bool isTrue;
 | 
						|
            if (bool.TryParse(value.ToString(), out isTrue))
 | 
						|
            {
 | 
						|
                if(isTrue)
 | 
						|
                {
 | 
						|
                    return 1;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            return 0;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |