diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-19 14:26:15 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-19 14:26:15 +0300 |
| commit | 6f9da1e19024c7c65d7dbd6038cd34776453f9dc (patch) | |
| tree | 5bac3f9154c45ea89310b934c64b0788e0598c54 /Software/Visual_Studio/Tango.SharedUI/DialogViewVM.cs | |
| parent | 62dfa96e0bf7cba8b32a0866a0f8101b1e7ec562 (diff) | |
| download | Tango-6f9da1e19024c7c65d7dbd6038cd34776453f9dc.tar.gz Tango-6f9da1e19024c7c65d7dbd6038cd34776453f9dc.zip | |
Implemented Touch Panel.
Implemented KeyboardView BringToView routine.
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/DialogViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/DialogViewVM.cs | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/DialogViewVM.cs b/Software/Visual_Studio/Tango.SharedUI/DialogViewVM.cs new file mode 100644 index 000000000..84452408f --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/DialogViewVM.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.SharedUI +{ + /// <summary> + /// Represents a dialog view model base class. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> + public abstract class DialogViewVM : ViewModel + { + public event Action Accepted; + public event Action Canceled; + + /// <summary> + /// Initializes a new instance of the <see cref="DialogViewVM"/> class. + /// </summary> + public DialogViewVM() + { + CanClose = true; + CloseCommand = new RelayCommand(Cancel, (x) => CanClose); + OKCommand = new RelayCommand(Accept, (x) => CanClose); + } + + private bool _canClose; + /// <summary> + /// Gets or sets a value indicating whether this dialog can be closed. + /// </summary> + public bool CanClose + { + get { return _canClose; } + set { _canClose = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + /// <summary> + /// Gets or sets the close command. + /// </summary> + public RelayCommand CloseCommand { get; set; } + + /// <summary> + /// Gets or sets the OK command. + /// </summary> + public RelayCommand OKCommand { get; set; } + + /// <summary> + /// Called when the dialog has been shown. + /// </summary> + public virtual void OnShow() + { + + } + + /// <summary> + /// Invokes the <see cref="Accepted"/> event. + /// </summary> + protected virtual void Accept() + { + Accepted?.Invoke(); + } + + /// <summary> + /// Invokes the <see cref="Canceled"/> event. + /// </summary> + protected virtual void Cancel() + { + Canceled?.Invoke(); + } + } +} |
