프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Converters / BiddersToKeyAndValueConvert.cs @ df2e7646

이력 | 보기 | 이력해설 | 다운로드 (2.56 KB)

1 df2e7646 taeseongkim
using Markus.Mvvm.ToolKit;
2
using System;
3
using System.Collections.Generic;
4
using System.Globalization;
5
using System.Linq;
6
using System.Text;
7
using System.Threading.Tasks;
8
using System.Windows.Data;
9
10
namespace KCOM.Converters
11
{
12
    public  class BiddersToKeyAndValueConvert : IValueConverter
13
    {
14
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15
        {
16
            List<BiddersKeyAndValue> result = null;
17
18
            if(value is PemssService.Bidders)
19
            {
20
                var bidders = value as PemssService.Bidders;
21
22
                result = new List<BiddersKeyAndValue>
23
                {
24
                    new BiddersKeyAndValue(0,"Equipment Name",bidders.equipmentName),
25
                    new BiddersKeyAndValue(1,"No",bidders.no),
26
                    new BiddersKeyAndValue(2,"Description 1",bidders.description1),
27
                    new BiddersKeyAndValue(3,"Description 2",bidders.description2),
28
                    new BiddersKeyAndValue(4,"Description 3",bidders.description3),
29
                    new BiddersKeyAndValue(4,"Unit",bidders.unit),
30
                    new BiddersKeyAndValue(4,"Data",bidders.data)
31
                };
32
            }
33
34
            return result;
35
        }
36
37
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
38
        {
39
            throw new NotImplementedException();
40
        }
41
    }
42
43
    public class BiddersKeyAndValue : NotifyExpectation
44
    {
45
        public BiddersKeyAndValue(int index,string key,string value)
46
        {
47
            Index = index;
48
            Key = key;
49
            Value = value;
50
        }
51
52
        private int _index;
53
54
        public int Index
55
        {
56
            get { return _index; }
57
            set
58
            {
59
                if (_index != value)
60
                {
61
                    _index = value;
62
                    OnPropertyChanged(() => Index);
63
                }
64
            }
65
        }
66
67
        private string _key;
68
69
        public string Key
70
        {
71
            get { return _key; }
72
            set
73
            {
74
                if (_key != value)
75
                {
76
                    _key = value;
77
                    OnPropertyChanged(() => Key);
78
                }
79
            }
80
        }
81
82
        private string _value;
83
84
        public string Value
85
        {
86
            get { return _value; }
87
            set
88
            {
89
                if (_value != value)
90
                {
91
                    _value = value;
92
                    OnPropertyChanged(() => Value);
93
                }
94
            }
95
        }
96
    }
97
}
클립보드 이미지 추가 (최대 크기: 500 MB)