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;
        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();

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

}
