예제 #1
0
 // Use this for initialization
 public ManagerProgress(IDownloadManager manager)
 {
     DownloadManager = manager;
     DownloadManager.OnDownloadAdded    += OnDownloadAdded;
     DownloadManager.OnDownloadingStart += OnDownloadingStart;
     DownloadManager.OnDownloadingEnd   += OnDownloadingEnd;
 }
예제 #2
0
 public CommandInterpreter(IContentComparer tester, IDatabase repository, IDownloadManager downloadManager, IDirectoryManager ioManager)
 {
     this.tester          = tester;
     this.repository      = repository;
     this.downloadManager = downloadManager;
     this.ioManager       = ioManager;
 }
예제 #3
0
        private void StartDownload()
        {
            new Thread(delegate()
            {
                bool retry = false;
                int count  = 0;

                do
                {
                    retry = false;
                    try {
                        NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                        EndpointAddress address     = new EndpointAddress("net.pipe://localhost/download");
                        using (ChannelFactory <IDownloadManager> factory = new ChannelFactory <IDownloadManager>(binding, address))
                        {
                            IDownloadManager dm = factory.CreateChannel();

                            if (dm != null)
                            {
                                string msg = dm.CopyFile("test file");
                                MessageBox.Show(msg);
                            }

                            factory.Close();
                        }
                    }
                    catch (CommunicationException)
                    {
                        retry = (count++ < 30);
                        Thread.Sleep(1000);
                    }
                } while(retry);
            }).Start();
        }
예제 #4
0
        public OnlineSoundViewModel(
            Sound s,
            IDownloadManager downloadManager,
            ISoundDataProvider soundDataProvider,
            ITelemetry telemetry,
            IPreviewService previewService,
            IIapService iapService,
            IDialogService dialogService)
        {
            Guard.IsNotNull(s, nameof(s));
            Guard.IsNotNull(downloadManager, nameof(downloadManager));
            Guard.IsNotNull(soundDataProvider, nameof(soundDataProvider));
            Guard.IsNotNull(telemetry, nameof(telemetry));
            Guard.IsNotNull(iapService, nameof(iapService));
            Guard.IsNotNull(previewService, nameof(previewService));
            Guard.IsNotNull(dialogService, nameof(dialogService));
            _sound             = s;
            _downloadManager   = downloadManager;
            _previewService    = previewService;
            _iapService        = iapService;
            _soundDataProvider = soundDataProvider;
            _telemetry         = telemetry;
            _dialogService     = dialogService;

            _downloadProgress = new Progress <double>();
            _downloadProgress.ProgressChanged    += OnProgressChanged;
            _soundDataProvider.LocalSoundDeleted += OnSoundDeleted;
            _iapService.ProductPurchased         += OnProductPurchased;

            DownloadCommand = new AsyncRelayCommand(DownloadAsync);
            LoadCommand     = new AsyncRelayCommand(LoadAsync);
            DeleteCommand   = new AsyncRelayCommand(DeleteSound);
            BuyCommand      = new AsyncRelayCommand(BuySoundAsync);
            PreviewCommand  = new RelayCommand(Preview);
        }
예제 #5
0
        public SoundViewModel(
            Sound s,
            IMixMediaPlayerService playerService,
            ISoundDataProvider soundDataProvider,
            ISoundMixService soundMixService,
            ITelemetry telemetry,
            IRenamer renamer,
            IDialogService dialogService,
            IIapService iapService,
            IDownloadManager downloadManager)
        {
            Guard.IsNotNull(s, nameof(s));
            Guard.IsNotNull(playerService, nameof(playerService));
            Guard.IsNotNull(soundDataProvider, nameof(soundDataProvider));
            Guard.IsNotNull(telemetry, nameof(telemetry));
            Guard.IsNotNull(soundMixService, nameof(soundMixService));
            Guard.IsNotNull(renamer, nameof(renamer));
            Guard.IsNotNull(dialogService, nameof(dialogService));
            Guard.IsNotNull(iapService, nameof(iapService));
            Guard.IsNotNull(downloadManager, nameof(downloadManager));

            _sound             = s;
            _soundMixService   = soundMixService;
            _playerService     = playerService;
            _soundDataProvider = soundDataProvider;
            _telemetry         = telemetry;
            _renamer           = renamer;
            _dialogService     = dialogService;
            _iapService        = iapService;
            _downloadManager   = downloadManager;

            DeleteCommand = new RelayCommand(DeleteSound);
            RenameCommand = new AsyncRelayCommand(RenameAsync);
            PlayCommand   = new AsyncRelayCommand(PlayAsync);
        }
