using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 System.Net;
using FLY.Thick.Base.Client;
using Unity;

namespace FLY.Thick.Base.UI
{
    /// <summary>
    /// Page_ErrorTable.xaml 的交互逻辑
    /// </summary>
    public partial class PgErrorTable2 : Page
    {
        FLY.OBJComponents.IService.IWarningService warningService;
        WarningReasonWindow warningReasonWindow;
        IUnityContainer container;
        /// <summary>
        /// 
        /// </summary>
        public PgErrorTable2()
        {
            InitializeComponent();

        }


        [InjectionMethod]
        public void Init(
            IUnityContainer container, 
            FLY.OBJComponents.IService.IWarningService warningService,
            WarningReasonWindow warningReasonWindow
            ) 
        {
            this.container = container;
            this.warningService = warningService;
            this.warningReasonWindow = warningReasonWindow;
            gridFlows.ItemsSource = this.warningReasonWindow.Record;

        }
        private void button_back_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.GoBack();
        }

        private void button_reset_click(object sender, RoutedEventArgs e)
        {
            warningService.Reset();
        }

        private void button_silence_click(object sender, RoutedEventArgs e)
        {
            warningService.Silence();
        }

        private void button_database_click(object sender, RoutedEventArgs e)
        {
            PgErrorAllTable p = container.Resolve<PgErrorAllTable>(
                    new Unity.Resolution.ParameterOverride("warningService", warningService));
            NavigationService.Navigate(p);
        }
    }
}
