using FLY.Thick.FilmCasting.Server;
using FLY.Thick.FilmCasting.Server.OBJProxy;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Navigation;

namespace FLY.Thick.FilmCasting.UI.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.profileParam);

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



        }
    }

}
