예제 #1
0
 public void OnListMenuItems(string value)
 {
     if (_menuItemListViewModel == null)
     {
         _menuItemListViewModel = new MenuItemListViewModel();
     }
     CommonEventPublisher.PublishViewAddedEvent(_menuItemListViewModel);
 }
예제 #2
0
        public MenuModule()
        {
            ListDepartmentsCommand            = new CategoryCommand <string>(Resources.Departments, Resources.Settings, OnListDepartments);
            ListMenuItemsCommand              = new CategoryCommand <string>(Resources.ProductList, Resources.Products, OnListMenuItems);
            ListScreenMenusCommand            = new CategoryCommand <string>(Resources.MenuList, Resources.Products, OnListScreenMenus);
            ListMenuItemPropertyGroupsCommand = new CategoryCommand <string>(Resources.ModifierGroups, Resources.Products, OnListMenuItemPropertyGroupsCommand);
            ListPricesCommand          = new CategoryCommand <string>(Resources.BatchPriceList, Resources.Products, OnListPrices);
            ListTicketTagGroupsCommand = new CategoryCommand <string>(Resources.TicketTags, Resources.Settings, OnListTicketTags)
            {
                Order = 10
            };
            ListMenuItemPriceDefinitionsCommand = new CategoryCommand <string>(Resources.PriceDefinitions, Resources.Products, OnListMenuItemPriceDefinitions);
            ListVatTemplatesCommand             = new CategoryCommand <string>(Resources.VatTemplates, Resources.Products, OnListVatTemplates);
            ListTaxServiceTemplates             = new CategoryCommand <string>(Resources.TaxServiceTemplates, Resources.Products, OnListTaxServiceTemplates);

            PermissionRegistry.RegisterPermission(PermissionNames.ChangeDepartment, PermissionCategories.Department, Resources.CanChangeDepartment);
            foreach (var department in AppServices.MainDataContext.Departments)
            {
                PermissionRegistry.RegisterPermission(PermissionNames.UseDepartment + department.Id, PermissionCategories.Department, department.Name);
            }

            EventServiceFactory.EventService.GetEvent <GenericEvent <VisibleViewModelBase> >().Subscribe(s =>
            {
                if (s.Topic == EventTopicNames.ViewClosed)
                {
                    if (s.Value == _menuItemListViewModel)
                    {
                        _menuItemListViewModel = null;
                    }

                    if (s.Value == _screenMenuListViewModel)
                    {
                        _screenMenuListViewModel = null;
                    }

                    if (s.Value == _departmentListViewModel)
                    {
                        _departmentListViewModel = null;
                    }

                    if (s.Value == _menuItemPropertyGroupListViewModel)
                    {
                        _menuItemPropertyGroupListViewModel = null;
                    }

                    if (s.Value == _priceListViewModel)
                    {
                        _priceListViewModel = null;
                    }

                    if (s.Value == _ticketTagGroupListViewModel)
                    {
                        _ticketTagGroupListViewModel = null;
                    }

                    if (s.Value == _menuItemPriceDefinitionListViewModel)
                    {
                        _menuItemPriceDefinitionListViewModel = null;
                    }

                    if (s.Value == _vatTemplateListViewModel)
                    {
                        _vatTemplateListViewModel = null;
                    }

                    if (s.Value == _taxServiceTemplateListViewModel)
                    {
                        _taxServiceTemplateListViewModel = null;
                    }
                }
            });
        }