using Install.Core.Common;
using System.Windows;
using System.Windows.Navigation;
using Update.Core;
using Update.View;

namespace Update
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : NavigationWindow
    {
        InstallWizard installWizard;
        public MainWindow()
        {
            InitializeComponent();


            Ver ver = new Ver() { SrcType = this.GetType() };

            this.Title = ver.ToString();

            installWizard = new InstallWizard();
            if (!installWizard.Init())
            {
                //异常，不能找到安装包
                MessageBox.Show(installWizard.Msg, "异常", MessageBoxButton.OK, MessageBoxImage.Error);
                App.Current.Shutdown();
                return;
            }

            Application.Current.Properties[nameof(InstallWizard)] = installWizard;
            Application.Current.Properties["NavigationService"] = NavigationService;
            PgUpdate p = new PgUpdate();
            p.Init();
            NavigationService.Navigate(p);
        }
    }
}
