Пример #1
0
 // Code to execute when the application is closing (eg, user hit Back)
 // This code will not execute when the application is deactivated
 private void Application_Closing(object sender, ClosingEventArgs e)
 {
     if (REST != null)
     {
         REST.Dispose();
     }
     REST = null;
 }
Пример #2
0
        // Code to execute when the application is deactivated (sent to background)
        // This code will not execute when the application is closing
        private void Application_Deactivated(object sender, DeactivatedEventArgs e)
        {
            PhoneApplicationService.Current.State["REST"] = REST.GetDataStore();

            if (REST != null)
            {
                REST.Dispose();
            }
            REST = null;
        }
Пример #3
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();
        }
Пример #4
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");
                }
            });
        }
Пример #5
0
 private void OnREST(openHAB.REST aREST, openHAB.RESTResult aResult)
 {
     REST.GetSitemaps(OnSitemaps);
 }
Пример #6
0
 // Code to execute when the application is activated (brought to foreground)
 // This code will not execute when the application is first launched
 private void Application_Activated(object sender, ActivatedEventArgs e)
 {
     REST = openHAB.REST.FromDataStore(PhoneApplicationService.Current.State["REST"] as byte[]);
 }