예제 #6
0
 public CommandInterpreter(IContentComparer judge, IDatabase repository, IDownloadManager downloadManager, IDirectoryManager inputOutputManager)
 {
     this.judge              = judge;
     this.repository         = repository;
     this.downloadManager    = downloadManager;
     this.inputOutputManager = inputOutputManager;
 }
예제 #7
0
        private void Initialize()
        {
            if (_downloadManager == null)
            {
                _downloadManager = DownloadManager.Instance;
            }

            if (_elevator == null)
            {
                _elevator = Elevator.Instance;
                _elevator.ElevationRequested += OnElevationRequested;
            }
            if (_downloads == null)
            {
                var workers = ParallelDownload;
                Logger?.Trace($"Concurrent downloads: {workers}");
                _downloads        = new AsyncTaskRunner(workers);
                _downloads.Error += OnError;
            }
            if (_installs == null)
            {
                _installs        = new TaskRunner.TaskRunner();
                _installs.Error += OnError;
            }
        }
예제 #8
0
            /// <summary>
            /// 初始化资源更新器的新实例。
            /// </summary>
            /// <param name="resourceManager">资源管理器。</param>
            public ResourceUpdater(ResourceManager resourceManager)
            {
                m_ResourceManager                           = resourceManager;
                m_ApplyWaitingInfo                          = new List <ApplyInfo>();
                m_UpdateWaitingInfo                         = new List <UpdateInfo>();
                m_UpdateCandidateInfo                       = new List <UpdateInfo>();
                m_CachedHashBytes                           = new byte[CachedHashBytesLength];
                m_CachedBytes                               = new byte[CachedBytesLength];
                m_DownloadManager                           = null;
                m_CheckResourcesComplete                    = false;
                m_ApplyingResourcePackPath                  = null;
                m_ApplyingResourcePackStream                = null;
                m_UpdatingResourceGroup                     = null;
                m_GenerateReadWriteVersionListLength        = 0;
                m_CurrentGenerateReadWriteVersionListLength = 0;
                m_UpdateRetryCount                          = 3;
                m_UpdatingCount                             = 0;
                m_FailureFlag                               = false;
                m_ReadWriteVersionListFileName              = Utility.Path.GetRegularPath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName));
                m_ReadWriteVersionListBackupFileName        = Utility.Text.Format("{0}.{1}", m_ReadWriteVersionListFileName, BackupExtension);

                ResourceApplySuccess   = null;
                ResourceApplyFailure   = null;
                ResourceApplyComplete  = null;
                ResourceUpdateStart    = null;
                ResourceUpdateChanged  = null;
                ResourceUpdateSuccess  = null;
                ResourceUpdateFailure  = null;
                ResourceUpdateComplete = null;
            }
예제 #9
0
        /// <summary>
        /// Handles the <see cref="IDownloadManager.FileMoveFailed"/> event.
        /// </summary>
        /// <param name="sender">The <see cref="IDownloadManager"/> the event came from.</param>
        /// <param name="remoteFile">The remote file that was downloaded.</param>
        /// <param name="localFilePath">The path to the local file where the downloaded file is stored.</param>
        /// <param name="targetFilePath">The path where the file is supposed to be, but failed to be moved to.</param>
        void DownloadManager_FileMoveFailed(IDownloadManager sender, string remoteFile, string localFilePath,
                                            string targetFilePath)
        {
            Debug.Assert(sender == _dm, "Why did we get an event from a different IDownloadManager?");

            _fileReplacer.AddJob(localFilePath, targetFilePath);

            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Failed to move file `{0}` to `{1}` using `{2}`; adding job to IOfflineFileReplacer `{3}`.",
                               localFilePath, targetFilePath, sender, _fileReplacer);
            }

            try
            {
                if (FileMoveFailed != null)
                {
                    FileMoveFailed(this, remoteFile, localFilePath, targetFilePath);
                }
            }
            catch (NullReferenceException ex)
            {
                Debug.Fail(ex.ToString());
            }
        }
