Ejemplo n.º 1
0
        //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}";
        }
Ejemplo n.º 2
0
        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();
     }
 }
Ejemplo n.º 5
0
 private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     // Has the device been rotated ?
     if (!Equals(DeviceOrientantion, e.DisplayInfo.Orientation))
     {
         DeviceOrientationChange(e.DisplayInfo.Orientation);
     }
 }
Ejemplo n.º 6
0
 private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     if (this.DisplayOrientation != e.DisplayInfo.Orientation)
     {
         this.DisplayOrientation = e.DisplayInfo.Orientation;
         this.OnOrientationChanged(this.DisplayOrientation);
     }
 }
Ejemplo n.º 7
0
        private void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
        {
            if (DisplayOrientation == e.DisplayInfo.Orientation)
            {
                return;
            }

            DisplayOrientation = e.DisplayInfo.Orientation;
            OnOrientationChanged(DisplayOrientation);
        }
Ejemplo n.º 8
0
 void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     MainThread.BeginInvokeOnMainThread(async() =>
     {
         if (e.DisplayInfo.Orientation == DisplayOrientation.Portrait)
         {
             await Navigation.PopAsync();
         }
     });
 }
Ejemplo n.º 9
0
 void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     MainThread.BeginInvokeOnMainThread(async() =>
     {
         if (e.DisplayInfo.Orientation == DisplayOrientation.Landscape)
         {
             await Navigation.PushAsync(new OnlyVideoPage(_viewModel.MediaPlayer));
         }
     });
 }
Ejemplo n.º 10
0
        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;
            }
        }
Ejemplo n.º 11
0
 private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     if (DeviceDisplay.MainDisplayInfo.Orientation.ToString() == "Portait")
     {
         ChangeLabelText();
     }
     else
     {
         ChangedLabelText();
     }
 }
Ejemplo n.º 12
0
        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);
            }
        }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
        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;
            }
        }
Ejemplo n.º 15
0
 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;
     }
 }
Ejemplo n.º 16
0
 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;
     }
 }
Ejemplo n.º 17
0
 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;
            }
        }
Ejemplo n.º 19
0
        // 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();
            ////     }
        }
Ejemplo n.º 20
0
        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();
            }
        }
Ejemplo n.º 21
0
        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);
                }
            }
        }
Ejemplo n.º 22
0
        /// <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);
        }
Ejemplo n.º 23
0
        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");
                }
            }
        }
Ejemplo n.º 24
0
        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();
        }
Ejemplo n.º 25
0
 void DeviceInfoPropertyChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     ResetToolbar();
 }
Ejemplo n.º 26
0
 private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     OnPropertyChanged(nameof(MainDisplayInfo));
 }
Ejemplo n.º 27
0
 private void OnMainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     var displayInfo = e.DisplayInfo;
 }
Ejemplo n.º 28
0
 void OnMainDisplayInfoChanged(object?sender, DisplayInfoChangedEventArgs e)
 {
     Handler?.UpdateValue(nameof(FlyoutBehavior));
 }
 private async void DeviceDisplay_MainDisplayInfoChanged(object sender, DisplayInfoChangedEventArgs e)
 {
     await this.DismissAsync();
 }
Ejemplo n.º 30
0
 void OnRotate(Object sender, DisplayInfoChangedEventArgs e)
 {
     //Booru.ColCount = Booru.ScreenWidth / Booru.preview_height;
     //MainPage.ColCount = ScreenWidth / (preview_size);
     //change column count ??
 }