| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | using System;using System.Collections.Generic;using System.Globalization;using System.Linq;using System.Text;using System.Windows.Data;using System.Windows.Media;using System.Windows;using Aitex.Core.RT.Log;using System.Collections.ObjectModel;using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;namespace FurnaceUI.Converter{    public class MFCListConverter : IValueConverter    {        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)        {            try            {                var mfcList = value as ObservableCollection<MFCData>;                while (mfcList.Count > 10)                {                    mfcList.Remove(mfcList.LastOrDefault());                }                while (mfcList.Count < 10)                {                    mfcList.Add(new MFCData()                    {                        Name = "",                        DisplayName = "",                      //  SetValueParam = ""                    });                }                return mfcList;            }            catch (Exception ex)            {                LOG.Write(ex);            }            return value;        }        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)        {            throw new NotImplementedException();        }    }}
 |