예제 #10
0
        public frmDescargas(ILogCreator logCreator, IDownloadManager downloadManager)
        {
            InitializeComponent();

            _logger          = logCreator.GetTipoLogger <frmDescargas>();
            _downloadManager = downloadManager;
        }
 public ScrapingOrchestrator(ILoggerFactory loggerFactory, IDownloadManager downloadManager, IScraperFactory scraperFactory, IPersisterFactory persisterFactory)
 {
     _logger           = loggerFactory.CreateLogger <ScrapingOrchestrator>();
     _downloadManager  = downloadManager;
     _scraperFactory   = scraperFactory;
     _persisterFactory = persisterFactory;
 }
예제 #12
0
        public async void DownloadAsync(IDownloadManager manager)
        {
            var fileName = this.GetFileName();

            if (File.Exists(FileUtils.GetTempFileName(fileName)))
            {
            }
            else
            {
                if (IsTransferring)
                {
                    return;
                }

                IsTransferring = true;

                var operation = manager.DownloadFileAsync(FileName, DCId, ToInputFileLocation(), Size);
                var download  = await operation.AsTask(Download());

                if (download != null)
                {
                    IsTransferring = false;
                }
            }
        }
예제 #13
0
        public SyncEngine(
            ICloudFileWriter cloudFileWriter,
            IDownloadManager downloadManager,
            IAccountManager accountManager,
            ISoundDataProvider soundDataProvider,
            IOnlineSoundDataProvider onlineSoundDataProvider,
            IAppSettings appSettings,
            ISoundMixService soundMixService,
            ITelemetry telemetry)
        {
            Guard.IsNotNull(cloudFileWriter, nameof(cloudFileWriter));
            Guard.IsNotNull(downloadManager, nameof(downloadManager));
            Guard.IsNotNull(accountManager, nameof(accountManager));
            Guard.IsNotNull(soundDataProvider, nameof(soundDataProvider));
            Guard.IsNotNull(onlineSoundDataProvider, nameof(onlineSoundDataProvider));
            Guard.IsNotNull(soundMixService, nameof(soundMixService));
            Guard.IsNotNull(appSettings, nameof(appSettings));
            Guard.IsNotNull(telemetry, nameof(telemetry));
            Guard.IsNotNullOrEmpty(appSettings.CloudSyncFileUrl, nameof(appSettings.CloudSyncFileUrl));

            _accountManager          = accountManager;
            _cloudFileWriter         = cloudFileWriter;
            _downloadManager         = downloadManager;
            _soundDataProvider       = soundDataProvider;
            _onlineSoundDataProvider = onlineSoundDataProvider;
            _soundMixService         = soundMixService;
            _telemetry        = telemetry;
            _cloudSyncFileUrl = appSettings.CloudSyncFileUrl;
            _dataChangeQueue  = new Queue <string>();

            _downloadManager.DownloadsCompleted  += OnDownloadsCompleted;
            _soundDataProvider.LocalSoundDeleted += OnLocalSoundDeleted;
            _soundDataProvider.LocalSoundAdded   += OnLocalSoundAdded;
            _accountManager.SignInUpdated        += OnSignInUpdated;
        }
예제 #14
0
        public SoundVmFactory(
            IDownloadManager downloadManager,
            IMixMediaPlayerService player,
            ITelemetry telemetry,
            IPreviewService previewService,
            ISoundDataProvider soundDataProvider,
            ISoundMixService soundMixService,
            IUserSettings userSettings,
            IIapService iapService,
            IRenamer renamer,
            IServiceProvider serviceProvider)
        {
            Guard.IsNotNull(downloadManager, nameof(downloadManager));
            Guard.IsNotNull(soundDataProvider, nameof(soundDataProvider));
            Guard.IsNotNull(player, nameof(player));
            Guard.IsNotNull(telemetry, nameof(telemetry));
            Guard.IsNotNull(iapService, nameof(iapService));
            Guard.IsNotNull(previewService, nameof(previewService));
            Guard.IsNotNull(userSettings, nameof(userSettings));
            Guard.IsNotNull(soundMixService, nameof(soundMixService));
            Guard.IsNotNull(renamer, nameof(renamer));
            Guard.IsNotNull(serviceProvider, nameof(serviceProvider));

            _userSettings      = userSettings;
            _downloadManager   = downloadManager;
            _previewService    = previewService;
            _soundMixService   = soundMixService;
            _iapService        = iapService;
            _soundDataProvider = soundDataProvider;
            _player            = player;
            _renamer           = renamer;
            _telemetry         = telemetry;
            _serviceProvider   = serviceProvider;
        }
