private void OnSitemap(openHAB.REST aREST, openHAB.RESTResult aResult) { if(NavigationContext.QueryString.ContainsKey("page")) { var pageId = NavigationContext.QueryString["page"]; mPage = mSitemap.Pages[pageId]; } else { mPage = mSitemap.Page; } mPage.StartUpdateNotification((r, p, c) => { }); UpdateSitemap(); }
private void OnSitemaps(openHAB.REST aREST, openHAB.RESTResult aResult) { Dispatcher.BeginInvoke(() => { if (this.CheckAndHandleError(aResult)) { return; } if (aREST.Sitemaps.Count == 0) { MessageBox.Show("Cannot find any Sitemap on that server!", "Error", MessageBoxButton.OK); } else if (aREST.Sitemaps.Count == 1) { this.GotoPage("/Sitemap", "sitemap", aREST.Sitemaps.Keys.First(), "title", aREST.Sitemaps.Values.First().Name); } else { this.GotoPage("/SelectSitemap"); } }); }
private void OnREST(openHAB.REST aREST, openHAB.RESTResult aResult) { REST.GetSitemaps(OnSitemaps); }
protected bool CheckAndHandleError(openHAB.RESTResult aResult) { return(aResult == null || aResult.Error != null || aResult.Cancelled); }