Пример #1
0
        public MainWindowViewModel()
        {
            LocalizeDictionary.ChangeLanguage(LocalSettings.CurrentLanguage);
            LocalSettings.SetTraceLogPath("term");

            LocalSettings.DefaultCurrencyFormat = "#,#0.00";
            LocalSettings.AppPath = System.IO.Path.GetDirectoryName(Application.ResourceAssembly.Location);
            AppServices.MainDispatcher = Application.Current.Dispatcher;
            GenericRuleRegistator.RegisterOnce();
            TriggerService.UpdateCronObjects();

            LoggedInUserViewModel = new LoggedInUserViewModel();
            LoggedInUserViewModel.CloseButtonClickedEvent += LoggedInUserViewModelCloseButtonClickedEvent;

            LoginViewModel = new LoginViewModel();
            LoginViewModel.PinSubmitted += LoginViewModelPinSubmitted;

            TableScreenViewModel = new TableScreenViewModel();
            TableScreenViewModel.TableSelectedEvent += TableScreenViewModelTableSelectedEvent;

            TicketScreenViewModel = new TicketScreenViewModel();
            TicketScreenViewModel.TicketSelectedEvent += TicketScreenViewModelTicketSelectedEvent;

            DepartmentSelectorViewModel = new DepartmentSelectorViewModel();
            DepartmentSelectorViewModel.DepartmentSelected += DepartmentSelectorViewModelDepartmentSelected;

            TicketEditorViewModel = new TicketEditorViewModel();
            TicketEditorViewModel.OnAddMenuItemsRequested += TicketEditorViewModel_OnAddMenuItemsRequested;
            TicketEditorViewModel.OnCloseTicketRequested += TicketEditorViewModel_OnCloseTicketRequested;
            TicketEditorViewModel.OnSelectTableRequested += TicketEditorViewModel_OnSelectTableRequested;
            TicketEditorViewModel.OnTicketNoteEditorRequested += TicketEditorViewModel_OnTicketNoteEditorRequested;
            TicketEditorViewModel.OnTicketTagEditorRequested += TicketEditorViewModel_OnTicketTagEditorRequested;

            MenuItemSelectorViewModel = new MenuItemSelectorViewModel();
            MenuItemSelectorViewModel.OnTicketItemSelected += MenuItemSelectorViewModel_OnTicketItemSelected;

            SelectedTicketItemEditorViewModel = new SelectedTicketItemEditorViewModel();
            SelectedTicketItemEditorViewModel.TagUpdated += SelectedTicketItemEditorViewModelTagUpdated;

            PermissionRegistry.RegisterPermission(PermissionNames.AddItemsToLockedTickets, PermissionCategories.Ticket, "Kilitli adisyona ekleme yapabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.GiftItems, PermissionCategories.Ticket, "İkram yapabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.VoidItems, PermissionCategories.Ticket, "İade alabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.MoveTicketItems, PermissionCategories.Ticket, "Adisyon satırlarını taşıyabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.MoveUnlockedTicketItems, PermissionCategories.Ticket, "Kilitlenmemiş adisyon satırlarını taşıyabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeExtraProperty, PermissionCategories.Ticket, "Ekstra özellik girebilir");

            AppServices.MessagingService.RegisterMessageListener(new MessageListener());
            if (LocalSettings.StartMessagingClient)
                AppServices.MessagingService.StartMessagingClient();

            EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(
                x =>
                {
                    if (SelectedIndex == 2 && x.Topic == EventTopicNames.MessageReceivedEvent
                        && x.Value.Command == Messages.TicketRefreshMessage)
                    {
                        TableScreenViewModel.Refresh();
                    }
                });
        }
Пример #2
0
        public MainWindowViewModel()
        {
            //TODO: Para birimi servisinden al.

            LocalizeDictionary.ChangeLanguage(LocalSettings.CurrentLanguage);
            LocalSettings.SetTraceLogPath("term");

            LocalSettings.DefaultCurrencyFormat = "#,#0.00";
            LocalSettings.AppPath      = System.IO.Path.GetDirectoryName(Application.ResourceAssembly.Location);
            AppServices.MainDispatcher = Application.Current.Dispatcher;
            GenericRuleRegistator.RegisterOnce();
            TriggerService.UpdateCronObjects();

            LoggedInUserViewModel = new LoggedInUserViewModel();
            LoggedInUserViewModel.CloseButtonClickedEvent += LoggedInUserViewModelCloseButtonClickedEvent;

            LoginViewModel = new LoginViewModel();
            LoginViewModel.PinSubmitted += LoginViewModelPinSubmitted;

            TableScreenViewModel = new TableScreenViewModel();
            TableScreenViewModel.TableSelectedEvent += TableScreenViewModelTableSelectedEvent;

            TicketScreenViewModel = new TicketScreenViewModel();
            TicketScreenViewModel.TicketSelectedEvent += TicketScreenViewModelTicketSelectedEvent;

            DepartmentSelectorViewModel = new DepartmentSelectorViewModel();
            DepartmentSelectorViewModel.DepartmentSelected += DepartmentSelectorViewModelDepartmentSelected;

            TicketEditorViewModel = new TicketEditorViewModel();
            TicketEditorViewModel.OnAddMenuItemsRequested     += TicketEditorViewModel_OnAddMenuItemsRequested;
            TicketEditorViewModel.OnCloseTicketRequested      += TicketEditorViewModel_OnCloseTicketRequested;
            TicketEditorViewModel.OnSelectTableRequested      += TicketEditorViewModel_OnSelectTableRequested;
            TicketEditorViewModel.OnTicketNoteEditorRequested += TicketEditorViewModel_OnTicketNoteEditorRequested;
            TicketEditorViewModel.OnTicketTagEditorRequested  += TicketEditorViewModel_OnTicketTagEditorRequested;

            MenuItemSelectorViewModel = new MenuItemSelectorViewModel();
            MenuItemSelectorViewModel.OnTicketItemSelected += MenuItemSelectorViewModel_OnTicketItemSelected;

            SelectedTicketItemEditorViewModel             = new SelectedTicketItemEditorViewModel();
            SelectedTicketItemEditorViewModel.TagUpdated += SelectedTicketItemEditorViewModelTagUpdated;

            PermissionRegistry.RegisterPermission(PermissionNames.AddItemsToLockedTickets, PermissionCategories.Ticket, "Kilitli adisyona ekleme yapabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.GiftItems, PermissionCategories.Ticket, "İkram yapabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.VoidItems, PermissionCategories.Ticket, "İade alabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.MoveTicketItems, PermissionCategories.Ticket, "Adisyon satırlarını taşıyabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.MoveUnlockedTicketItems, PermissionCategories.Ticket, "Kilitlenmemiş adisyon satırlarını taşıyabilir");
            PermissionRegistry.RegisterPermission(PermissionNames.ChangeExtraProperty, PermissionCategories.Ticket, "Ekstra özellik girebilir");

            AppServices.MessagingService.RegisterMessageListener(new MessageListener());
            if (LocalSettings.StartMessagingClient)
            {
                AppServices.MessagingService.StartMessagingClient();
            }

            EventServiceFactory.EventService.GetEvent <GenericEvent <Message> >().Subscribe(
                x =>
            {
                if (SelectedIndex == 2 && x.Topic == EventTopicNames.MessageReceivedEvent &&
                    x.Value.Command == Messages.TicketRefreshMessage)
                {
                    TableScreenViewModel.Refresh();
                }
            });
        }