예제 #15
0
        public void TestInitialize()
        {
            var delimator = ",";

            List <string> soursesUrls = new List <string>()
            {
                httpUrl
            };

            var logger   = new Mock <ILogger>();
            var iOHelper = new Mock <IIOHelper>();

            var parser = new Mock <IParser>();

            parser.Setup(x => x.Parse(httpUrl, delimator)).Returns(soursesUrls.AsQueryable());

            httpDownloadStrategyFactory = new Mock <IDownloadStrategyFactory>();

            httpDownloadStrategyFactory.Setup(x => x.Build(httpUrl)).Returns(new UriDownloadStrategy(logger.Object, iOHelper.Object))
            .Callback <IDownloadStrategy>(o => o.Download(httpUrl, localPath));

            var repoDownloadedFile = new Mock <IRepository <DomainModels.DownloadedFile> >();

            var repoProcessingStatus = new Mock <IRepository <DomainModels.ProcessingStatu> >();

            downloadManager = new DownloadManager(parser.Object, httpDownloadStrategyFactory.Object, repoDownloadedFile.Object, repoProcessingStatus.Object, logger.Object, iOHelper.Object);
        }
예제 #16
0
            /// <summary>
            /// 初始化资源更新器的新实例。
            /// </summary>
            /// <param name="resourceManager">资源管理器。</param>
            public ResourceUpdater(ResourceManager resourceManager)
            {
                m_ResourceManager               = resourceManager;
                m_ApplyWaitingInfo              = new List <ApplyInfo>();
                m_UpdateWaitingInfo             = new List <UpdateInfo>();
                m_UpdateWaitingInfoWhilePlaying = new HashSet <UpdateInfo>();
                m_UpdateCandidateInfo           = new Dictionary <ResourceName, UpdateInfo>();
                m_CachedFileSystemsForGenerateReadWriteVersionList = new SortedDictionary <string, List <int> >(StringComparer.Ordinal);
                m_CachedResourceNames                       = new List <ResourceName>();
                m_CachedHashBytes                           = new byte[CachedHashBytesLength];
                m_CachedBytes                               = new byte[CachedBytesLength];
                m_DownloadManager                           = null;
                m_CheckResourcesComplete                    = false;
                m_ApplyingResourcePackPath                  = null;
                m_ApplyingResourcePackStream                = null;
                m_UpdatingResourceGroup                     = null;
                m_GenerateReadWriteVersionListLength        = 0;
                m_CurrentGenerateReadWriteVersionListLength = 0;
                m_UpdateRetryCount                          = 3;
                m_FailureFlag                               = false;
                m_ReadWriteVersionListFileName              = Utility.Path.GetRegularPath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName));
                m_ReadWriteVersionListTempFileName          = Utility.Text.Format("{0}.{1}", m_ReadWriteVersionListFileName, TempExtension);

                ResourceApplySuccess      = null;
                ResourceApplyFailure      = null;
                ResourceApplyComplete     = null;
                ResourceUpdateStart       = null;
                ResourceUpdateChanged     = null;
                ResourceUpdateSuccess     = null;
                ResourceUpdateFailure     = null;
                ResourceUpdateComplete    = null;
                ResourceUpdateAllComplete = null;
            }
예제 #17
0
 public GetAllLinksViewModel(IDownloadManager downloadManager)
 {
     _downloadManager  = downloadManager;
     SettingsCommand   = new MvxCommand(SettingsAction);
     GoCommand         = new MvxCommand(GoAction);
     DownloadableItems = new List <DownloadItemPO>();
 }
 public PauseProcessingEventHandler(
     IMessageSender2 messageSender,
     IDownloadManager downloadManager)
 {
     _messageSender   = messageSender;
     _downloadManager = downloadManager;
 }
예제 #19
0
 public SeoDataImporter(IDownloadManager downloadManager,
                        IRepository <SerpRanking> serpRankingRepository,
                        ISeoDataImportMapper seoDataMapper)
 {
     this.downloadManager       = downloadManager;
     this.seoDataMapper         = seoDataMapper;
     this.serpRankingRepository = serpRankingRepository;
 }
