using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Data; using FLY.Thick.Base.Common; using System.Windows; namespace FLY.Thick.Base.UI.Converter { public class ControllerStateConverter:IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var resources = new ResourceDictionary { Source = new Uri("pack://application:,,,/FLY.Thick.Base.UI;component/Themes/String.xaml", UriKind.Absolute) }; CTRL_STATE state = (CTRL_STATE)value; switch (state) { case CTRL_STATE.FIX: return resources["strFix"]; case CTRL_STATE.ORG: return resources["strOrg"]; case CTRL_STATE.SCAN: return resources["strScan"]; case CTRL_STATE.FORW: return resources["strForw"]; case CTRL_STATE.BACKW: return resources["strBackw"]; case CTRL_STATE.STOP: return resources["strStop"]; case CTRL_STATE.EMGS: return resources["strEmgs"]; case CTRL_STATE.CORR: return resources["strCorr"]; case CTRL_STATE.GETSAMPLE: return resources["strGetSample"]; case CTRL_STATE.RUNNING: return resources["strRunning"]; case CTRL_STATE.DISCONNECTED: return resources["strDisconnected"]; case CTRL_STATE.GAGEINFO: return resources["strGageInfo"]; case CTRL_STATE.PAUSE: return resources["strPause"]; case CTRL_STATE.AUTOSCAN: return resources["strAutoScan"]; case CTRL_STATE.SYNC: return resources["strSync"]; case CTRL_STATE.MEASURESYNC: return resources["strMeasureSync"]; default: return resources["strUnknown"]; } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }