Esempio n. 1
0
        public Shell(IContainerProvider container, IWindowsIntegrationService windowsIntegrationService, II18nService i18nService,
                     INotificationService notificationService, IWin32InputService win32InputService, IAppearanceService appearanceService,
                     IPlaybackService playbackService, IMetadataService metadataService, ILifetimeService lifetimeService,
                     IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;
            this.appearanceService         = appearanceService;
            this.i18nService     = i18nService;
            this.lifetimeService = lifetimeService;
            this.eventAggregator = eventAggregator;

            this.shellService = container.Resolve <Func <string, string, string, string, string, IShellService> >()(
                typeof(NowPlaying.NowPlaying).FullName, typeof(FullPlayer.FullPlayer).FullName, typeof(CoverPlayer).FullName,
                typeof(MicroPlayer).FullName, typeof(NanoPlayer).FullName);

            this.InitializeServices();
            this.InitializeWindows();
            this.InitializeTrayIcon();
            this.InitializeCommands();
        }
Esempio n. 2
0
        public Shell(IUnityContainer container, IWindowsIntegrationService windowsIntegrationService,
                     INotificationService notificationService, IWin32InputService win32InputService, IAppearanceService appearanceService,
                     IPlaybackService playbackService, IMetadataService metadataService, IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;
            this.appearanceService         = appearanceService;
            this.eventAggregator           = eventAggregator;

            this.shellService = container.Resolve <IShellService>(
                new ParameterOverride("nowPlayingPage", typeof(NowPlaying.NowPlaying).FullName),
                new ParameterOverride("fullPlayerPage", typeof(FullPlayer.FullPlayer).FullName),
                new ParameterOverride("coverPlayerPage", typeof(CoverPlayer).FullName),
                new ParameterOverride("microplayerPage", typeof(MicroPlayer).FullName),
                new ParameterOverride("nanoPlayerPage", typeof(NanoPlayer).FullName)
                );

            this.InitializeServices();
            this.InitializeWindows();
            this.InitializeTrayIcon();
            this.InitializeCommands();
        }
Esempio n. 3
0
        public Shell(IUnityContainer container, IWindowsIntegrationService windowsIntegrationService,
                     INotificationService notificationService, IWin32InputService win32InputService,
                     IPlaybackService playbackService, IMetadataService metadataService, IRegionManager regionManager,
                     IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;
            this.regionManager             = regionManager;
            this.eventAggregator           = eventAggregator;

            this.InitializeTrayIcon();
            this.InitializeShellWindow();
            this.InitializeCommands();
        }
Esempio n. 4
0
        public Shell(IUnityContainer container, IWindowsIntegrationService windowsIntegrationService, INotificationService notificationService,
                     IWin32InputService win32InputService, IPlaybackService playbackService, IMetadataService metadataService)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;

            this.ShowNowPlayingCommand = new DelegateCommand(() => this.ShellFrame.Navigate(this.container.Resolve <NowPlayingPage>()));
            ApplicationCommands.ShowNowPlayingCommand.RegisterCommand(this.ShowNowPlayingCommand);
            this.ShowFullPlayerCommmand = new DelegateCommand(() => this.ShellFrame.Navigate(this.container.Resolve <FullPlayerPage>()));
            ApplicationCommands.ShowFullPlayerCommand.RegisterCommand(this.ShowFullPlayerCommmand);

            this.InitializeTrayIcon();
            this.InitializeShellWindow();
        }