예제 #20
0
 public DownloadCenter(IServiceProvider serviceProvider, IDownloadManager downloadTasks, IComicSaver saver)
 {
     this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     this.downloadManager = downloadTasks ?? throw new ArgumentNullException(nameof(downloadTasks));
     Saver         = saver ?? throw new ArgumentNullException(nameof(saver));
     semaphoreSlim = new SemaphoreSlim(1, 1);
     downloadMap   = new Dictionary <string, DownloadBox>();
 }
예제 #21
0
            public VersionListProcessor(ResourceManager resourceManager)
            {
                m_ResourceManager   = resourceManager;
                m_DownloadManager   = null;
                m_VersionListLength = 0;

                VersionListUpdateSuccess = null;
            }
예제 #22
0
 public Download(IDownloadManager manager, string url)
 {
     this.manager = manager;
     this.info    = new FileInfo()
     {
         url = url
     };
 }
예제 #23
0
 //конструктор
 public MainPresenter(IMainForm mainForm, IDownloadManager downloadManager)
 {
     _mainForm                = mainForm;
     _downloadManager         = downloadManager;
     _mainForm.DownloadClick += new EventHandler(StartDownloads);
     _mainForm.UpdateClick   += new EventHandler(Update);
     _mainForm.VersionClick  += new EventHandler(Version);
 }
예제 #24
0
 public ExecuterForm(IDownloadManager downloadManager, IDebugConsole debugConsole, string scriptFile)
     : this(downloadManager, debugConsole)
 {
     if (scriptFile != null)
     {
         LoadFile(scriptFile);
     }
 }
예제 #25
0
        public ScriptExecutor(TaskScheduler uiScheduler, IDownloadManager downloadManager, IDebugConsole debugConsole)
        {
            this.uiScheduler     = uiScheduler;
            this.downloadManager = downloadManager;
            this.debugConsole    = debugConsole;

            lua = new Lua();
            InitializeInterpreter();
        }
예제 #26
0
        public DownloadsViewModel(INavigationService navigationService, IDownloadManager downloadManager,
            IDataService dataService)
        {
            _navigationService = navigationService;
            _downloadManager = downloadManager;
            _dataService = dataService;

            CreateCommands();
        }
예제 #27
0
        public ExecuterForm(IDownloadManager downloadManager, IDebugConsole debugConsole)
        {
            this.downloadManager = downloadManager;
            this.debugConsole    = debugConsole;
            InitializeComponent();

            textEditor.SetHighlighting("SharpLua");
            textEditor.Document.DocumentChanged += Document_TextContentChanged;
        }
예제 #28
0
 public DisplayCommand(
     string input,
     string[] data,
     IContentComparer tester,
     IDatabase repository,
     IDownloadManager downloadManager,
     IDirectoryManager ioManager)
     : base(input, data, tester, repository, downloadManager, ioManager)
 {
 }
예제 #29
0
        private void beginDownload(DownloadInfoParam info)
        {
            OnlineDownloadsManager.Instance.AddRange(true, false, info);
            var download = OnlineDownloadsManager.Instance.GetDownloadManagerIgnorePath(info);

            _download = download;
            download.ExpandChanged += onDownloadExpandChanged;
            sendDownloadPath(_download as IOnlinePlayback);
            feedbackBase();
        }
예제 #30
0
 public Boot(IHostApplicationLifetime appLifetime, IUserSettings userSettings, IFileSystem fileSystem, IFileMerger fileMerger, IDownloadManager downloadManager,
             PlexRipperDbContext dbContext)
 {
     _appLifetime     = appLifetime;
     _userSettings    = userSettings;
     _fileSystem      = fileSystem;
     _fileMerger      = fileMerger;
     _downloadManager = downloadManager;
     _dbContext       = dbContext;
 }
예제 #31
0
 public CommandInterpreter(IContentComparer judge,
     IDatabase repository,
     IDownloadManager downloadManager,
     IDirectoryManager inputOutputManager)
 {
     this.judge = judge;
     this.repository = repository;
     this.downloadManager = downloadManager;
     this.inputOutputManager = inputOutputManager;
 }
예제 #32
0
 public Command(string input, string[] data, IContentComparer tester, IDatabase repository,
                IDownloadManager downloadManager, IDirectoryManager ioManager)
 {
     this.Input              = input;
     this.Data               = data;
     this.tester             = tester;
     this.repository         = repository;
     this.downloadManager    = downloadManager;
     this.inputOutputManager = ioManager;
 }
