Beispiel #1
0
 private void OnListDepartments(string obj)
 {
     if (_departmentListViewModel == null)
     {
         _departmentListViewModel = new DepartmentListViewModel();
     }
     CommonEventPublisher.PublishViewAddedEvent(_departmentListViewModel);
 }
Beispiel #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;
                    }
                }
            });
        }