//handle events that change state while the window is floating private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { // Get Metrics var displayInfo = e.DisplayInfo; // Orientation (Landscape, Portrait, Square, Unknown) var orientation = displayInfo.Orientation; // Rotation var rotation = displayInfo.Rotation; // Width (in pixels) var width = displayInfo.Width; // Height (in pixels) var height = displayInfo.Height; // Screen density var density = displayInfo.Density; Info = $"Metrics: {displayInfo}\n" + $"Orientation: {orientation}\n" + $"Rotation: {rotation}\n" + $"Resolution {width} * {height}\n" + $"Density: {density}"; }
void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { // Process changes var displayInfo = e.DisplayInfo; Console.WriteLine($"DisplayInfo: {displayInfo}"); }
private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (e.DisplayInfo.Orientation == DisplayOrientation.Landscape) { DeviceDisplay.KeepScreenOn = true; ViewPhotosCommand.Execute(null); } }
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (orientation != e.DisplayInfo.Orientation) { orientation = e.DisplayInfo.Orientation; SetSize(); } }
private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { // Has the device been rotated ? if (!Equals(DeviceOrientantion, e.DisplayInfo.Orientation)) { DeviceOrientationChange(e.DisplayInfo.Orientation); } }
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (this.DisplayOrientation != e.DisplayInfo.Orientation) { this.DisplayOrientation = e.DisplayInfo.Orientation; this.OnOrientationChanged(this.DisplayOrientation); } }
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (DisplayOrientation == e.DisplayInfo.Orientation) { return; } DisplayOrientation = e.DisplayInfo.Orientation; OnOrientationChanged(DisplayOrientation); }
void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { MainThread.BeginInvokeOnMainThread(async() => { if (e.DisplayInfo.Orientation == DisplayOrientation.Portrait) { await Navigation.PopAsync(); } }); }
void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { MainThread.BeginInvokeOnMainThread(async() => { if (e.DisplayInfo.Orientation == DisplayOrientation.Landscape) { await Navigation.PushAsync(new OnlyVideoPage(_viewModel.MediaPlayer)); } }); }
private void OrientationChanged(object sender, DisplayInfoChangedEventArgs e) { DisplayOrientation orientation = e.DisplayInfo.Orientation; switch (orientation) { case DisplayOrientation.Portrait: videoPlayer.Aspect = Aspect.AspectFit; break; case DisplayOrientation.Landscape: videoPlayer.Aspect = Aspect.AspectFill; break; } }
private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (DeviceDisplay.MainDisplayInfo.Orientation.ToString() == "Portait") { ChangeLabelText(); } else { ChangedLabelText(); } }
void OnMainDisplayInfoChanged(object?sender, DisplayInfoChangedEventArgs e) { DatePickerDialog?currentDialog = _dialog; if (currentDialog != null && currentDialog.IsShowing) { currentDialog.Dismiss(); ShowPickerDialog(currentDialog.DatePicker.Year, currentDialog.DatePicker.Month, currentDialog.DatePicker.DayOfMonth); } }
void DeviceInfoPropertyChanged(object sender, DisplayInfoChangedEventArgs e) { DatePickerDialog currentDialog = _dialog; if (currentDialog != null && currentDialog.IsShowing) { currentDialog.Dismiss(); currentDialog.CancelEvent -= OnCancelButtonClicked; ShowPickerDialog(currentDialog.DatePicker.Year, currentDialog.DatePicker.Month, currentDialog.DatePicker.DayOfMonth); } }
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (e.DisplayInfo.Orientation != this._lastDeviceDisplay.Orientation) { if (this.datePicker.NullableDate.HasValue && this.ShouldAnimateUnderline) { this.underline.WidthRequest = -1; this.underline.HorizontalOptions = LayoutOptions.FillAndExpand; } this._lastDeviceDisplay = e.DisplayInfo; } }
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (e.DisplayInfo.Orientation == DisplayOrientation.Portrait) { stackLayoutLandscape.IsVisible = false; stackLayoutPortrait.IsVisible = true; } else { stackLayoutLandscape.IsVisible = true; stackLayoutPortrait.IsVisible = false; } }
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (e.DisplayInfo.Orientation == DisplayOrientation.Landscape) { LandscapeGrid.IsVisible = true; PortraitGrid.IsVisible = false; } else { LandscapeGrid.IsVisible = false; PortraitGrid.IsVisible = true; } }
private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { if (e.DisplayInfo.Orientation == DisplayOrientation.Landscape) { MainGridVertical.IsVisible = false; MainGridHorizontal.IsVisible = true; } else if (e.DisplayInfo.Orientation == DisplayOrientation.Portrait) { MainGridVertical.IsVisible = true; MainGridHorizontal.IsVisible = false; } }
private void OnScreenMetricsChanged(object sender, DisplayInfoChangedEventArgs e) { DisplayInfo metrics = e.DisplayInfo; if (!Orientation.Equals(DisplayOrientation.Unknown) && Orientation != metrics.Orientation) { Orientation = metrics.Orientation; OnOrientationChanged.Invoke(this, new PageOrientationEventArgs((Orientation == DisplayOrientation.Portrait) ? PageOrientation.Vertical : PageOrientation.Horizontal, this)); } else { Orientation = metrics.Orientation; } }
// TODO This code currently runs one rotation behind and does not set the window size properly on UWP. //See CardSizxes for the current hack fix. private static void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { SharedSharp.Common.SharedSharpGeneral.ScreenSizeInit(); // // Process changes // EventAggregator ea = this.Container.Resolve<EventAggregator>(); // //if (!(ea is null)) // { //var t = DeviceDisplay.MainDisplayInfo; // // // ea.GetEvent<OrientationChanged>().Publish(e.DisplayInfo.Orientation); because seems // // to be one rotation behind on emulator. Try the old school way until fixed if // (e.DisplayInfo.Width > e.DisplayInfo.Height) { // DataStore.Instance.AD.CurrentOrientation = DisplayOrientation.Landscape; } else { // // DataStore.Instance.AD.CurrentOrientation = DisplayOrientation.Portrait; } // // // Card width reset CardSizes.Current.ReCalculateCardWidths(); //// } }
private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { // Process changes EventAggregator ea = this.Container.Resolve <EventAggregator>(); if (!(ea is null)) { // TODO Is this needed? ea.GetEvent <OrientationChanged>().Publish(e.DisplayInfo.Orientation); // TODO fu because seems to be one rotation behind on emulator DataStore.AD.CurrentOrientation = e.DisplayInfo.Orientation; // Card width reset CardSizes.Current.ReCalculateCardWidths(); } }
private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { var displayInfo = e.DisplayInfo; // Process changes //Debug.WriteLine($"App.xaml.cs.OnMainDisplayInfoChanged() { displayInfo.Orientation }"); if (_orientation != displayInfo.Orientation) { //orientation was changed - send event update _orientation = DeviceDisplay.MainDisplayInfo.Orientation; if (AppOrientationChanged != null) { AppOrientationChanged(_orientation); } } }
/// <summary> /// Compensate for device rotation in the current bearing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HandleRotationChange(object sender, DisplayInfoChangedEventArgs e) { var lat = Preferences.Get("LastPositionLatitude", 0.0); var lon = Preferences.Get("LastPositionLongitude", 0.0); var accuracy = Preferences.Get("LastPositionAccuracy", 0.0); var heading = Preferences.Get("LastPositionHeading", 0.0); var speed = Preferences.Get("LastPositionSpeed", 0.0); Dictionary <string, double> dic = new Dictionary <string, double>(); dic.Add("latitude", lat); dic.Add("longitude", lon); Console.WriteLine(lat + ", " + lon + " +/- " + accuracy); dic.Add("accuracy", accuracy); var deviceRotation = 0; switch (DeviceDisplay.MainDisplayInfo.Rotation.ToString()) { case "Rotation0": deviceRotation = 0; break; case "Rotation90": deviceRotation = 90; break; case "Rotation180": deviceRotation = 180; break; case "Rotation270": deviceRotation = 270; break; default: break; } var actualHeading = Math.Abs((heading + deviceRotation) % 360); dic.Add("heading", actualHeading); dic.Add("speed", speed); MessagingCenter.Send <GPS, Dictionary <string, double> >(this.gps, "GPSPositionUpdate", dic); }
void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { var displayInfo = e.DisplayInfo.Orientation; if (displayInfo == DisplayOrientation.Portrait) { foreach (var views in visualElement) { VisualStateManager.GoToState(views, "Portrait"); } } else { foreach (var views in visualElement) { VisualStateManager.GoToState(views, "Landscape"); } } }
async void DeviceInfoPropertyChanged(object sender, DisplayInfoChangedEventArgs e) { if (!FlyoutPageController.ShouldShowSplitMode && Presented) { FlyoutPageController.CanChangeIsPresented = true; //hack : when the orientation changes and we try to close the Flyout on Android //sometimes Android picks the width of the screen previous to the rotation //this leaves a little of the flyout visible, the hack is to delay for 100ms closing the drawer await Task.Delay(100); //Renderer may have been disposed during the delay if (_disposed) { return; } CloseDrawer(_flyoutLayout); } UpdateSplitViewLayout(); }
void DeviceInfoPropertyChanged(object sender, DisplayInfoChangedEventArgs e) { ResetToolbar(); }
private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { OnPropertyChanged(nameof(MainDisplayInfo)); }
private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { var displayInfo = e.DisplayInfo; }
void OnMainDisplayInfoChanged(object?sender, DisplayInfoChangedEventArgs e) { Handler?.UpdateValue(nameof(FlyoutBehavior)); }
private async void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e) { await this.DismissAsync(); }
void OnRotate(Object sender, DisplayInfoChangedEventArgs e) { //Booru.ColCount = Booru.ScreenWidth / Booru.preview_height; //MainPage.ColCount = ScreenWidth / (preview_size); //change column count ?? }