Exemple #1
0
 public AddSubscriptionCommand(
     IMessageBoxDisplayService messageBoxDisplayService,
     INewSubscriptionService newSubscriptionService,
     IPodcastLoader podcastLoader,
     ISubscriptionManager subscriptionManager)
 {
     this.messageBoxDisplayService = messageBoxDisplayService;
     this.newSubscriptionService   = newSubscriptionService;
     this.podcastLoader            = podcastLoader;
     this.subscriptionManager      = subscriptionManager;
     Icon    = IconResources.add_icon_32;
     ToolTip = "Add Subscription";
 }
        public MainFormPresenter(IMainFormView mainFormView,
                                 ISubscriptionManager subscriptionManager,
                                 IPodcastLoader podcastLoader,
                                 IPodcastPlayer podcastPlayer,
                                 IMessageBoxDisplayService messageBoxDisplayService,
                                 ISettingsService settingsService,
                                 ISystemInformationService systemInformationService,
                                 INewSubscriptionService newSubscriptionService)
        {
            _subscriptionView = mainFormView.SubscriptionView;
            _episodeView      = mainFormView.EpisodeView;
            _podcastView      = mainFormView.PodcastView;

            _timer          = new Timer();
            _timer.Interval = 100;
            _timer.Tick    += TimerOnTick;
            _timer.Start();

            _mainFormView            = mainFormView;
            mainFormView.Load       += OnMainFormLoad;
            mainFormView.FormClosed += OnMainFormClosed;
            mainFormView.KeyUp      += MainFormViewOnKeyUp;

            _subscriptionView.AddPodcastClicked    += OnButtonAddClick;
            _subscriptionView.RemovePodcastClicked += OnButtonRemoveClick;
            _subscriptionView.SelectionChanged     += OnSelectedEpisodeChanged;

            _episodeView.PlayClicked += OnButtonPlayClick;
            _episodeView.StopClicked += OnButtonStopClick;

            _subscriptionManager = subscriptionManager;
            _podcastLoader       = podcastLoader;
            _podcastPlayer       = podcastPlayer;
            _podcasts            = _subscriptionManager.LoadPodcasts();

            _settingsService          = settingsService;
            _newSubscriptionService   = newSubscriptionService;
            _messageBoxDisplayService = messageBoxDisplayService;

            if (systemInformationService.IsHighContrastColorScheme)
            {
                mainFormView.BackColor = Color.White;
            }

            _episodeView.PositionChanged += (s, a) => _podcastPlayer.PositionInSeconds = _episodeView.PositionInSeconds;
        }
        public MainFormPresenter(IMainFormView mainFormView,
                                 IPodcastLoader podcastLoader,
                                 ISubscriptionManager subscriptionManager,
                                 IPodcastPlayer podcastPlayer,
                                 IMessageBoxDisplayService messageBoxDisplayService,
                                 ISettingsService settingsService,
                                 ISystemInformationService systemInformationService,
                                 INewSubscriptionService newSubscriptionService)
        {
            subscriptionView = mainFormView.SubscriptionView;
            episodeView      = mainFormView.EpisodeView;
            podcastView      = mainFormView.PodcastView;
            toolbarView      = mainFormView.ToolbarView;

            this.mainFormView           = mainFormView;
            mainFormView.Load          += MainFormViewOnLoad;
            mainFormView.FormClosed    += MainFormViewOnFormClosed;
            mainFormView.HelpRequested += OnHelpRequested;
            mainFormView.KeyUp         += MainFormViewOnKeyUp;

            toolbarView.PlayClicked          += OnButtonPlayClick;
            toolbarView.StopClicked          += OnButtonStopClick;
            toolbarView.PauseClicked         += OnButtonPauseClick;
            toolbarView.RemovePodcastClicked += OnButtonRemovePodcastClick;
            toolbarView.AddPodcastClicked    += OnButtonAddSubscriptionClick;
            toolbarView.FavouriteChanged     += OnButtonFavouriteCheckStateChanged;

            episodeView.Description            = "";
            episodeView.Title                  = "";
            episodeView.PublicationDate        = "";
            subscriptionView.SelectionChanged += OnSelectedEpisodeChanged;
            this.subscriptionManager           = subscriptionManager;
            this.podcastLoader                 = podcastLoader;
            this.podcastPlayer                 = podcastPlayer;
            this.messageBoxDisplayService      = messageBoxDisplayService;
            this.settingsService               = settingsService;
            this.newSubscriptionService        = newSubscriptionService;
            podcasts = subscriptionManager.LoadPodcasts();

            if (!systemInformationService.IsHighContrastColourScheme)
            {
                mainFormView.BackColor = Color.White;
            }
        }