Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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");
                }
            });
        }
Exemplo n.º 3
0
 private void OnREST(openHAB.REST aREST, openHAB.RESTResult aResult)
 {
     REST.GetSitemaps(OnSitemaps);
 }
Exemplo n.º 4
0
 protected bool CheckAndHandleError(openHAB.RESTResult aResult)
 {
     return(aResult == null || aResult.Error != null || aResult.Cancelled);
 }