Beispiel #1
0
        private void SetHighLightButton(HeaderMenuButton selectedButton)
        {
            if (!selectedButton.IsHighLight)
            {
                for (int i = 1; i < uiMenuBar.Children.Count; i++)
                {
                    HeaderMenuButton menuButton = uiMenuBar.Children[i] as HeaderMenuButton;
                    if (menuButton != selectedButton)
                    {
                        menuButton.IsHighLight = false;
                    }
                }

                selectedButton.IsHighLight = true;
                Globals.ActiveModule       = selectedButton.ModuleType;
            }
        }
Beispiel #2
0
        private void BuildStandardMenu()
        {
            EmptyMenu();

            // set logo
            //uiBtnLogo.Content = moduleType.ToString().ToLower();

            List <SiteMapMenuItem> modules = new List <SiteMapMenuItem>();

            foreach (SiteMapMenuItem parentItem in _siteMap)
            {
                if (parentItem.Title == "Logo")
                {
                    //uiContextMenu.ItemsSource = parentItem.Items.ToList();
                    continue;
                }

                ModuleTypes moduleType     = (ModuleTypes)Enum.Parse(typeof(ModuleTypes), parentItem.ModuleType, true);
                bool        isModuleEnable = true;
                //if (moduleType == ModuleTypes.Employees)
                //{
                //    isModuleEnable = Globals.UserLogin.UserModuleTypes.Contains(ModuleTypes.Employees)
                //        || Globals.UserLogin.UserModuleTypes.Contains(ModuleTypes.Sales)
                //        || Globals.UserLogin.UserModuleTypes.Contains(ModuleTypes.Operations);
                //}
                //else
                //{
                //    isModuleEnable = Globals.UserLogin.UserModuleTypes.Contains(moduleType);
                //}
                HeaderMenuButton menu = new HeaderMenuButton()
                {
                    InnerText  = parentItem.Title,
                    ModuleType = moduleType,
                    IsEnabled  = isModuleEnable
                };
                menu.Init(parentItem.Items.ToList(), string.Empty);
                //if (moduleType == Globals.ActiveModule)
                //{
                //    menu.IsHighLight = true;
                //}
                menu.MenuItemClicked += new EventHandler(uiChild_MenuItemClicked);

                uiMenuBar.Children.Add(menu);
            }
        }
Beispiel #3
0
        void uiChild_MenuItemClicked(object sender, EventArgs e)
        {
            HeaderMenuButton selectedButton = sender as HeaderMenuButton;

            SetHighLightButton(selectedButton);
        }
Beispiel #4
0
        private void BuildModuleMenu(ModuleTypes?moduleType)
        {
            if (moduleType == null && Globals.ActiveModule != ModuleTypes.Administration)
            {
                moduleType = Globals.ActiveModule;
            }

            EmptyMenu();

            int index = 0;

            ModuleTypes            currentModuleType = ModuleTypes.Administration;
            List <SiteMapMenuItem> modules           = new List <SiteMapMenuItem>();

            foreach (SiteMapMenuItem parentItem in _siteMap)
            {
                currentModuleType = (ModuleTypes)Enum.Parse(typeof(ModuleTypes), parentItem.ModuleType, true);

                // security filter
                //if (!Globals.UserLogin.UserModuleTypes.Contains(currentModuleType))
                //{
                //    continue;
                //}

                index++;
                if (moduleType == null && index == 2)
                {
                    moduleType = currentModuleType;
                }

                if (moduleType.HasValue && parentItem.Title == moduleType.ToString())
                {
                    // set logo
                    //string resourceName = String.Format("Logo{0}SourceUrl", moduleType.ToString());
                    //uiLogo.Source = new BitmapImage(new Uri(App.Current.Resources[resourceName].ToString(), UriKind.Relative));

                    foreach (SiteMapMenuItem item in parentItem.Items)
                    {
                        HeaderMenuButton menu = new HeaderMenuButton()
                        {
                            InnerText    = item.Title,
                            ContentWidth = 120 // temporary fix the problem of width
                        };
                        menu.Init(item.Items.ToList(), item.Url);

                        uiMenuBar.Children.Add(menu);
                    }
                }
                else
                {
                    modules.Add(new SiteMapMenuItem()
                    {
                        Title       = parentItem.Title,
                        Description = parentItem.Description,
                        Url         = parentItem.Url,
                        IsEnabled   = parentItem.IsEnabled,
                        Target      = parentItem.Target
                    });
                }
            }

            //uiContextMenu.ItemsSource = modules;
        }