예제 #33
0
        public SettingsViewModel(ISettingsService settingsService, IStorageService storageService,
            IDownloadManager downloaderService, IDialogService dialogService, ILogService logService)
        {
            _settingsService = settingsService;
            _storageService = storageService;
            _downloadManager = downloaderService;
            _dialogService = dialogService;
            _logService = logService;

            CreateCommands();
        }
예제 #34
0
파일: AppManager.cs 프로젝트: weeble/ohos
 public AppManager(
     string aResourceUri,
     IEnumerable<DvDevice> aDevices,
     Func<DvDevice, IAppManagerActionHandler, string, IAppManagerProvider> aProviderConstructor,
     IAppShell aAppShell,
     IDownloadManager aDownloadManager)
 {
     iDownloadManager = aDownloadManager;
     iDownloadManager.DownloadCountChanged += OnDownloadCountChanged;
     iAppShell = aAppShell;
     iProviders = aDevices.Select(aDevice=>aProviderConstructor(aDevice, this, aResourceUri)).ToList();
     iAppShell.AppStatusChanged += OnAppStatusChanged;
     RefreshApps();
 }
        public MainViewModel(IDownloadManager downloadManager)
        {
            if (downloadManager == null)
                throw new ArgumentNullException(nameof(downloadManager));

            this.CurrentDownloadManager = downloadManager;
            this.HashAlgorithm = HashChoice.SHA1;

            this.BrowseSourceButtonCommand = new BrowseSourceCommand(this);
            this.BrowseDestinationButtonCommand = new BrowseDestinationCommand(this);
            this.ClipboardToSourceButtonCommand = new ClipboardToSourceCommand(this);
            this.ClipboardToDestinationButtonCommand = new ClipboardToDestinationCommand(this);
            this.ClipboardToHashButtonCommand = new ClipboardToHashCommand(this);
        }
예제 #36
0
 public PlayerViewModel(
     INavigationService navigationService,
     INetworkService networkService,
     IDownloadManager downloadManager,
     IDialogService dialogService,
     IVideoDownloaderService videoDownloaderService,
     ILogService logService)
 {
     this._navigationService = navigationService;
     this._networkService = networkService;
     this._downloadManager = downloadManager;
     this._dialogService = dialogService;
     this._videoDownloaderService = videoDownloaderService;
     _logService = logService;
 }
        public SessionDetailsViewModel(INavigationService navigationService, IDialogService dialogService,
            IDownloadManager downloadManager, IVideoDownloaderService videoDownloaderService, INetworkService networkService, ILogService logService)
        {
            _navigationService = navigationService;
            _dialogService = dialogService;
            _downloadManager = downloadManager;
            _videoDownloaderService = videoDownloaderService;
            _networkService = networkService;
            _logService = logService;

            CreateCommands();

            if (IsInDesignMode)
            {
                Session = DesignData.GetSession();
            }
        }
        public DashboardVM(
            IDependencyComposer composer,
            IRssRepository rssRepository,
            IDownloadManager downloadManager,
            IRibbonToggleButtonVM showSummaryToggleButtonVM)
        {
            _composer = composer;
            _rssRepository = rssRepository;
            _downloadManager = downloadManager;

            ShowSummaryRibbonToggleButton = showSummaryToggleButtonVM;
            ShowSummaryRibbonToggleButton.Command = ShowSummaryCommand;
            ShowSummaryRibbonToggleButton.IsChecked = true;
            ShowSummaryRibbonToggleButton.Label = "Summary";
            ShowSummaryRibbonToggleButton.LargeImageSource =
                @"..\Images\Dashboard\SpeechBubble.png";
            ShowSummaryRibbonToggleButton.ToolTipDescription = "Shows/hides the summary speech bubble.";
            ShowSummaryRibbonToggleButton.ToolTipTitle = "Show/hide summary";

            AdornerContent = new LoadingWaitVM();
        }
예제 #39
0
 public RequestHandler(IDownloadManager downloadList)
 {
     downloadManager = downloadList;
 }
 public SplashScreenViewModel(INavigationService navigationService, IDownloadManager downloadManager)
 {
     _navigationService = navigationService;
     _downloadManager = downloadManager;
 }
