// Helper to raise any page event void RaisePageEvent(PageEventHandler handler, PageEventArgs e) { if (handler != null) { handler(this, e); } }
// Notify pageclose to Mowbly JS layer void OnPageModelClosed(PageModel sender, PageEventArgs e) { bool isDeviceBackpress = (bool)e.Properties[Constants.KEY_IS_DEVICE_BACKPRESS]; if (isDeviceBackpress) { InvokeJavascript("__mowbly__", "_onDeviceBackPressed"); } }
internal void Resume(bool isResumed, Dictionary <string, object> options = null, string data = Constants.STRING_EMPTY) { if (isResumed) { // Resumed from stack // Update data and options Data = (String.IsNullOrEmpty(data)) ? null : data; ShowProgress = (bool)options["showProgress"]; RetainInStack = (bool)options["retainPageInViewStack"]; } // Raise OnResumed event PageEventArgs e = new PageEventArgs(this, new Dictionary <string, object> { { KEY_HAS_PAGE_RESUMED, isResumed } }); RaisePageEvent(OnResumed, e); }
// Notify pageresume to Mowbly JS layer void OnPageModelResumed(PageModel sender, PageEventArgs e) { Dictionary <string, object> preferences = new Dictionary <string, object>(); string data = String.IsNullOrEmpty(Data) ? "{}" : Data; bool hasPageResumed = e.Properties.ContainsKey(KEY_HAS_PAGE_RESUMED) ? (bool)e.Properties[KEY_HAS_PAGE_RESUMED] : true; PageContext pageContext = new PageContext { Data = data, PageName = this.Name, Orientation = (int)((PhoneApplicationPage)Mowbly.ActivePhoneApplicationPage).Orientation, PageParent = this.Parent, WaitingForResult = !hasPageResumed, Preferences = preferences }; InvokeJavascript("__mowbly__", "_pageOpened", pageContext); }
// Notify pageload to Mowbly JS layer void OnPageModelLoaded(PageModel sender, PageEventArgs e) { InvokeJavascript("__mowbly__", "_onPageLoad", PageContext); }