Пример #1
0
        public DjHorsifyViewModel(IHorsifyDialogService horsifyDialogService, IDjHorsifyService djHorsifyService, IRegionManager regionManager, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _regionManager        = regionManager;
            _horsifyDialogService = horsifyDialogService;
            _djHorsifyService     = djHorsifyService;
            DjHorsifyOption       = _djHorsifyService.DjHorsifyOption as DjHorsifyOption;

            try
            {
                _djHorsifyService.GetDatabaseFiltersAsync().Wait();
                GenerateHorsifyFilters();
                //Generate the the filtering views collection
                CreateFilterViews();
            }
            catch (Exception ex)
            {
                Log($"Error Loading DjHorsify : {ex.Message}", Category.Exception);
                throw;
            }

            #region Commands
            CreateFilterCommand     = new DelegateCommand(OnCreateFilter);
            ClearSelectionsCommand  = new DelegateCommand(ClearSelections);
            EditFilterCommand       = new DelegateCommand <DjHorsifyFilterModel>(OnEditFilter);
            RunSearchCommand        = new DelegateCommand(OnRunSearch);
            RunSingleSearchCommand  = new DelegateCommand <DjHorsifyFilterModel>(OnRunSearch);
            SaveFilterCommand       = new DelegateCommand(OnSaveFilter);
            ShowSavedFiltersCommand = new DelegateCommand(OnShowSavedFilters);
            #endregion

            ConfirmationRequest = new InteractionRequest <IConfirmation>();
        }
        public SavedSearchFiltersViewModel(IHorsifyDialogService horsifyDialogService, IDjHorsifyService djHorsifyService, IRegionManager regionManager, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _djHorsifyService     = djHorsifyService;
            _regionManager        = regionManager;
            _horsifyDialogService = horsifyDialogService;

            DeleteFilterCommand    = new DelegateCommand(OnDeleteFilterConfirm);
            CloseViewCommand       = new DelegateCommand(() => _regionManager.RequestNavigate(Regions.ContentRegion, "DjHorsifyView"));
            LoadSavedFilterCommand = new DelegateCommand(OnLoadSavedFilter);
            SearchFilterCommand    = new DelegateCommand(OnRunSearchFilter);
            ConfirmationRequest    = new InteractionRequest <IConfirmation>();

            InitSavedFilters();
        }
Пример #3
0
        public EditFilterViewModel(IHorsifyDialogService horsifyDialogService, IDjHorsifyService djHorsifyService, IRegionManager regionManager, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _regionManager        = regionManager;
            _djHorsifyService     = djHorsifyService;
            _horsifyDialogService = horsifyDialogService;

            SearchTerms          = new ObservableCollection <string>();
            AvailableSearchTerms = new ListCollectionView(SearchTerms);

            AddSearchTermCommand    = new DelegateCommand(OnAddSearchTerm);
            CloseViewCommand        = new DelegateCommand(OnCancel);
            DeleteFilterCommand     = new DelegateCommand(OnDeleteFilter);
            RemoveSearchTermCommand = new DelegateCommand(OnRemoveSearchTerm);
            SaveFilterCommand       = new DelegateCommand(OnSaveFilter);

            ConfirmationRequest = new InteractionRequest <IConfirmation>();
        }
Пример #4
0
        public SideBarViewModel(IHorsifyDialogService horsifyDialogService, IEventAggregator eventAggregator, IRegionManager regionManager, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _eventAggregator      = eventAggregator;
            _regionManager        = regionManager;
            _horsifyDialogService = horsifyDialogService;

            Log("Loading SideBar..", Category.Debug, Priority.None);

            //Composite Menus and MenuItems
            mCreator = new MenuCreator();

            //Builds all menu items from the _rootMenu
            SearchButtons = new ObservableCollection <ISearchButtonViewModel>(GenerateSearchButtonsForMenuComponent(mCreator._rootMenu));

            eventAggregator.GetEvent <HorsifySearchCompletedEvent>().Subscribe(() => IsBusy = false);

            #region Commands Setup
            MenuHomeCommand = new DelegateCommand(() =>
            {
                //Build items from the _rootMenu
                SearchButtons.Clear();
                SearchButtons.AddRange(GenerateSearchButtonsForMenuComponent(mCreator._rootMenu));
            });

            NavigateDjHorsifyCommand = new DelegateCommand(() => _regionManager.RequestNavigate(Regions.ContentRegion, "DjHorsifyView"));
            //OPEN SEARCH
            OpenSearchCommand = new DelegateCommand(() =>
            {
                eventAggregator.GetEvent <OnNavigateViewEvent <string> >()
                .Publish("InstantSearch");
            });

            NavigateCommand = new DelegateCommand <string>(OnNavigateView);

            if (SelectMenuCommand == null)
            {
                SelectMenuCommand = new DelegateCommand <SearchButtonViewModel>(async(sbm) => await SelectMenuAsync(sbm));
            }

            MinimizeCommand = new DelegateCommand(OnMinimize);
            ShutdownCommand = new DelegateCommand(OnShutdown);
            #endregion

            ShutdownNotificationRequest = new InteractionRequest <IConfirmation>();
        }
Пример #5
0
        public PlaylistsViewModel(IHorsifyDialogService horsifyDialogService, IPlaylistService horsifyPlaylistService, IEventAggregator eventAggregator,
                                  IRegionManager regionManager, IUnityContainer unityContainer, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _eventAggregator        = eventAggregator;
            _regionManager          = regionManager;
            _unityContainer         = unityContainer;
            _horsifyPlaylistService = horsifyPlaylistService;
            _horsifyDialogService   = horsifyDialogService;

            PlayListViewModels     = new ObservableCollection <PlaylistTabViewModel>();
            OpenPlayListViewModels = new ObservableCollection <PlaylistTabViewModel>();

            #region Commands
            CreatePlaylistCommand    = new DelegateCommand <string>(OnCreatePlaylist);
            OpenSavedPlaylistCommand = new DelegateCommand <PlaylistTabViewModel>(OnOpenSavedPlaylist);

            #endregion

            CreatePlayList("Preparation Playlist", true);

            _horsifyPlaylistService.UpdateFromDatabaseAsync().GetAwaiter().OnCompleted(() =>
            {
                OnPlaylistsUpdated();
            });

            DeletePlaylistCommand = new DelegateCommand(OnDeletePlaylist);
            CloseAllTabsCommand   = new DelegateCommand(OnCloseTabs);
            CloseTabCommand       = new DelegateCommand <PlaylistTabViewModel>(OnCloseTab);

            #region Notification for help
            HelpNotificationRequest = new InteractionRequest <INotification>();
            HelpWindowCommand       = new DelegateCommand(RaiseHelpNotification);

            ConfirmationRequest = new InteractionRequest <IConfirmation>();
            #endregion
        }