回答編集履歴
1
見直しキャンペーン中
answer
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
WPFで試しました(`ReactiveProperty`については差はないと思います)
|
1
|
+
WPFで試しました(`ReactiveProperty`については差はないと思います)
|
2
|
-
こちらでは想定の動作になりましたが、あまり詳しくないので間違いがあるかもしれません。
|
2
|
+
こちらでは想定の動作になりましたが、あまり詳しくないので間違いがあるかもしれません。
|
3
|
-
|
3
|
+
|
4
|
-
```
|
4
|
+
```cs
|
5
|
-
//宣言部
|
5
|
+
//宣言部
|
6
|
-
public ReactiveProperty<string> InputSerial { get; } = new ReactiveProperty<string>();
|
6
|
+
public ReactiveProperty<string> InputSerial { get; } = new ReactiveProperty<string>();
|
7
|
-
public ReactiveCommand BtnInputSerial { get; }
|
7
|
+
public ReactiveCommand BtnInputSerial { get; }
|
8
|
-
public ReactiveCollection<string> ItemSerialsUse { get; } = new ReactiveCollection<string>();
|
8
|
+
public ReactiveCollection<string> ItemSerialsUse { get; } = new ReactiveCollection<string>();
|
9
|
-
|
9
|
+
|
10
|
-
//コンストラクタ
|
10
|
+
//コンストラクタ
|
11
|
-
var c = ItemSerialsUse
|
11
|
+
var c = ItemSerialsUse
|
12
|
-
.CollectionChangedAsObservable()
|
12
|
+
.CollectionChangedAsObservable()
|
13
|
-
.StartWith(new NotifyCollectionChangedEventArgs[] { null });
|
13
|
+
.StartWith(new NotifyCollectionChangedEventArgs[] { null });
|
14
|
-
BtnInputSerial = InputSerial
|
14
|
+
BtnInputSerial = InputSerial
|
15
|
-
.CombineLatest(c, (x, y) => !string.IsNullOrWhiteSpace(x) && !ItemSerialsUse.Any(z => z == x))
|
15
|
+
.CombineLatest(c, (x, y) => !string.IsNullOrWhiteSpace(x) && !ItemSerialsUse.Any(z => z == x))
|
16
|
-
.ToReactiveCommand();
|
16
|
+
.ToReactiveCommand();
|
17
|
-
BtnInputSerial.Subscribe(_ => ItemSerialsUse.Add(InputSerial.Value));
|
17
|
+
BtnInputSerial.Subscribe(_ => ItemSerialsUse.Add(InputSerial.Value));
|
18
|
-
```
|
18
|
+
```
|
19
|
-
|
19
|
+
|
20
20
|
`var c`は長くなったので出しただけで、深い意味はありません。
|