using Helper;
using HKCardOUT.ViewModels;
using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Media;

namespace HKCardOUT.Views
{
    public partial class RootView : HandyControl.Controls.Window
    {
        public RootView()
        {
            InitializeComponent();
            if (!StartEXE.IsExistKey("HKCardOUT"))
            {
                var Paths = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HKCardOUT.exe");
                StartEXE.SelfRunning(true, "HKCardOUT", Paths);
            }
            //else if (StartEXE.IsExistKey("HKCardOUT"))
            //{
            //    var Paths = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HKCardOUT.exe");
            //    StartEXE.SelfRunning(false, "HKCardOUT", Paths);
            //}
            this.Loaded += RootView_Loaded;
        }

        private void RootView_Loaded(object sender, RoutedEventArgs e)
        {
            (this.DataContext as RootViewModel).Main = this;
           HKControl.Main.GetInstance.Init();
        }
    }
}
