public void UpdateContent(HypermediaContent content) { var xamlContent = content; //_View.LoadXaml(xamlContent.XamlDoc); throw new NotImplementedException(); }
public override void HandleResponseComplete(HypermediaContent currentContent) { var link = new Link() { Target = _RedirectUrl }; if (_StatusCode == HttpStatusCode.RedirectMethod) { link.Method = _TargetLink.Method; } _RestAgent.NavigateTo(link); }
public override void HandleResponseComplete(HypermediaContent currentContent) { _model.CurrentContent = currentContent; _model.FireOnContentChanged(); }
public void UpdateContent(HypermediaContent content) { var mazeContent = (XmlDocument)content.Value; _View.SetText(XDocument.Load(new XmlNodeReader(mazeContent)).ToString()); }
public void UpdateContent(HypermediaContent content) { var textContent = (string)content.Value; _View.SetText(textContent); }
private void HandleResponse(HttpResponseMessage response, Link link) { // Start Loading content Task<HypermediaContent> loadContentTask = null; var content = response.Content; if (content != null) { loadContentTask = new TaskFactory<HypermediaContent>() .StartNew(() => new HypermediaContent(_SemanticsRegistry, response.Content, response.Headers)); } // Determine actions that are mapped to this response var actions = from ra in _ResponseActions where ra.ShouldRespond(response) select ra; foreach (var responseHandler in actions) { responseHandler.HandleResponseStart(link, response); } // Update RESTAgent State _LinkHistory.AddToHistory(link); _CurrentStatusCode = response.StatusCode; if (loadContentTask != null) { loadContentTask.Wait(); if (loadContentTask.IsFaulted) throw new InvalidOperationException("Could not load content." + loadContentTask.Exception.Message); _CurrentContent = loadContentTask.Result; } else { _CurrentContent = null; } // Respond to content foreach (var responseHandler in actions) { responseHandler.HandleResponseComplete(_CurrentContent); } }
public void CreateHypermediaContentInTask() { //Arrange var stringcontent = new StringContent("Hi you"); //Act var task = new TaskFactory<Stream>() .StartNew(() => { var content = new HypermediaContent(null, stringcontent, null); return (Stream) content.Value; }); var result = task.Result; //Assert Assert.AreEqual("Hi you", new StreamReader(result).ReadToEnd()); }
public void CreateHypermediaContent() { //Arrange var stringcontent = new StringContent("Hi you"); //Act var content = new HypermediaContent(null, stringcontent,null); //Assert Assert.IsNotNull(content); Assert.AreEqual("Hi you", new StreamReader((Stream)content.Value).ReadToEnd()); }
public abstract void HandleResponseComplete(HypermediaContent currentContent);
public void UpdateContent(HypermediaContent content) { // Ignore the content because the stupid webbrowser controll cannot accept content and a context url // Hopefully not a perf problem because the html page may be cached so a round trip will not occur. }