コード例 #1
0
        public void ShowDialog(string title, ViewModelBase dialogViewModel)
        {
            if (selectedMainMenu != null)
            {
                //save current selected link
                activeLinkBeforeDialog = selectedMainMenu;
            }

            SelectedMainMenu = null;

            mainMenuLinks.Clear();

            //create a temp link for the dialog
            MainMenuLinkViewModel dialogLink = new MainMenuLinkViewModel(this, title, new ViewModelBase[] { dialogViewModel });

            mainMenuLinks.Add(dialogLink);

            SelectedMainMenu = dialogLink;
        }
コード例 #2
0
        void BuildMainMenu()
        {
            if (defaultLinks == null)
            {
                defaultLinks = new List <MainMenuLinkViewModel>();

                //START
                MainMenuLinkViewModel startLink = new MainMenuLinkViewModel(this, "inicio", new ViewModelBase[]
                {
                    new DashboardViewModel(this)
                });

                defaultLinks.Add(startLink);
                //

                if (loggedInUser.Role.CanSeeSales)
                {
                    //SALES
                    MainMenuLinkViewModel salesLink = new MainMenuLinkViewModel(this, "quorion", new ViewModelBase[]
                    {
                        new SalesListViewModel(this)
                        //new PointOfSaleViewModel(this)
                        //,
                        //new DesignRestaurantViewModel(this),
                        //new ProductionAreasListViewModel(this)
                    });

                    defaultLinks.Add(salesLink);
                }
                //if (loggedInUser.Role.CanSeePurchases)
                //{
                //    //PURCHASES
                //    MainMenuLinkViewModel purchasesLink = new MainMenuLinkViewModel(this, "compras", new ViewModelBase[]
                //    {
                //        new PurchasesListViewModel(this)
                //    });

                //    defaultLinks.Add(purchasesLink);
                //}

                if (loggedInUser.Role.CanSeeInventory)
                {
                    //INVENTORY
                    MainMenuLinkViewModel inventoryLink = new MainMenuLinkViewModel(this, "inventario", new ViewModelBase[]
                    {
                        new InventoryViewModel(this),
                        //new InventoryOperationsListViewModel(this),
                        new CategoryListViewModel(this),
                        new TagListViewModel(this)
                        //new InventoryAreasListViewModel(this),
                        //new InventoryAdvancedSearchViewModel(this)
                    });

                    defaultLinks.Add(inventoryLink);
                }

                if (loggedInUser.Role.CanSeeEmployees)
                {
                    List <ViewModelBase> empSubMenus = new List <ViewModelBase>();
                    if (loggedInUser.Role.CanSeeEmployees)
                    {
                        empSubMenus.Add(new PersonalViewModel(this));
                    }
                    if (loggedInUser.Role.CanSeeRoles)
                    {
                        empSubMenus.Add(new RolesListViewModel(this));
                    }
                    //EMPLOYEES
                    MainMenuLinkViewModel personalLink = new MainMenuLinkViewModel(this, "personal", empSubMenus.ToArray());

                    defaultLinks.Add(personalLink);
                }

                if (loggedInUser.Role.CanSeeReports)
                {
                    MainMenuLinkViewModel mipaladarLink = new MainMenuLinkViewModel(this, "reportes", new ViewModelBase[]
                    {
                        new ReportsCenterViewModel(this)
                    });

                    defaultLinks.Add(mipaladarLink);
                }

                //if (loggedInUser.Role.CanSeeMiPaladar)
                //{
                //    //MIPALADAR
                //    List<ViewModelBase> mpSubMenus = new List<ViewModelBase>();

                //    if (loggedInUser.Role.CanSeeMiPaladar) mpSubMenus.Add(new QuorionConfigDialogViewModel(this));

                //    MainMenuLinkViewModel mipaladarLink = new MainMenuLinkViewModel(this, "mipaladar", mpSubMenus.ToArray());

                //    defaultLinks.Add(mipaladarLink);
                //}
            }

            SelectedMainMenu = null;

            mainMenuLinks.Clear();

            foreach (var item in defaultLinks)
            {
                mainMenuLinks.Add(item);
            }
        }