using GalaSoft.MvvmLight;
using System.Windows.Media;
using GalaSoft.MvvmLight.Command;
using System.Windows;

namespace WPMvvmLight.ViewModel
{
    public class MainViewModel : ViewModelBase
    {
        public const string BackColorPropertyName = "BackColor";

        private SolidColorBrush _myProperty = new SolidColorBrush (Colors.Transparent);

        public SolidColorBrush BackColor
        {
            get
            {
                return _myProperty;
            }

            set
            {
                if (_myProperty == value)
                {
                    return;
                }

                var oldValue = _myProperty;
                _myProperty = value;

                // Update bindings, no broadcast
                RaisePropertyChanged(BackColorPropertyName);
            }
        }

        public RelayCommand ButtonCommand
        {
            get;
            private set;
        }
        public string ApplicationTitle
        {
            get
            {
                return "MVVM LIGHT";
            }
        }

        public string PageName
        {
            get
            {
                return "My page:";
            }
        }

        public string Welcome
        {
            get
            {
                return "Welcome to MVVM Light";
            }
        }

        public MainViewModel()
        {
            if (IsInDesignMode)
            {
            }
            else
            {
                ButtonCommand = new RelayCommand(() =>
                {
                    
                    MessageBox.Show("Hello World");
                    BackColor.Color = Colors.Green;
                });
            }
        }

        ////public override void Cleanup()
        ////{
        ////    // Clean up if needed

        ////    base.Cleanup();
        ////}
    }
}