Exemplo n.º 1
0
 //主菜单的选择和其子菜单名是否显示
 private void MainMenuButton_Click(object sender, RoutedEventArgs e)
 {
     IFactory.UI.Core.MenuNode menuNode = (IFactory.UI.Core.MenuNode)((FrameworkElement)sender).Tag;
     if (this.lastSelectedMainNode != menuNode && this.lastSelectedMainNode.ChildPanel != null)
     {
         this.lastSelectedMainNode.ChildPanel.Visibility = Visibility.Collapsed;
     }
     if (menuNode.ChildPanel != null)
     {
         menuNode.ChildPanel.Visibility = Visibility.Visible;
     }
     this.lastSelectedMainNode = menuNode;
     if (menuNode.Children.Count != 0 || this.lastSelectdChildNode == null)
     {
         return;
     }
     this.lastSelectdChildNode.Button.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
     this.lastSelectdChildNode = null;
 }
Exemplo n.º 2
0
        //private static Uri baseOneChangePage = null;

        //点击子菜单
        private void ChildMenuButton_Click(object sender, RoutedEventArgs e)
        {
            MainPage.StateCycleItemData StateCycleItemData = new MainPage.StateCycleItemData();
            Button   button = (Button)sender;
            MenuNode tag    = (MenuNode)button.Tag;

            if ((tag != this.lastSelectdChildNode) && (this.lastSelectdChildNode != null))
            {
                this.lastSelectdChildNode.Button.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            }
            this.lastSelectdChildNode = tag;
            tag.Button.Background     = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/IFactory.UI;component/Assets/menu_child_button_bg.png", UriKind.Absolute)));
            switch (tag.PermissionNode.Code)
            {
            //本机概况
            case "RemoteMonitor.ProductOverview":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    //this.mainPage.Navigate(new Uri("CraftIndex/CraftInspection1Page.xaml", UriKind.Relative));
                    this.mainPage.Navigate(new Uri("CraftIndex/CraftInspection1Page.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("CraftIndex/CraftInspection2Page.xaml", UriKind.Relative));
                }
                break;

            //用户管理
            case "UserManager.User":
                this.mainPage.Navigate(new Uri("UserManager/UserManagerPage.xaml", UriKind.Relative));
                break;



            //新报警管理 lipl
            case "AlarmInfo.AlarmInfo":
                this.mainPage.Navigate(new Uri("AlarmInfo/AlarmInfoPage.xaml", UriKind.Relative));
                break;

            //参数设置管理 产品信息维护 lipl
            case "SystemParam.ProductParam":
                if (null == baseProductParam)
                {
                    baseProductParam = new IFactory.UI.SystemParamManager.ProductParamManagerPage();
                }
                this.mainPage.Navigate(baseProductParam);
                //this.mainPage.Navigate(new Uri("SystemParam/ProductParamManagerPage.xaml", UriKind.Relative));
                break;

            case "SystemParam.ProductLightParam":
                break;

            //参数设置管理 产品槽位坐标设置 lipl
            case "SystemParam.SystemParam":
                if (null == baseSystemParam)
                {
                    baseSystemParam = new SystemParamManagerPage();
                }
                this.mainPage.Navigate(baseSystemParam);

                //this.mainPage.Navigate(new Uri("SystemParam/SystemParamManagerPage.xaml", UriKind.Relative));
                break;

            //个人管理
            case "UserManager.Personal":
                this.mainPage.Navigate(new Uri("UserManager/PersonalInfoPage.xaml", UriKind.Relative));
                break;

            //角色管理
            case "UserManager.Role":
                this.mainPage.Navigate(new Uri("UserManager/RoleManagerPage.xaml", UriKind.Relative));
                break;

            //实时报警
            case "AlarmMonitor.RealTime":
                this.mainPage.Navigate(new Uri("AlarmMonitor/RealTimeAlarmListPage.xaml", UriKind.Relative));
                break;

            //历史报警
            case "AlarmMonitor.History":
                this.mainPage.Navigate(new Uri("AlarmMonitor/HistoryAlarmListPage.xaml", UriKind.Relative));
                break;

            //报警设置
            case "AlarmMonitor.Set":
                this.mainPage.Navigate(new Uri("AlarmMonitor/SetAlarmPage.xaml", UriKind.Relative));
                break;

            //生产数据
            case "DataList.DataProductionRealTime":
                this.mainPage.Navigate(new Uri("zhuisu/DataProductionRealPage.xaml", UriKind.Relative));
                break;

            //生产产能
            case "DataWareHouse.DataCapacity":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataCapacityPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataCapacityPage2.xaml", UriKind.Relative));
                }
                break;

            //生产优率
            case "DataWareHouse.DataQulity":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataQualityPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataQualityPage2.xaml", UriKind.Relative));
                }
                break;

            //PPM
            case "DataWareHouse.PPM":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/PPMPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/PPMPage2.xaml", UriKind.Relative));
                }
                break;

            //报警记录
            case "AlarmMonitor.AlarmCounts":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataAlarmPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataAlarmPage2.xaml", UriKind.Relative));
                }
                break;

            //测量尺寸
            case "DataWareHouse.Ave":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/AVEPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/AVEPage2.xaml", UriKind.Relative));
                }
                break;

            //良品数
            case "DataWareHouse.OK":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataOKPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataOKPage2.xaml", UriKind.Relative));
                }
                break;

            //坏品数
            case "DataWareHouse.NG":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataNGPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/DataNGPage2.xaml", UriKind.Relative));
                }
                break;

            //菜单管理
            case "SystemSetting.Menus":
                this.mainPage.Navigate(new Uri("UserManager/MenuManagementPage.xaml", UriKind.Relative));
                break;

            //生产报表
            case "DataWareHouse.ProductStatement":
                //if (MainPage.CompareCraftNO == "STF_IN1")
                //this.mainPage.Navigate(new Uri("DataWareHouse/ProductStatementPage.xaml", UriKind.Relative));
                //if (MainPage.CompareCraftNO == "STF_IN2")
                //this.mainPage.Navigate(new Uri("DataWareHouse/ProductStatementPage2.xaml", UriKind.Relative));

                break;

            //生产异常报表
            case "DataWareHouse.ProductStatementNG":
                // if (MainPage.CompareCraftNO == "STF_IN1")
                //this.mainPage.Navigate(new Uri("DataWareHouse/ProductStatementNGPage.xaml", UriKind.Relative));
                //if (MainPage.CompareCraftNO == "STF_IN2")
                //this.mainPage.Navigate(new Uri("DataWareHouse/ProductStatementNGPage2.xaml", UriKind.Relative));
                break;

            //实时追溯
            case "DataList.ZhuiSuRealTime":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("ZhuiSu/ZhuiSuRealTimePage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("ZhuiSu/ZhuiSuRealTimePage2.xaml", UriKind.Relative));
                }

                break;

            //历史追溯
            case "DataList.ZhuiSuHistory":
                this.mainPage.Navigate(new Uri("ZhuiSu/ZhuiSuHistoryPage.xaml", UriKind.Relative));
                break;

            //历史生产数据
            case "DataList.DataProductionHistory":
                this.mainPage.Navigate(new Uri("zhuisu/DataProductionHistoryPage.xaml", UriKind.Relative));
                break;

            //易损件统计
            case "Maintain.VulnerableStatistic":
                this.mainPage.Navigate(new Uri("Maintain/VulnerableStatisticPage.xaml", UriKind.Relative));
                break;

            //冷热待机
            case "Situation.Standby":
            {
                StandbyPage page12 = new StandbyPage();
                this.mainPage.Navigate(page12);
                break;
            }

            //设备管理
            case "SystemSetting.Alarmunit":
                this.mainPage.Navigate(new Uri("Setting/AlarmUnitPage.xaml", UriKind.Relative));
                break;

            //概况预设
            case "SystemSetting.GeneralPresupposition":
                this.mainPage.Navigate(new Uri("Setting/ProductionLineManagentPage.xaml", UriKind.Relative));
                break;

            //参数设置
            case "SystemSetting.SetArgument":
                //this.mainPage.Navigate(new Uri("Setting/SetArgumentPage.xaml", UriKind.Relative));
                break;

            //工作日历
            case "SystemSetting.WorkCalendar":
                if (MainPage.CompareCraftNO == "STF_IN1")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/WorkCalendarPage.xaml", UriKind.Relative));
                }
                if (MainPage.CompareCraftNO == "STF_IN2")
                {
                    this.mainPage.Navigate(new Uri("DataWareHouse/WorkCalendarPage2.xaml", UriKind.Relative));
                }
                break;

            //一键启动
            case "FarCtrl.OneKey":
                if (null == basePageOneKer)
                {
                    basePageOneKer = new OneKey2();
                }
                this.mainPage.Navigate(basePageOneKer);
                //this.mainPage.Navigate(new Uri("FarCtrl/OneKeyPage2.xaml", UriKind.Relative));


                break;

            //一键换型
            case "FarCtrl.OneChange":
                if (null == baseOneChangePage)
                {
                    baseOneChangePage = new OneChange();
                    //baseOneChangePage = new Uri("FarCtrl/OneChangePage.xaml", UriKind.Relative);
                }

                this.mainPage.Navigate(baseOneChangePage);
                //this.mainPage.Navigate(baseOneChangePage);
                //this.mainPage.Navigate(new Uri("FarCtrl/OneChangePage.xaml", UriKind.Relative));
                break;

            case "Diagnostic":
                if (null == baseDiagnostic)
                {
                    baseDiagnostic = new IFactory.UI.Diagnostic.Diagnostic();
                }
                this.mainPage.Navigate(baseDiagnostic);
                //this.mainPage.Navigate(new Uri("Diagnostic/Diagnostic.xaml", UriKind.Relative));
                break;
            }
        }
