예제 #1
0
        static void SendOrientationMessage(bool isPortrait)
        {
            var msg = new DeviceOrientationChangeMessage()
            {
                Orientation = isPortrait ? DeviceOrientations.Portrait : DeviceOrientations.Landscape
            };

            MessagingCenter.Send <DeviceOrientationChangeMessage>(msg, DeviceOrientationChangeMessage.MessageId);
        }
        /// <summary>
        /// Send orientation change message through MessagingCenter
        /// </summary>
        /// <param name="e">Orientation changed event args</param>
        public static void NotifyOrientationChange(OrientationChangedEventArgs e)
        {
            bool isLandscape = (e.Orientation & PageOrientation.Landscape) == PageOrientation.Landscape;
            var  msg         = new DeviceOrientationChangeMessage()
            {
                Orientation = isLandscape ? DeviceOrientations.Landscape : DeviceOrientations.Portrait
            };

            MessagingCenter.Send <DeviceOrientationChangeMessage>(msg, DeviceOrientationChangeMessage.MessageId);
        }
        /// <summary>
        /// Send orientation change message through MessagingCenter
        /// </summary>
        /// <param name="newConfig">New configuration</param>
        public static void NotifyOrientationChange(global::Android.Content.Res.Configuration newConfig)
        {
            bool isLandscape = newConfig.Orientation == global::Android.Content.Res.Orientation.Landscape;
            var  msg         = new DeviceOrientationChangeMessage()
            {
                Orientation = isLandscape ? DeviceOrientations.Landscape : DeviceOrientations.Portrait
            };

            MessagingCenter.Send <DeviceOrientationChangeMessage>(msg, DeviceOrientationChangeMessage.MessageId);
        }
예제 #4
0
 private void HandleOrientationChange(DeviceOrientationChangeMessage mesage)
 {
     _label.Text = String.Format("Orientation changed to {0}", mesage.Orientation.ToString());
 }