ControllerStateConverter.cs 2.58 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using FLY.Thick.Base.Common;
using System.Windows;

潘栩锋's avatar
潘栩锋 committed
9
namespace FLY.Thick.Base.UI.Converter
潘栩锋's avatar
潘栩锋 committed
10 11 12 13 14
{
    public class ControllerStateConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
潘栩锋's avatar
潘栩锋 committed
15 16 17 18
            var resources = new ResourceDictionary
            {
                Source = new Uri("pack://application:,,,/FLY.Thick.Base.UI;component/Themes/String.xaml", UriKind.Absolute)
            };
潘栩锋's avatar
潘栩锋 committed
19 20 21 22
            CTRL_STATE state = (CTRL_STATE)value;
            switch (state)
            {
                case CTRL_STATE.FIX:
潘栩锋's avatar
潘栩锋 committed
23
                    return resources["strFix"];
潘栩锋's avatar
潘栩锋 committed
24
                case CTRL_STATE.ORG:
潘栩锋's avatar
潘栩锋 committed
25
                    return resources["strOrg"];
潘栩锋's avatar
潘栩锋 committed
26
                case CTRL_STATE.SCAN:
潘栩锋's avatar
潘栩锋 committed
27
                    return resources["strScan"];
潘栩锋's avatar
潘栩锋 committed
28
                case CTRL_STATE.FORW:
潘栩锋's avatar
潘栩锋 committed
29
                    return resources["strForw"];
潘栩锋's avatar
潘栩锋 committed
30
                case CTRL_STATE.BACKW:
潘栩锋's avatar
潘栩锋 committed
31
                    return resources["strBackw"];
潘栩锋's avatar
潘栩锋 committed
32
                case CTRL_STATE.STOP:
潘栩锋's avatar
潘栩锋 committed
33
                    return resources["strStop"];
潘栩锋's avatar
潘栩锋 committed
34
                case CTRL_STATE.EMGS:
潘栩锋's avatar
潘栩锋 committed
35
                    return resources["strEmgs"];
潘栩锋's avatar
潘栩锋 committed
36
                case CTRL_STATE.CORR:
潘栩锋's avatar
潘栩锋 committed
37
                    return resources["strCorr"];
潘栩锋's avatar
潘栩锋 committed
38
                case CTRL_STATE.GETSAMPLE:
潘栩锋's avatar
潘栩锋 committed
39
                    return resources["strGetSample"];
潘栩锋's avatar
潘栩锋 committed
40
                case CTRL_STATE.RUNNING:
潘栩锋's avatar
潘栩锋 committed
41
                    return resources["strRunning"];
潘栩锋's avatar
潘栩锋 committed
42
                case CTRL_STATE.DISCONNECTED:
潘栩锋's avatar
潘栩锋 committed
43
                    return resources["strDisconnected"];
潘栩锋's avatar
潘栩锋 committed
44
                case CTRL_STATE.GAGEINFO:
潘栩锋's avatar
潘栩锋 committed
45
                    return resources["strGageInfo"];
潘栩锋's avatar
潘栩锋 committed
46
                case CTRL_STATE.PAUSE:
潘栩锋's avatar
潘栩锋 committed
47
                    return resources["strPause"];
潘栩锋's avatar
潘栩锋 committed
48
                case CTRL_STATE.AUTOSCAN:
潘栩锋's avatar
潘栩锋 committed
49
                    return resources["strAutoScan"];
潘栩锋's avatar
潘栩锋 committed
50
                case CTRL_STATE.SYNC:
潘栩锋's avatar
潘栩锋 committed
51 52 53
                    return resources["strSync"];
                case CTRL_STATE.MEASURESYNC:
                    return resources["strMeasureSync"];
54 55 56 57
                case CTRL_STATE.SCANMARK:
                    return resources["strScanMark"];
                case CTRL_STATE.PUNCH:
                    return resources["strPunch"];
潘栩锋's avatar
潘栩锋 committed
58
                default:
潘栩锋's avatar
潘栩锋 committed
59 60
                    return resources["strUnknown"];

潘栩锋's avatar
潘栩锋 committed
61 62 63 64 65 66 67 68 69
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}