summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Application/ViewModels/Generic/DialogViewModel.cs
blob: 523b64f53ca7e4f666c269ceac9c7e47c4c546ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using Gestor.Application.Helpers;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Windows;

namespace Gestor.Application.ViewModels.Generic
{
	public class DialogViewModel : INotifyPropertyChanged
	{
		private string _message;

		private string _acceptContent;

		private string _cancelContent;

		private Visibility _cancelVisibility;

		public string AcceptContent
		{
			get
			{
				return this._acceptContent;
			}
			set
			{
				this.MutateVerbose<string>(ref this._acceptContent, value, this.RaisePropertyChanged(), "AcceptContent");
			}
		}

		public string CancelContent
		{
			get
			{
				return this._cancelContent;
			}
			set
			{
				this.CancelVisibility = (string.IsNullOrEmpty(value) ? Visibility.Collapsed : Visibility.Visible);
				this.MutateVerbose<string>(ref this._cancelContent, value, this.RaisePropertyChanged(), "CancelContent");
			}
		}

		public Visibility CancelVisibility
		{
			get
			{
				return this._cancelVisibility;
			}
			set
			{
				this.MutateVerbose<Visibility>(ref this._cancelVisibility, value, this.RaisePropertyChanged(), "CancelVisibility");
			}
		}

		public string Message
		{
			get
			{
				return this._message;
			}
			set
			{
				this.MutateVerbose<string>(ref this._message, value, this.RaisePropertyChanged(), "Message");
			}
		}

		public DialogViewModel()
		{
		}

		private Action<PropertyChangedEventArgs> RaisePropertyChanged()
		{
			return (PropertyChangedEventArgs args) => {
				PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged;
				if (propertyChangedEventHandler == null)
				{
					return;
				}
				propertyChangedEventHandler(this, args);
			};
		}

		public event PropertyChangedEventHandler PropertyChanged;
	}
}