/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Properties/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.Commands;
using Tango.PPC.Common;
using Tango.PPC.Common.Navigation;

namespace Tango.PPC.UI.ViewModels
{
    public class LoadingErrorViewVM : PPCViewModel, INavigationObjectReceiver<Exception>
    {
        private String _error;
        public String Error
        {
            get { return _error; }
            set { _error = value; RaisePropertyChangedAuto(); }
        }

        public RelayCommand RestartCommand { get; set; }

        public LoadingErrorViewVM()
        {
            RestartCommand = new RelayCommand(Restart);
        }

        public override void OnApplicationStarted()
        {

        }

        public void OnNavigatedToWithObject(Exception ex)
        {
            Error = ex.Message;
        }

        private void Restart()
        {
            ApplicationManager.Restart();
        }
    }
}