public MockMagpie(string validUrl, IDebuggingInfoLogger infoLogger = null, IAnalyticsLogger analyticsLogger = null) : base(new AppInfo(validUrl), infoLogger, analyticsLogger) { _remoteContentDownloader = Substitute.For <IRemoteContentDownloader>(); _remoteContentDownloader.DownloadStringContent(validUrl, Arg.Any <IDebuggingInfoLogger>()).Returns(Task.FromResult(VALID_JSON)); RemoteContentDownloader = _remoteContentDownloader; }
internal DownloadWindowViewModel(AppInfo appInfo, IDebuggingInfoLogger logger, IRemoteContentDownloader contentDownloader) { AppIconPath = appInfo.AppIconPath; _logger = logger; _contentDownloader = contentDownloader; }
public MagpieService(AppInfo appInfo, IDebuggingInfoLogger debuggingInfoLogger = null) { _appInfo = appInfo; _logger = debuggingInfoLogger ?? new DebuggingWindowViewModel(); RemoteContentDownloader = new DefaultRemoteContentDownloader(); UpdateDecider = new UpdateDecider(_logger); }
public MockMagpieUpdater(string validUrl, IDebuggingInfoLogger infoLogger = null) : base(new AppInfo(validUrl), infoLogger) { var validJson = VALID_JSON.Replace("'", "\""); _remoteContentDownloader = Substitute.For<IRemoteContentDownloader>(); _remoteContentDownloader.DownloadStringContent(validUrl).Returns(Task.FromResult(validJson)); base.RemoteContentDownloader = _remoteContentDownloader; }
public MainWindowViewModel(AppInfo appInfo, IDebuggingInfoLogger logger, IRemoteContentDownloader contentDownloader, IAnalyticsLogger analyticsLogger) { AppIconPath = appInfo.AppIconPath; _logger = logger; _contentDownloader = contentDownloader; _analyticsLogger = analyticsLogger; }
public MockMagpieUpdater(string validUrl, IDebuggingInfoLogger infoLogger = null) : base(new AppInfo(validUrl), infoLogger) { var validJson = VALID_JSON.Replace("'", "\""); _remoteContentDownloader = Substitute.For <IRemoteContentDownloader>(); _remoteContentDownloader.DownloadStringContent(validUrl).Returns(Task.FromResult(validJson)); base.RemoteContentDownloader = _remoteContentDownloader; }
public MagpieUpdater(AppInfo appInfo, IDebuggingInfoLogger debuggingInfoLogger = null, IAnalyticsLogger analyticsLogger = null) { _appInfo = appInfo; _logger = debuggingInfoLogger ?? new DebuggingWindowViewModel(); _analyticsLogger = analyticsLogger ?? new AnalyticsLogger(); RemoteContentDownloader = new DefaultRemoteContentDownloader(); UpdateDecider = new UpdateDecider(_logger); }
public MockMainWindowViewModel(AppInfo appInfo, IDebuggingInfoLogger logger, IRemoteContentDownloader contentDownloader, IAnalyticsLogger analyticsLogger) : base(appInfo, logger, contentDownloader, analyticsLogger) { DownloadNowCommand = new DelegateCommand(message => analyticsLogger.LogDownloadNow()); SkipThisVersionCommand = new DelegateCommand(message => analyticsLogger.LogUserSkipsUpdate(new Channel())); RemindMeLaterCommand = new DelegateCommand(message => analyticsLogger.LogRemindMeLater()); }
public async Task <string> DownloadStringContent(string url, IDebuggingInfoLogger logger = null) { try { using (var client = new WebClient()) { return(await client.DownloadStringTaskAsync(new Uri(url)).ConfigureAwait(false)); } } catch (Exception e) { if (logger != null) { logger.Log(e.Message); } return(string.Empty); } }
public async Task <string> DownloadFile(string sourceUrl, string destinationPath, Action <int> onProgressChanged, IDebuggingInfoLogger logger = null) { try { using (var client = new WebClient()) { client.DownloadProgressChanged += (s, e) => onProgressChanged(e.ProgressPercentage); var uri = new Uri(sourceUrl); await client.DownloadFileTaskAsync(uri, destinationPath).ConfigureAwait(false); return(destinationPath); } } catch (Exception e) { if (logger != null) { logger.Log(e.Message); } return(string.Empty); } }
public ExampleMagpie(AppInfo appInfo, IDebuggingInfoLogger debuggingInfoLogger = null, IAnalyticsLogger analyticsLogger = null) : base(appInfo, debuggingInfoLogger, analyticsLogger) { }
public UpdateDecider(IDebuggingInfoLogger debuggingInfoLogger) { _logger = debuggingInfoLogger; _registryIO = new RegistryIO(); }
public BestChannelFinder(IDebuggingInfoLogger logger) { _logger = logger; }
internal UpdateDecider(IDebuggingInfoLogger debuggingInfoLogger, RegistryIO registryIO) { _logger = debuggingInfoLogger; _registryIO = registryIO ?? new RegistryIO(); }
public UpdateDecider(IDebuggingInfoLogger debuggingInfoLogger) : this(debuggingInfoLogger, new RegistryIO()) { }
public MockMainWindowViewModel(AppInfo appInfo, IDebuggingInfoLogger logger, IRemoteContentDownloader contentDownloader, IAnalyticsLogger analyticsLogger) : base(appInfo, logger, contentDownloader, analyticsLogger) { DownloadNowCommand = new DelegateCommand(message=> analyticsLogger.LogDownloadNow()); SkipThisVersionCommand = new DelegateCommand(message => analyticsLogger.LogSkipThisVersion()); RemindMeLaterCommand = new DelegateCommand(message => analyticsLogger.LogRemindMeLater()); }