예제 #41
0
        /// <summary>
        /// Creates new instance of <see cref="EpisodesViewModel"/>
        /// </summary>
        /// <param name="logger">Instance of <see cref="ILogger"/></param>
        /// <param name="playlist">Instance of <see cref="IPlayList"/></param>
        /// <param name="loaderFactory">Instance of <see cref="ILoaderFactory"/></param>
        /// <param name="navigationService">Instance of <see cref="INavigationService"/></param>
        /// <param name="applicationSettingsHelper">Instance of <see cref="IApplicationSettingsHelper"/></param>
        /// <param name="downloadManager">Instance of <see cref="IDownloadManager"/></param>
        public EpisodesViewModel(
            ILogger logger,
            INavigationService navigationService,
            IApplicationSettingsHelper applicationSettingsHelper,
            IDownloadManager downloadManager,
            IEpisodeListManager episodeListManager)
        {
            this.logger = logger;
            this.navigationService = navigationService;
            this.applicationSettingsHelper = applicationSettingsHelper;
            this.downloadManager = downloadManager;
            this.episodeListManager = episodeListManager;

            RefreshCommand = new RelayCommand(loadEpisodeListFromServer);
            DownloadCommand = new RelayCommand(downloadEpisode);
            CancelDownloadCommand = new RelayCommand((Action<object>)cancelDownload);
            DeleteCommand = new RelayCommand((Action<object>)deleteEpisodeFromStorage);
            PlayCommand = new RelayCommand((Action<object>)playEpisode);
            AddToPlaylistCommand = new RelayCommand((Action<object>)addToPlaylistCommand);
            ClearPlaylistCommand = new RelayCommand((Action)clearPlaylistCommand);

            Application.Current.Resuming += onAppResuming;
            Application.Current.Suspending += (_, __) => unregisterUpdaterCompletionHandler();
            Application.Current.UnhandledException += (_, __) => unregisterUpdaterCompletionHandler();
            backgroundUpdaterTask = BackgroundTaskRegistration.AllTasks
                .Where(t => t.Value.Name == Constants.BackgroundUpdaterTaskName)
                .Select(t => t.Value)
                .FirstOrDefault();
            Initialization = initializeAsync();
            logger.LogMessage("EpisodesViewModel: Initialized.", LoggingLevel.Information);
        }
예제 #42
0
        public GameManager(IMenuManager menuManager, IVpdbClient vpdbClient, ISettingsManager 
			settingsManager, IDownloadManager downloadManager, IDatabaseManager databaseManager,
			IVersionManager versionManager, IPlatformManager platformManager, IMessageManager messageManager,
			IRealtimeManager realtimeManager, IVisualPinballManager visualPinballManager, IThreadManager threadManager, ILogger logger)
        {
            _menuManager = menuManager;
            _vpdbClient = vpdbClient;
            _settingsManager = settingsManager;
            _downloadManager = downloadManager;
            _databaseManager = databaseManager;
            _versionManager = versionManager;
            _platformManager = platformManager;
            _messageManager = messageManager;
            _realtimeManager = realtimeManager;
            _visualPinballManager = visualPinballManager;
            _threadManager = threadManager;
            _logger = logger;

            // setup game change listener once all games are fetched.
            _menuManager.Initialized.Subscribe(_ => SetupGameChanges());

            // update releases from VPDB on the first run, but delay it a bit so it
            // doesn't do all that shit at the same time!
            _settingsManager.ApiAuthenticated
                .Where(user => user != null)
                .Take(1)
                .Delay(TimeSpan.FromSeconds(2))
                .Subscribe(_ => UpdateReleaseData());

            // subscribe to downloaded releases
            _downloadManager.WhenReleaseDownloaded.Subscribe(OnReleaseDownloaded);

            // link games if new games are added
            Games.Changed.Subscribe(_ => CheckGameLinks());

            // setup handlers for table file changes
            _menuManager.TableFileChanged.Subscribe(OnTableFileChanged);
            _menuManager.TableFileRemoved.Subscribe(OnTableFileRemoved);

            // when game is linked or unlinked, update profile with channel info
            IDisposable gameLinked = null;
            Games.Changed.Subscribe(_ => {
                gameLinked?.Dispose();
                gameLinked = Games
                    .Select(g => g.Changed.Where(x => x.PropertyName == "ReleaseId"))
                    .Merge()
                    .Subscribe(__ => UpdateChannelConfig());
            });

            // setup pusher messages
            SetupRealtime();
        }
        public DownloadsVM(IDownloadManager downloadManager)
        {
            _downloadManager = downloadManager;
            _downloadManager.DownloadAdded += DownloadManagerDownloadAdded;
            _downloadManager.DownloadRemoved += DownloadManagerDownloadRemoved;
            _downloadManager.DownloadingStarted += DownloadManagerDownloadingStarted;
            _downloadManager.DownloadingStopped += DownloadManagerDownloadingStopped;

            _mainThreadDispatcher = Dispatcher.CurrentDispatcher;
            _mainThreadTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            AdornerContent = new LoadingWaitVM();
            _downloads = new ObservableCollection<IDownloadItem>();
            Downloads = (ListCollectionView)CollectionViewSource.GetDefaultView(_downloads);
            Downloads.SortDescriptions.Add(
                new SortDescription(DownloadItem.PROP_DOWNLOAD_STATE, ListSortDirection.Ascending));
        }
