aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs
blob: 3db95368ecd175185472a17eaa6300d5536c4b15 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.MachineStudio.Common.Notifications;
using SimpleValidator.Extensions;

namespace Tango.MachineStudio.DB.ViewModels
{
    public class ContactsViewVM : DbTableViewModel<Contact>
    {
        public ContactsViewVM(INotificationProvider notification) : base(notification)
        {
        }



        protected override void OnValidating()
        {
            EditEntity.FullName = EditEntity.FirstName + " " + EditEntity.LastName;

            base.OnValidating();

            if (!EditEntity.Email.IsEmail())
            {
                ValidationErrors.Add("Email address is invalid");
            }
        }
    }
}
"w"> DependencyProperty.Register("SolutionItem", typeof(ISolutionItem), typeof(SolutionItemControl), new PropertyMetadata(null)); public ICommand OpenCommand { get { return (ICommand)GetValue(OpenCommandProperty); } set { SetValue(OpenCommandProperty, value); } } public static readonly DependencyProperty OpenCommandProperty = DependencyProperty.Register("OpenCommand", typeof(ICommand), typeof(SolutionItemControl), new PropertyMetadata(null)); static SolutionItemControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(SolutionItemControl), new FrameworkPropertyMetadata(typeof(SolutionItemControl))); } public SolutionItemControl() { PreviewMouseDoubleClick += (_, __) => { if (SolutionItem.CanOpen) { OpenCommand?.Execute(SolutionItem); } }; } } }