Esempio n. 5
0
        public ShellService(IRegionManager regionManager, IWindowsIntegrationService windowsIntegrationService, IEventAggregator eventAggregator,
                            string nowPlayingPage, string fullPlayerPage, string coverPlayerPage, string microplayerPage, string nanoPlayerPage)
        {
            this.regionManager             = regionManager;
            this.windowsIntegrationService = windowsIntegrationService;
            this.eventAggregator           = eventAggregator;
            this.nowPlayingPage            = nowPlayingPage;
            this.fullPlayerPage            = fullPlayerPage;
            this.coverPlayerPage           = coverPlayerPage;
            this.microplayerPage           = microplayerPage;
            this.nanoPlayerPage            = nanoPlayerPage;

            this.ShowNowPlayingCommand = new DelegateCommand(() =>
            {
                this.regionManager.RequestNavigate(RegionNames.PlayerTypeRegion, this.nowPlayingPage);
                SettingsClient.Set <bool>("FullPlayer", "IsNowPlayingSelected", true);
                this.eventAggregator.GetEvent <IsNowPlayingPageActiveChanged>().Publish(true);
            });

            ApplicationCommands.ShowNowPlayingCommand.RegisterCommand(this.ShowNowPlayingCommand);

            this.ShowFullPlayerCommmand = new DelegateCommand(() =>
            {
                this.regionManager.RequestNavigate(RegionNames.PlayerTypeRegion, this.fullPlayerPage);
                SettingsClient.Set <bool>("FullPlayer", "IsNowPlayingSelected", false);
                this.eventAggregator.GetEvent <IsNowPlayingPageActiveChanged>().Publish(false);
            });

            ApplicationCommands.ShowFullPlayerCommand.RegisterCommand(this.ShowFullPlayerCommmand);

            // Window state
            this.WindowState = SettingsClient.Get <bool>("FullPlayer", "IsMaximized") ? WindowState.Maximized : WindowState.Normal;

            // Player type
            this.ChangePlayerTypeCommand = new DelegateCommand <string>((miniPlayerType) =>
                                                                        this.SetPlayer(true, (MiniPlayerType)Convert.ToInt32(miniPlayerType)));
            ApplicationCommands.ChangePlayerTypeCommand.RegisterCommand(this.ChangePlayerTypeCommand);

            this.TogglePlayerCommand = new DelegateCommand(() =>
            {
                // If tablet mode is enabled, we should not be able to toggle the player.
                if (!this.windowsIntegrationService.IsTabletModeEnabled)
                {
                    this.TogglePlayer();
                }
            });

            ApplicationCommands.TogglePlayerCommand.RegisterCommand(this.TogglePlayerCommand);

            // Mini Player Playlist
            this.CoverPlayerPlaylistButtonCommand = new DelegateCommand <bool?>(isPlaylistButtonChecked =>
            {
                this.ToggleMiniPlayerPlaylist(MiniPlayerType.CoverPlayer, isPlaylistButtonChecked.Value);
            });

            ApplicationCommands.CoverPlayerPlaylistButtonCommand.RegisterCommand(this.CoverPlayerPlaylistButtonCommand);

            this.MicroPlayerPlaylistButtonCommand = new DelegateCommand <bool?>(isPlaylistButtonChecked =>
            {
                this.ToggleMiniPlayerPlaylist(MiniPlayerType.MicroPlayer, isPlaylistButtonChecked.Value);
            });

            ApplicationCommands.MicroPlayerPlaylistButtonCommand.RegisterCommand(this.MicroPlayerPlaylistButtonCommand);

            this.NanoPlayerPlaylistButtonCommand = new DelegateCommand <bool?>(isPlaylistButtonChecked =>
            {
                this.ToggleMiniPlayerPlaylist(MiniPlayerType.NanoPlayer, isPlaylistButtonChecked.Value);
            });

            ApplicationCommands.NanoPlayerPlaylistButtonCommand.RegisterCommand(this.NanoPlayerPlaylistButtonCommand);

            // Mini Player
            this.ToggleMiniPlayerPositionLockedCommand = new DelegateCommand(() =>
            {
                bool isMiniPlayerPositionLocked = SettingsClient.Get <bool>("Behaviour", "MiniPlayerPositionLocked");
                SettingsClient.Set <bool>("Behaviour", "MiniPlayerPositionLocked", !isMiniPlayerPositionLocked);
                this.SetWindowPositionLockedFromSettings();
            });

            ApplicationCommands.ToggleMiniPlayerPositionLockedCommand.RegisterCommand(this.ToggleMiniPlayerPositionLockedCommand);

            this.ToggleMiniPlayerAlwaysOnTopCommand = new DelegateCommand(() =>
            {
                bool topmost = SettingsClient.Get <bool>("Behaviour", "MiniPlayerOnTop");
                SettingsClient.Set <bool>("Behaviour", "MiniPlayerOnTop", !topmost);
                this.SetWindowTopmostFromSettings();
            });

            ApplicationCommands.ToggleMiniPlayerAlwaysOnTopCommand.RegisterCommand(this.ToggleMiniPlayerAlwaysOnTopCommand);
        }