private void _timer_Tick(object sender, EventArgs e) { if (PreviewBehavior._isShowingPreview) { if ((DateTime.Now - this._lastTouchFrameDate).TotalMilliseconds < 750.0) { return; } this.EnsureHidePreview(); } else { if (string.IsNullOrEmpty(this.PreviewUri)) { return; } PreviewBehavior._isShowingPreview = true; // ISSUE: method pointer Touch.FrameReported += (new TouchFrameEventHandler(this.Touch_FrameReported)); PageBase currentPage = FramePageUtils.CurrentPage; if (currentPage != null) { this._savedSupportedOrientation = currentPage.SupportedOrientations; FramePageUtils.CurrentPage.SupportedOrientations = (currentPage.Orientation == PageOrientation.PortraitUp || currentPage.Orientation == PageOrientation.Portrait ? (SupportedPageOrientation)1 : (SupportedPageOrientation)2); } string previewUri = this.PreviewUri; Image associatedObject = this.AssociatedObject as Image; BitmapImage originalImage = (associatedObject != null ? associatedObject.Source : null) as BitmapImage; int topOffset = this.TopOffset; this.ShowPreview(previewUri, originalImage, topOffset); this.SetHoveredElement(this.AssociatedObject); } }
private void DetailTextBox_GotFocus(object sender, RoutedEventArgs e) { BuildDetailTextAppBar(); orientation = SupportedOrientations; SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape; }
private void TitleTextBox_GotFocus(object sender, RoutedEventArgs e) { BuildTitleTextAppBar(); StopNoTextAnimation(); orientation = SupportedOrientations; SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape; }
private PluginResult setSupportedOrientations(SupportedPageOrientation orientation) { try { Deployment.Current.Dispatcher.BeginInvoke(() => { PhoneApplicationFrame frame; PhoneApplicationPage page; if (TryCast(Application.Current.RootVisual, out frame) && TryCast(frame.Content, out page)) { page.SupportedOrientations = orientation; } }); return(new PluginResult(PluginResult.Status.OK, true)); } catch (System.Exception) { // TVB - Return error return(new PluginResult(PluginResult.Status.ERROR, "PhoneSettings.allowRotation error")); } }
private void LoadPreferences() { StreamResourceInfo streamInfo = Application.GetResourceStream(new Uri("config.xml", UriKind.Relative)); if(streamInfo != null) { StreamReader sr = new StreamReader(streamInfo.Stream); //This will Read Keys Collection for the xml file XDocument document = XDocument.Parse(sr.ReadToEnd()); var preferences = from results in document.Descendants("preference") select new { name = (string)results.Attribute("name"), value = (string)results.Attribute("value") }; foreach(var pref in preferences) { if(pref.name == "orientation") { if(pref.value == "portrait") { supportedPageOrientation = SupportedPageOrientation.Portrait; } if(pref.value == "landscape") { supportedPageOrientation = SupportedPageOrientation.Landscape; } } if(pref.name == "showsplashscreen") { if(pref.value == "false") { showSplashScreen = false; } } } } }
public void Show(SupportedPageOrientation supportedOrientations = SupportedPageOrientation.Portrait) { // check for not to show this popup twice if (IsOpen) return; // initialize this instance of popup // adding it to visual tree if (!InitializePopup()) return; Page.OrientationChanged += Page_OrientationChanged; // change state to opened IsOpen = true; // add this popup to the top of the stack _popupStack.Push(this); // we must count the chance to navigate from this page Page.NavigationService.Navigated += new NavigatedEventHandler(OnNavigated); // save oridinal appBar to restore it after the popup is closed _originalAppBar = Page.ApplicationBar; // show popup's appBar for a time this popup is the top one Page.ApplicationBar = AppBar; if (HideTray) { _originalTrayVisibility = SystemTray.IsVisible; SystemTray.IsVisible = false; } // popup's on portrait orientation _originalSupportedPageOrientation = Page.SupportedOrientations; if (Page.SupportedOrientations != supportedOrientations) Page.SupportedOrientations = supportedOrientations; SetBehaviour(); }
public WebBrowserArgs(string webBrowserUrl, SupportedPageOrientation? supportedOrientation = null) { this.WebBrowserUrl = webBrowserUrl; this.SupportedOrientation = supportedOrientation; }
public void NavigatedTo(object data) { var url = string.Empty; if (data is string) { url = data.ToString(); } else if (data is WebBrowserArgs) { var args = (WebBrowserArgs)data; url = args.WebBrowserUrl; if (null != args.SupportedOrientation) this.SupportedOrientation = args.SupportedOrientation.Value; } var safeUrl = Uri.EscapeUriString(url); // clean up this twitter workaround hack later. without #hashtag gets removed if (safeUrl.StartsWith("http://twitter.com/share")) safeUrl = safeUrl.Replace("#", "%23"); this.InitialSource = new Uri(safeUrl, UriKind.Absolute); }