using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Unity;

namespace MultiLayout
{
    /// <summary>
    /// UcMainGage.xaml 的交互逻辑
    /// </summary>
    public partial class UcSingleGage : UserControl
    {
        FlyLayoutManager manager;
        public UcSingleGage()
        {
            InitializeComponent();
        }
        public void Init(FlyLayoutManager manager) 
        {
            this.manager = manager;
            this.DataContext = manager.layout;
        }

        private void button_option_click(object sender, RoutedEventArgs e)
        {
            if (FlyLayoutManager.Authorize?.Invoke("Menu") == false)
                return;
            PgMenu p = new PgMenu();
            p.Init(manager);
            FlyLayoutManager.NavigationService.Navigate(p);
        }

        private void btnErrMsgClick(object sender, RoutedEventArgs e)
        {
            manager.ErrMsgClick?.Invoke();
        }
    }
  
}