Beispiel #5
0
        private void BuildModuleMenu(ModuleTypes? moduleType)
        {
            if (moduleType == null && Globals.ActiveModule != ModuleTypes.Administration)
            {
                moduleType = Globals.ActiveModule;
            }

            EmptyMenu();

            int index = 0;

            ModuleTypes currentModuleType = ModuleTypes.Administration;
            List<SiteMapMenuItem> modules = new List<SiteMapMenuItem>();
            foreach (SiteMapMenuItem parentItem in _siteMap)
            {
                currentModuleType = (ModuleTypes)Enum.Parse(typeof(ModuleTypes), parentItem.ModuleType, true);

                // security filter
                //if (!Globals.UserLogin.UserModuleTypes.Contains(currentModuleType))
                //{
                //    continue;
                //}

                index++;
                if (moduleType == null && index == 2)
                {
                    moduleType = currentModuleType;
                }

                if (moduleType.HasValue && parentItem.Title == moduleType.ToString())
                {
                    // set logo
                    //string resourceName = String.Format("Logo{0}SourceUrl", moduleType.ToString());
                    //uiLogo.Source = new BitmapImage(new Uri(App.Current.Resources[resourceName].ToString(), UriKind.Relative));

                    foreach (SiteMapMenuItem item in parentItem.Items)
                    {
                        HeaderMenuButton menu = new HeaderMenuButton()
                        {
                            InnerText = item.Title,
                            ContentWidth = 120 // temporary fix the problem of width
                        };
                        menu.Init(item.Items.ToList(), item.Url);

                        uiMenuBar.Children.Add(menu);
                    }
                }
                else
                {
                    modules.Add(new SiteMapMenuItem()
                    {
                        Title = parentItem.Title,
                        Description = parentItem.Description,
                        Url = parentItem.Url,
                        IsEnabled = parentItem.IsEnabled,
                        Target = parentItem.Target
                    });
                }
            }

            //uiContextMenu.ItemsSource = modules;
        }
Beispiel #6
0
        private void SetHighLightButton(HeaderMenuButton selectedButton)
        {
            if (!selectedButton.IsHighLight)
            {
                for (int i = 1; i < uiMenuBar.Children.Count; i++)
                {
                    HeaderMenuButton menuButton = uiMenuBar.Children[i] as HeaderMenuButton;
                    if (menuButton != selectedButton)
                    {
                        menuButton.IsHighLight = false;
                    }
                }

                selectedButton.IsHighLight = true;
                Globals.ActiveModule = selectedButton.ModuleType;
            }
        }
Beispiel #7
0
        private void BuildStandardMenu()
        {
            EmptyMenu();

            // set logo
            //uiBtnLogo.Content = moduleType.ToString().ToLower();

            List<SiteMapMenuItem> modules = new List<SiteMapMenuItem>();
            foreach (SiteMapMenuItem parentItem in _siteMap)
            {
                if (parentItem.Title == "Logo")
                {
                    //uiContextMenu.ItemsSource = parentItem.Items.ToList();
                    continue;
                }

                ModuleTypes moduleType = (ModuleTypes)Enum.Parse(typeof(ModuleTypes), parentItem.ModuleType, true);
                bool isModuleEnable = true;
                //if (moduleType == ModuleTypes.Employees)
                //{
                //    isModuleEnable = Globals.UserLogin.UserModuleTypes.Contains(ModuleTypes.Employees)
                //        || Globals.UserLogin.UserModuleTypes.Contains(ModuleTypes.Sales)
                //        || Globals.UserLogin.UserModuleTypes.Contains(ModuleTypes.Operations);
                //}
                //else
                //{
                //    isModuleEnable = Globals.UserLogin.UserModuleTypes.Contains(moduleType);
                //}
                HeaderMenuButton menu = new HeaderMenuButton()
                {
                    InnerText = parentItem.Title,
                    ModuleType = moduleType,
                    IsEnabled = isModuleEnable
                };
                menu.Init(parentItem.Items.ToList(), string.Empty);
                //if (moduleType == Globals.ActiveModule)
                //{
                //    menu.IsHighLight = true;
                //}
                menu.MenuItemClicked += new EventHandler(uiChild_MenuItemClicked);

                uiMenuBar.Children.Add(menu);
            }
        }