void AttachHardwareButtonHandlers() { PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { PhoneApplicationPage page = frame.Content as PhoneApplicationPage; if (page != null) { page.BackKeyPress += new EventHandler<CancelEventArgs>(page_BackKeyPress); this.orientationHelper = new OrientationHelper(this.CordovaBrowser, page); } } }
/* * browserDecorators are a collection of plugin-like classes (IBrowserDecorator) that add some bit of functionality to the browser. * These are somewhat different than plugins in that they are usually not async and patch a browser feature that we would * already expect to have. Essentially these are browser polyfills that are patched from the outside in. * */ void CreateDecorators() { XHRHelper xhrProxy = new XHRHelper(); xhrProxy.Browser = CordovaBrowser; browserDecorators.Add("XHRLOCAL", xhrProxy); OrientationHelper orientHelper = new OrientationHelper(); orientHelper.Browser = CordovaBrowser; browserDecorators.Add("Orientation", orientHelper); DOMStorageHelper storageHelper = new DOMStorageHelper(); storageHelper.Browser = CordovaBrowser; browserDecorators.Add("DOMStorage", storageHelper); ConsoleHelper console = new ConsoleHelper(); console.Browser = CordovaBrowser; browserDecorators.Add("ConsoleLog", console); }