PgMenuV4.xaml.cs 4.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
using FLY.OBJComponents.IService;
using FLY.Thick.Base.UI;
using FLY.Weight.Common;
using FLY.Weight.IService;
using FLY.Weight.Server.Model;
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 FLY.Weight.UI.Client
{
    /// <summary>
    /// Page_Menu.xaml 的交互逻辑
    /// </summary>
    public partial class PgMenuV4 : Page
    {
        IUnityContainer container;
        IWeightSystemService weightSystemService;
        public PgMenuV4()
        {
            InitializeComponent();

        }

        [InjectionMethod]
        public void Init(IUnityContainer container,
            IWeightSystemService weightSystemService)
        {
            this.container = container;
            this.weightSystemService = weightSystemService;

            wrappanel_root.DataContext = weightSystemService;
        }

        private void button_ingredient_Click(object sender, RoutedEventArgs e)
        {
            if (!WdPassword.Authorize("Weighter"))
                return;

            PgIngredient p = new PgIngredient();
            container.BuildUp(p);
            NavigationService.Navigate(p);
            
        }

        private void button_screw_Click(object sender, RoutedEventArgs e)
        {
            if (!WdPassword.Authorize("Weighter"))
                return;
            PgScrew p = new PgScrew();
            container.BuildUp(p);
            NavigationService.Navigate(p);
            
        }

        private void button_hopper_Click(object sender, RoutedEventArgs e)
        {
            if (!WdPassword.Authorize("Weighter"))
                return;
            PgHopper p = new PgHopper();
            container.BuildUp(p);
            NavigationService.Navigate(p);
            
        }

        private void button_error_Click(object sender, RoutedEventArgs e)
        {
            PgErrorTable2 p = new PgErrorTable2();
            var warningReasonWindow = container.Resolve<WarningReasonWindow>("weighterWarningReasonWindow");
            var warningService = container.Resolve<IWarningService>("weighterWarningService");
            p.Init(container, warningService, warningReasonWindow);
            NavigationService.Navigate(p);
        }

        private void button_thickness_Click(object sender, RoutedEventArgs e)
        {
            if (!WdPassword.Authorize("Weighter"))
                return;

            PgThickness p = new PgThickness();
            container.BuildUp(p);
            NavigationService.Navigate(p);
        }

        private void button_rollmixtable_Click(object sender, RoutedEventArgs e)
        {
            WeighterC w = ((Button)sender).Tag as WeighterC;

            PgRollMixTable p = new PgRollMixTable();
            container.BuildUp(p,
                new Unity.Resolution.ParameterOverride("w", w));

            NavigationService.Navigate(p);
            
        }

        private void button_mixtable_Click(object sender, RoutedEventArgs e)
        {
            WeighterC w = ((Button)sender).Tag as WeighterC;

            PgMixTable p = new PgMixTable();
            container.BuildUp(p,
                new Unity.Resolution.ParameterOverride("w", w));

            NavigationService.Navigate(p);
        }

        private void button_version_Click(object sender, RoutedEventArgs e)
        {

        }

        private void button_flow_Click(object sender, RoutedEventArgs e)
        {
            PgFlowTable p = new PgFlowTable();
            container.BuildUp(p);
            NavigationService.Navigate(p);
        }

        private void btnReductClick(object sender, RoutedEventArgs e)
        {
            PgReduce p = new PgReduce();
            container.BuildUp(p);
            NavigationService.Navigate(p);
        }
    }
}