aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs
blob: d0c08fb3a7dd4fa20e7295ee74be244764dad594 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.SharedUI
{
    public abstract class ViewModel<T> where T : IView
    {
        public T View { get; set; }

        public ViewModel(T view)
        {
            View = view;
            View.ViewAttached += (x, e) => 
            {
                View = (T)e;
                OnViewAttached();
            };
        }

        protected virtual void OnViewAttached()
        {

        }
    }
}