1
1
// Copyright (c) 2020, Phoenix Contact GmbH & Co. KG
2
2
// Licensed under the Apache License, Version 2.0
3
3
4
+ using System ;
4
5
using System . Collections . Generic ;
5
6
using System . Windows ;
6
7
using System . Windows . Input ;
@@ -13,12 +14,30 @@ namespace Moryx.Controls.Demo.ViewModels
13
14
{
14
15
public class EntryEditorViewModel : Screen
15
16
{
17
+ private bool _isEditMode ;
18
+
16
19
public override string DisplayName => "EntryEditor" ;
17
20
18
21
public EntryViewModel EntryViewModels { get ; }
19
22
20
23
public ICommand ShowExceptionCommand { get ; }
21
24
25
+ public ICommand BeginEditCmd { get ; }
26
+
27
+ public ICommand EndEditCmd { get ; }
28
+
29
+ public ICommand CancelEditCmd { get ; }
30
+
31
+ public bool IsEditMode
32
+ {
33
+ get { return _isEditMode ; }
34
+ private set
35
+ {
36
+ _isEditMode = value ;
37
+ NotifyOfPropertyChange ( ) ;
38
+ }
39
+ }
40
+
22
41
public EntryEditorViewModel ( )
23
42
{
24
43
var entryModel = new EntryClass
@@ -62,6 +81,26 @@ public EntryEditorViewModel()
62
81
EntryViewModels = new EntryViewModel ( entry ) ;
63
82
64
83
ShowExceptionCommand = new RelayCommand ( ShowException ) ;
84
+ BeginEditCmd = new RelayCommand ( BeginEdit ) ;
85
+ EndEditCmd = new RelayCommand ( EndEdit ) ;
86
+ CancelEditCmd = new RelayCommand ( CancelEdit ) ;
87
+ }
88
+
89
+ private void EndEdit ( object obj )
90
+ {
91
+ throw new NotImplementedException ( ) ;
92
+ }
93
+
94
+ private void CancelEdit ( object obj )
95
+ {
96
+ IsEditMode = false ;
97
+ EntryViewModels . CancelEdit ( ) ;
98
+ }
99
+
100
+ private void BeginEdit ( object obj )
101
+ {
102
+ IsEditMode = true ;
103
+ EntryViewModels . BeginEdit ( ) ;
65
104
}
66
105
67
106
public void ShowException ( object parameter )
0 commit comments