예제 #44
0
        /// <summary>
        /// Handles the <see cref="IDownloadManager.Finished"/> event.
        /// </summary>
        /// <param name="sender">The <see cref="IDownloadManager"/> the event came from.</param>
        void DownloadManager_Finished(IDownloadManager sender)
        {
            Debug.Assert(sender == _dm, "Why did we get an event from a different IDownloadManager?");

            if (log.IsInfoEnabled)
                log.InfoFormat("DownloadManager `{0}` returned Finished.", sender);

            CheckIfDownloadManagerComplete();
        }
예제 #45
0
        /// <summary>
        /// Handles the <see cref="IDownloadManager.FileMoveFailed"/> event.
        /// </summary>
        /// <param name="sender">The <see cref="IDownloadManager"/> the event came from.</param>
        /// <param name="remoteFile">The remote file that was downloaded.</param>
        /// <param name="localFilePath">The path to the local file where the downloaded file is stored.</param>
        /// <param name="targetFilePath">The path where the file is supposed to be, but failed to be moved to.</param>
        void DownloadManager_FileMoveFailed(IDownloadManager sender, string remoteFile, string localFilePath,
                                            string targetFilePath)
        {
            Debug.Assert(sender == _dm, "Why did we get an event from a different IDownloadManager?");

            _fileReplacer.AddJob(localFilePath, targetFilePath);

            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Failed to move file `{0}` to `{1}` using `{2}`; adding job to IOfflineFileReplacer `{3}`.",
                    localFilePath, targetFilePath, sender, _fileReplacer);
            }

            try
            {
                if (FileMoveFailed != null)
                    FileMoveFailed(this, remoteFile, localFilePath, targetFilePath);
            }
            catch (NullReferenceException ex)
            {
                Debug.Fail(ex.ToString());
            }
        }
예제 #46
0
        /// <summary>
        /// Handles the <see cref="IDownloadManager.DownloadFinished"/> event.
        /// </summary>
        /// <param name="sender">The <see cref="IDownloadManager"/> the event came from.</param>
        /// <param name="remoteFile">The remote file that was downloaded.</param>
        /// <param name="localFilePath">The path to the local file where the downloaded file is stored.</param>
        void DownloadManager_DownloadFinished(IDownloadManager sender, string remoteFile, string localFilePath)
        {
            Debug.Assert(sender == _dm, "Why did we get an event from a different IDownloadManager?");

            if (log.IsInfoEnabled)
                log.InfoFormat("Successfully downloaded remote file `{0}` to `{1}` using `{2}`.", remoteFile, localFilePath,
                    sender);

            try
            {
                if (FileDownloaded != null)
                    FileDownloaded(this, remoteFile, localFilePath);
            }
            catch (NullReferenceException ex)
            {
                Debug.Fail(ex.ToString());
            }
        }
예제 #47
0
        /// <summary>
        /// Handles the <see cref="IDownloadManager.DownloadFailed"/> event.
        /// </summary>
        /// <param name="sender">The <see cref="IDownloadManager"/> the event came from.</param>
        /// <param name="remoteFile">The remote file that was downloaded.</param>
        void DownloadManager_DownloadFailed(IDownloadManager sender, string remoteFile)
        {
            Debug.Assert(sender == _dm, "Why did we get an event from a different IDownloadManager?");

            if (log.IsWarnEnabled)
                log.WarnFormat("Failed to download remote file `{0}` using `{1}`.", remoteFile, sender);

            HasErrors = true;

            try
            {
                if (FileDownloadFailed != null)
                    FileDownloadFailed(this, remoteFile);
            }
            catch (NullReferenceException ex)
            {
                Debug.Fail(ex.ToString());
            }
        }