コード例 #1
0
        /// <summary>
        /// Handles the orientation change.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="arg">Argument.</param>
        public void HandleOrientationChange(object sender, Orientation arg)
        {
            FocusView.Orientation = CameraView.Orientation = OrientationPage.PageOrientation = _model.PageOrientation = arg;

            // bindings will not work with column width properties so we have to perform this manually
            switch (PageOrientation)
            {
            case Orientation.LandscapeLeft:
            case Orientation.LandscapeRight:
                MainLayout.ColumnDefinitions[5].Width = new GridLength(CAMERA_BUTTON_CONTAINER_WIDTH,
                                                                       GridUnitType.Absolute);
                break;

            case Orientation.Portrait:
                MainLayout.ColumnDefinitions[4].Width = new GridLength(CAMERA_BUTTON_CONTAINER_WIDTH,
                                                                       GridUnitType.Absolute);
                break;
            }

            if (_model.CanCapture)
            {
                FocusView.Reset();
            }

            CameraView.NotifyOrientationChange(arg);
        }