コード例 #1
0
ファイル: UpdateCheck.cs プロジェクト: zeroyou/axcrypt-net
        private static Pair <Version, Uri> CheckWebForNewVersion(Uri webServiceUrl, Uri updateWebpageUrl)
        {
            Version newVersion = VersionUnknown;

            try
            {
                IWebCaller webCaller = OS.Current.CreateWebCaller();
                string     result    = webCaller.Go(webServiceUrl);

                VersionResponse versionResponse = JsonConvert.DeserializeObject <VersionResponse>(result);

                newVersion       = ParseVersion(versionResponse.Version);
                updateWebpageUrl = new Uri(versionResponse.WebReference);
                if (OS.Log.IsInfoEnabled)
                {
                    OS.Log.LogInfo("Update check reports most recent version {0} at web page {1}".InvariantFormat(newVersion, updateWebpageUrl));
                }
            }
            catch (Exception ex)
            {
                if (OS.Log.IsWarningEnabled)
                {
                    OS.Log.LogWarning("Failed call to check for new version with exception {0}.".InvariantFormat(ex));
                }
            }
            return(new Pair <Version, Uri>(newVersion, updateWebpageUrl));
        }
コード例 #2
0
ファイル: RssReader.cs プロジェクト: jdrussell/Plinkit
 public RssReader(string feedUrl,
                  IWebCaller webCaller,
                  IFileSystem fileSystem)
 {
     _url = feedUrl;
     _webCaller = webCaller;
     _fileSystem = fileSystem;
 }
コード例 #3
0
ファイル: RssReader.cs プロジェクト: jdrussell/Plinkit
 public RssReader(string feedUrl, 
                  IWebCaller webCaller,
                  DateTime date)
 {
     _date = date;
     _url = feedUrl;
     _webCaller = webCaller;
     _fileSystem = new FileSystem();
 }
コード例 #4
0
        /// <summary>
        /// Setup the lookup logic, and use the interface to do the web call.
        /// </summary>
        /// <param name="caller"></param>
        public WebCallViewModel(IWebCaller caller)
        {
            // Do a search when nothing new has been entered for 800 ms and it isn't
            // an empty string... and don't search for the same thing twice.

            var newSearchNeeded = this.WhenAny(p => p.InputText, x => x.Value)
                .Throttle(TimeSpan.FromMilliseconds(800), RxApp.TaskpoolScheduler)
                .DistinctUntilChanged()
                .Where(x => !string.IsNullOrWhiteSpace(x));

            _doWebCall = new ReactiveCommand();
            newSearchNeeded.InvokeCommand(_doWebCall);

            // Run the web call and save the results back to the UI when done.
            var webResults = _doWebCall.RegisterAsync(x => caller.GetResult(x as string));

            // The results are stuffed into the property, on the proper thread
            // (ToProperty takes care of that) when done. We never want the property to
            // be null, so we give it an initial value of "".
            webResults
                .ToProperty(this, x => x.ResultText, out _ResultTextOAPH, "");
        }
コード例 #5
0
        /// <summary>
        /// Setup the lookup logic, and use the interface to do the web call.
        /// </summary>
        /// <param name="caller"></param>
        public WebCallViewModel(IWebCaller caller)
        {
            // Do a search when nothing new has been entered for 800 ms and it isn't
            // an empty string... and don't search for the same thing twice.

            var newSearchNeeded = this.WhenAny(p => p.InputText, x => x.Value)
                                  .Throttle(TimeSpan.FromMilliseconds(800), RxApp.TaskpoolScheduler)
                                  .DistinctUntilChanged()
                                  .Where(x => !string.IsNullOrWhiteSpace(x));

            _doWebCall = new ReactiveCommand();
            newSearchNeeded.InvokeCommand(_doWebCall);

            // Run the web call and save the results back to the UI when done.
            var webResults = _doWebCall.RegisterAsync(x => caller.GetResult(x as string));

            // The results are stuffed into the property, on the proper thread
            // (ToProperty takes care of that) when done. We never want the property to
            // be null, so we give it an initial value of "".
            webResults
            .ToProperty(this, x => x.ResultText, out _ResultTextOAPH, "");
        }
コード例 #6
0
 public WebCallerProxy(IAccessRights accessRights, IWebCaller webCaller)
 {
     _accessRights = accessRights;
     _webCaller    = webCaller;
 }