PgErrorTable.xaml.cs 2.79 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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;
16
using Unity;
潘栩锋's avatar
潘栩锋 committed
17

潘栩锋's avatar
潘栩锋 committed
18
namespace FLY.Thick.Base.UI
潘栩锋's avatar
潘栩锋 committed
19 20 21 22 23 24
{
    /// <summary>
    /// Page_ErrorTable.xaml 的交互逻辑
    /// </summary>
    public partial class PgErrorTable : Page
    {
25 26 27
        FLY.OBJComponents.IService.IWarningService warningService;
        WarningReasonWindow warningReasonWindow;
        IUnityContainer container;
潘栩锋's avatar
潘栩锋 committed
28 29 30 31 32 33 34 35 36
        /// <summary>
        /// 
        /// </summary>
        public PgErrorTable()
        {
            InitializeComponent();

        }

37 38

        [InjectionMethod]
潘栩锋's avatar
潘栩锋 committed
39
        public void Init(
40 41
            IUnityContainer container, 
            FLY.OBJComponents.IService.IWarningService warningService,
42
            WarningReasonWindow warningReasonWindow
43
            ) 
潘栩锋's avatar
潘栩锋 committed
44
        {
45 46 47 48
            this.container = container;
            this.warningService = warningService;
            this.warningReasonWindow = warningReasonWindow;
            gridFlows.ItemsSource = this.warningReasonWindow.Record;
潘栩锋's avatar
潘栩锋 committed
49

50
        }
潘栩锋's avatar
潘栩锋 committed
51 52 53 54 55 56 57
        private void button_back_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.GoBack();
        }

        private void button_reset_click(object sender, RoutedEventArgs e)
        {
58
            warningService.Reset();
潘栩锋's avatar
潘栩锋 committed
59 60 61 62 63
        }

        private void button_iotip_click(object sender, RoutedEventArgs e)
        {
            Window w;
64
            if (container.IsRegistered<Window>("wdIOTip")) 
潘栩锋's avatar
潘栩锋 committed
65
            {
66
                w = container.Resolve<Window>("wdIOTip");
潘栩锋's avatar
潘栩锋 committed
67 68 69 70 71 72 73 74 75 76 77 78
            }
            else
            {
                w = new WdIOTip();
            }
            w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this);
            w.ShowDialog();
        }

        private void button_access_click(object sender, RoutedEventArgs e)
        {
            WdFlyADAccess w = new WdFlyADAccess();
79 80
            var flyAdService = container.Resolve<FLY.Thick.Base.IService.IFlyADService>();
            w.Init(flyAdService);
潘栩锋's avatar
潘栩锋 committed
81 82 83 84 85 86
            w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this);
            w.ShowDialog();
        }

        private void button_silence_click(object sender, RoutedEventArgs e)
        {
87
            warningService.Silence();
潘栩锋's avatar
潘栩锋 committed
88 89 90 91
        }

        private void button_database_click(object sender, RoutedEventArgs e)
        {
92 93 94
            PgErrorAllTable p = container.Resolve<PgErrorAllTable>(
                    new Unity.Resolution.ParameterOverride("warningService", warningService));
            NavigationService.Navigate(p);
潘栩锋's avatar
潘栩锋 committed
95 96 97
        }
    }
}