using FLY.Thick.Blowing.Server;
using FLY.Thick.Blowing.Server.OBJProxy;
using System.Windows;
using System.Windows.Navigation;

namespace FLY.Thick.Blowing.UI.Fix.Server
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : NavigationWindow
    {
        FLY.AppHelper.WindowNotifyIconHelper notifyiconhelper;
        TDGage mGage;
        OBJProxy mOBJProxy;
        PicHistory picHistory;

        public MainWindow()
        {
            InitializeComponent();
            PgLoading p = new PgLoading();
            this.Navigate(p);

            this.Title = (new Misc.Ver() { SrcType = typeof(MainWindow) }).ToString();

            notifyiconhelper = new AppHelper.WindowNotifyIconHelper(this, this.Title);
        }

        private async void NavigationWindow_Loaded(object sender, RoutedEventArgs e)
        {
            mGage = new TDGage("Gage1");
            await mGage.Init();

            mOBJProxy = new OBJProxy(0, mGage);

            FObjBase.PollModule.Current.Start();

            //周期保存图片
            picHistory = new PicHistory();
            picHistory.Init(
                mGage.bulkDb,
                mGage.scanWarning,
                mGage.profile.Param);

            this.Hide();
            PgMain p = new PgMain();
            p.Init(mGage, picHistory);
            this.Navigate(p);
            this.NavigationService.RemoveBackEntry();
        }

        //private void button_open_Click(object sender, RoutedEventArgs e)
        //{
        //    string path = mPicHistory.RootPath;
        //    System.Diagnostics.Process.Start("explorer.exe", path);
        //}
    }
}