Exemplo n.º 3
0
        public void BuildMenus(IList <PermissionNode> permissionNodes)
        {
            Style  style1 = this.FindResource("MainButtonStyle") as Style;
            Style  style2 = this.FindResource("ChildButtonStyle") as Style;
            Style  style3 = this.FindResource("ChildButtonSelectedStyle") as Style;
            double height = this.menus.Height;

            foreach (PermissionNode permissionNode in permissionNodes)
            {
                IFactory.UI.Core.MenuNode menuNode1 = new IFactory.UI.Core.MenuNode();
                Button button1 = new Button();
                button1.Style            = style1;
                button1.Click           += new RoutedEventHandler(this.MainMenuButton_Click);
                button1.Content          = permissionNode.Text;
                menuNode1.Button         = button1;
                menuNode1.PermissionNode = permissionNode;
                button1.Tag = menuNode1;
                this.menus.Children.Add(button1);
                this.mainNodes.Add(menuNode1);
                if (permissionNode.Children.Count > 0)
                {
                    ScrollViewer scrollViewer = new ScrollViewer();
                    scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
                    StackPanel stackPanel = new StackPanel();
                    scrollViewer.Content    = stackPanel;
                    scrollViewer.Visibility = Visibility.Collapsed;
                    foreach (PermissionNode child in permissionNode.Children)
                    {
                        IFactory.UI.Core.MenuNode menuNode2 = new IFactory.UI.Core.MenuNode();
                        Button button2 = new Button();
                        button2.Style            = style2;
                        button2.Click           += new RoutedEventHandler(this.ChildMenuButton_Click);
                        button2.Content          = child.Text;
                        menuNode2.Button         = button2;
                        menuNode2.PermissionNode = child;
                        button2.Tag = menuNode2;
                        menuNode1.Children.Add(menuNode2);
                        stackPanel.Children.Add(button2);
                    }
                    menuNode1.ChildPanel = scrollViewer;
                    this.menus.Children.Add(scrollViewer);
                }
                height -= button1.Height + button1.Margin.Top + button1.Margin.Bottom;
            }
            foreach (IFactory.UI.Core.MenuNode mainNode in this.mainNodes)
            {
                if (mainNode.ChildPanel != null)
                {
                    mainNode.ChildPanel.Height = height;
                }
            }
            if (this.mainNodes.Count <= 0)
            {
                return;
            }
            this.lastSelectedMainNode = this.mainNodes.First <IFactory.UI.Core.MenuNode>();
            if (this.lastSelectedMainNode.ChildPanel == null)
            {
                return;
            }
            this.lastSelectedMainNode.ChildPanel.Visibility = Visibility.Visible;
            this.lastSelectdChildNode = this.lastSelectedMainNode.Children.First <IFactory.UI.Core.MenuNode>();
            this.lastSelectdChildNode.Button.Style = style3;
        }