/// <summary>
 /// Invoked when there is a change in the display orientation.
 /// </summary>
 /// <param name="sender">
 /// DisplayInformation object from which the new Orientation can be determined
 /// </param>
 /// <param name="e"></param>
 void displayInformation_OrientationChanged(DisplayInformation sender, object args)
 {
     if (null != accelerometerReadingTransform)
     {
         accelerometerReadingTransform.ReadingTransform = sender.CurrentOrientation;
     }
 }
예제 #2
0
		public WindowsDeviceInfo()
		{
			// TODO: Screen size and DPI can change at any time
			_information = DisplayInformation.GetForCurrentView();
			_information.OrientationChanged += OnOrientationChanged;
			CurrentOrientation = GetDeviceOrientation(_information.CurrentOrientation);
		}
예제 #3
0
 private void UpdateDpi(DisplayInformation displayInformation)
 {
     if (displayInformation != null)
     {
         LogicalDpi = displayInformation.LogicalDpi.ToString();
         Scale = (displayInformation.RawPixelsPerViewPixel * 100.0).ToString();
     }
 }
예제 #4
0
 private void DisplayInformation_OrientationChanged(DisplayInformation sender, Object args)
 {
     displayOrientation = sender.CurrentOrientation;
     if (capturing)
     {
         setPreviewRotation();
     }
 }
예제 #5
0
 private void OnDisplayContentsInvalidated(DisplayInformation sender, object args)
 {
     Debug.WriteLine("CompositionImageLoader - Display Contents Invalidated");
     //
     // This will trigger the device lost event
     //
     CanvasDevice.GetSharedDevice();
 }
예제 #6
0
        private void DisplayInformation_OrientationChanged(DisplayInformation sender, object args)
        {
            var strategy = GetHighlightStrategyForOrientation(DisplayInformation.GetForCurrentView().CurrentOrientation);

            if (_viewModel.ChangeHighlightStrategyCommand.CanExecute(strategy))
            {
                _viewModel.ChangeHighlightStrategyCommand.Execute(strategy);
            }
        }
예제 #7
0
 private async void MainPage_OrientationChanged(DisplayInformation sender, object args) {
     if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) {
         var flag = sender.CurrentOrientation != DisplayOrientations.Portrait;
         StatusBar statusBar = StatusBar.GetForCurrentView();
         if (flag)
             await statusBar.HideAsync();
         else
             await statusBar.ShowAsync();
     }
 }
예제 #8
0
 private void DisplayInfo_OrientationChanged(DisplayInformation sender, object args)
 {
     if (mediaCapture != null)
     {
         mediaCapture.SetPreviewRotation(frontCam
         ? VideoRotationLookup(sender.CurrentOrientation, true)
         : VideoRotationLookup(sender.CurrentOrientation, false));
         var rotation = VideoRotationLookup(sender.CurrentOrientation, false);
         mediaCapture.SetRecordRotation(rotation);
     }
 }
예제 #9
0
		protected override void Dispose(bool disposing)
		{
			if (_isDisposed)
				return;

			_isDisposed = true;
			_information.OrientationChanged -= OnOrientationChanged;
			_information = null;

			base.Dispose(disposing);
		}
예제 #10
0
 private void OrientationChanged(DisplayInformation sender, object args)
 {
     if (sender.CurrentOrientation == DisplayOrientations.Landscape || sender.CurrentOrientation == DisplayOrientations.LandscapeFlipped)
     {
         ShellViewModel.SetHamburguerButtonProperties(Visibility.Collapsed);
     }
     else
     {
         ShellViewModel.SetHamburguerButtonProperties(Visibility.Visible);
     }
 }
예제 #11
0
 private void OnOrientationChanged(DisplayInformation sender, object args)
 {
     if (sender.CurrentOrientation == DisplayOrientations.Portrait)
     {
         this.SetDisplayForWidth(this.currentViewHeight);
     }
     else
     {
         this.SetDisplayForWidth(this.currentViewWidth);
     }
     
 }
예제 #12
0
        private void DisplayInfoOrientationChanged(DisplayInformation sender, object args)
        {
            var orientation = sender.CurrentOrientation;
            if (orientation == DisplayOrientations.Landscape || orientation == DisplayOrientations.LandscapeFlipped)
            {
                var res = VisualStateManager.GoToState(this, "Landscape", true);

            }
            if (orientation == DisplayOrientations.Portrait || orientation == DisplayOrientations.PortraitFlipped)
            {
                var res = VisualStateManager.GoToState(this, "Portrait", false);
            }
        }
예제 #13
0
 private static async void AppViewHelper_OrientationChanged(DisplayInformation sender, object args)
 {
     if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
     {
         var statusBar = StatusBar.GetForCurrentView();
         if (sender.CurrentOrientation == DisplayOrientations.Landscape ||
             sender.CurrentOrientation == DisplayOrientations.LandscapeFlipped)
         {
             await statusBar.HideAsync();
         }
         else
         {
             await statusBar.ShowAsync();
         }
     }
 }
        public Scenario4_OrientationChanged()
        {
            this.InitializeComponent();

            // Get two instances of the accelerometer:
            // One that returns the raw accelerometer data
            accelerometerOriginal = Accelerometer.GetDefault();
            // Other on which the 'ReadingTransform' is updated so that data returned aligns with the request transformation.
            accelerometerReadingTransform = Accelerometer.GetDefault();

            if(accelerometerOriginal == null || accelerometerReadingTransform == null)
            {
                rootPage.NotifyUser("No accelerometer found", NotifyType.ErrorMessage);
            }
            displayInformation = DisplayInformation.GetForCurrentView();
        }
예제 #15
0
partial         void OrientationChanged(DisplayInformation info, object sender)
        {
            switch (info.CurrentOrientation)
            {
                case DisplayOrientations.Landscape:
                case DisplayOrientations.LandscapeFlipped:
                    PivotGrid(X, Y);

                    break;

                case DisplayOrientations.Portrait:
                case DisplayOrientations.PortraitFlipped:
                    PivotGrid(Y, X);

                    break;
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Get two instances of the accelerometer:
            // One that returns the raw accelerometer data
            accelerometerOriginal = Accelerometer.GetDefault();
            // Other on which the 'ReadingTransform' is updated so that data returned aligns with the request transformation.
            accelerometerReadingTransform = Accelerometer.GetDefault();

            if(accelerometerOriginal == null || accelerometerReadingTransform == null)
            {
                rootPage.NotifyUser("No accelerometer found", NotifyType.ErrorMessage);
            }
            else
            {
                ScenarioEnableButton.IsEnabled = true;
            }

            // Register for orientation change
            displayInformation = DisplayInformation.GetForCurrentView();
            displayInformation.OrientationChanged += displayInformation_OrientationChanged;
        }
예제 #17
0
        public static double GetMaxImageWidth(DisplayInformation display)
        {
            var maxImageWidth = Window.Current.Bounds.Width;

            if (display.CurrentOrientation == DisplayOrientations.Landscape
                || display.CurrentOrientation == DisplayOrientations.LandscapeFlipped)
            {
                var frame = Window.Current.Content as Frame;
                if (frame != null)
                {
                    var page = frame.Content as Page;
                    if (page != null)
                    {
                        var bottomAppBar = page.BottomAppBar;

                        if (bottomAppBar != null)
                            maxImageWidth -= bottomAppBar.ActualHeight;
                    }
                }
            }
            return maxImageWidth;
        }
예제 #18
0
 private static void AppViewHelper_DpiChanged(DisplayInformation sender, object args)
 {
     SetTitleBarHeight();
 }
 private void PageBaseOrientationChanged(DisplayInformation sender, object args)
 {
     CheckOrientationForPage();
 }
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> ev)
        {
            base.OnElementChanged(ev);

            if (this.Control == null)
            {
                return;
            }

            bool desktop = Device.Idiom == TargetIdiom.Desktop;

            this.Control.TextWrapping    = Windows.UI.Xaml.TextWrapping.Wrap;
            this.Control.BorderThickness = new Windows.UI.Xaml.Thickness(0.0);
            if (desktop)
            {
                this.RecountDesktopPadding();
            }
            else
            {
                double w = ApplicationView.GetForCurrentView().VisibleBounds.Width *
                           DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
                double top;
                if (w >= 1439.9)                 //1440
                {
                    top = 15.5;
                }
                else if (w >= 1079.9)                 //1080
                {
                    top = 18.5;
                }
                else if (w >= 767.9)                 //768
                {
                    top = 14.5;
                }
                else if (w >= 719.9)                 //720
                {
                    top = 16.0;
                }
                else                 //480
                {
                    top = 13.37;
                }
                this.Control.Padding = new Windows.UI.Xaml.Thickness(0.0, top, 0.0, 0.0);
            }
            this.Control.VerticalContentAlignment = Windows.UI.Xaml.VerticalAlignment.Center;

            string lastText = null;

            this.Control.TextChanged += (sender, ev2) => {
                string text = this.Control.Text;
                if (text == lastText)
                {
                    return;
                }
                lastText = text;
                string pattern = @"[.😃😊😞😉😁😂😋😈😇😆😅😄😌😍😎😏😐😒😜😚😘😖😔😓😝😠😡😢😣😤😭😫😪😩😨😥😰😱😲😳😵😶😷☺☹👀👂👃👄👅👆👇👈👉👊👋👌👍👎👏👐🙈🙉🙊🙅🙆🙇🙋🙌🙍🙎🙏☝✊✋✌❤💓💔💕💖💗💘💙💚💛💜💝💞💟👤👦👧👨👩👪👫👮👯👰👱👲👳👴👵👶👷💁💂💃🎈🎀🎁🎂🎃🎄🎅🎆🎇🎉🎊🎌🎍🎎🎏🎋🎐🎑🎒🎓💋💌💍💎💏💐💑💒👸👹👺👻👼👽👾👿💀🎽🎾🎿🏀🏁🏂🏃🏄🏆🏈🏊⚽⚾💄💅💆💇💈💉💊🃏🎠🎡🎢🎣🎤🎥🎦🎧🎨🎩🎪🎫🎬🎭🎮🎯🎰🎱🎲🎳🀄🎴🎵🎶🎷🎸🎹🎺🎻🎼📷📹📺📻📼♠♣♥♦🍕🍔🍖🍗🍘🍙🍚🍛🍜🍝🍞🍟🍠🍡🍢🍣🍤🍥🍦🍧🍨🍩🍪🍫🍬🍭🍮🍯🍰🍱🍲🍳🍴🍵🍶🍷🍸🍹🍺🍻☕🍅🍆🍇🍈🍉🍊🍌🍍🍎🍏🍑🍒🍓📝📞📟📠📡📢📣📤📥📦📧📨📩📪📫📮📰📱📲📳📴📶🔥🔦🔧🔨🔩🔪🔫🔮🔯🔱👑👒👓👔👕👖👗👘👙👚👛👜👝👞👟👠👡👢👣💺💻💼💽💾💿📀📁📂📃📄📅📆📇📈📉📊📋📌📍📎📏📐📑📒📓📔📕📖📗📘📙📚📛📜☎✂✉✏✒🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛✈🚀🚃🚄🚅🚇🚓🚒🚑🚏🚌🚉🚕🚗🚙🚚🚢🚤🚥🚧🚨⛔🅿⭕🚭🚬🚫🚪🚩🔰🚲🚶🚹🚺🚻🚼⚡⚠♿🛀🚾🚽🏠🏡🏢🏣🏥🏦🏬🏫🏪🏩🏨🏧🏭🏮🏯🏰♨⚓⛽⛺⛵⛳⛲⛪⛅🌀🌁🌂🌃🌄🌅🌆🌇🌈🌉🌊🌋🌌🌑🌓🌔🌕🌙🌛🌟🌠☀☁☔⛄✨✳✴❄❇⭐🐌🐍🐎🐑🐒🐔🐗🐘🐙🐚🐛🐜🐝🐞🐟🐠🐡🐢🐣🐤🐥🐦🐧🐨🐩🐫🐬🐭🐯🐰🐱🐲🐳🐴🐵🐶🐷🐸🐹🐺🐻🐼🐽🐾😸😹😺😻😼😽😾😿🙀🌰🌱🌴🌵🌷🌸🌹🌺🌻🌼🌽🌾🌿🍀🍁🍂🍃🍄♻⁉‼❓❔❕❗☑✅✔❌❎➕➖✖➗©®™🌏🗻🗼🗽🗾🗿➰➿⤴⤵⬛⬜〰〽💠💡💢💣💤💥💦💧💨💩💪💫💬💮💯💰💱💲💳💴💵💸💹🔙🔚🔛🔜🔝↔↕↖↗↘↙↩↪➡⬅⬆⬇🔲🔳🔴🔵🔶🔷🔸🔹▪▫▶◀◻◼◽◾🔟ℹ🔞Ⓜ⚪⚫🉐🉑㊗㊙🅰🅱🅾🆎🆑🆒🆓🆔🆕🆖🆗🆘🆙🆚🈁🈂🈚🈯🈲🈳🈴🈵🈶🈷🈸🈹🈺🔃🔊🔋🔌🔍🔎🔏🔐🔑🔒🔓🔔🔖🔗🔘🔠🔡🔢🔣🔤🔺🔻🔼🔽⌚⌛⏩⏪⏫⏬⏰⏳♈♉♊♋♌♍♎♏♐♑♒♓⛎]";

                string cleanedText = Regex.Replace(text, pattern, "");

                if (cleanedText == text)
                {
                    return;
                }
                this.Control.Text = cleanedText;
            };

            this.ResizeFont();
        }
예제 #21
0
        public void UpdateText(SensorData sensorData)
        {
            try
            {
                int index = sensorData._reading.Count - 1;
                if (sensorData._count == Sensor.currentId)
                {
                    UpdateProperty(sensorData._deviceId, sensorData._deviceName, sensorData._reportInterval, sensorData._minReportInterval, sensorData._reportLatency,
                                   sensorData._category, sensorData._persistentUniqueId, sensorData._manufacturer, sensorData._model, sensorData._connectionType,
                                   sensorData._isPrimary, sensorData._vendorDefinedSubType, sensorData._state);
                }

                if (StackPanelSensor.Visibility == Visibility.Visible)
                {
                    if (sensorData._sensorType == Sensor.ACCELEROMETER || sensorData._sensorType == Sensor.ACCELEROMETERLINEAR || sensorData._sensorType == Sensor.ACCELEROMETERGRAVITY)
                    {
                        double margin = 80;
                        double x      = Math.Min(1, sensorData._reading[index].value[0]);
                        double y      = Math.Min(1, sensorData._reading[index].value[1]);
                        double square = x * x + y * y;

                        if (square > 1)
                        {
                            x /= Math.Sqrt(square);
                            y /= Math.Sqrt(square);
                        }

                        DisplayInformation displayInformation = DisplayInformation.GetForCurrentView();
                        if (displayInformation.NativeOrientation == DisplayOrientations.Landscape)
                        {
                            switch (displayInformation.CurrentOrientation)
                            {
                            case DisplayOrientations.Landscape: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = margin * x, Bottom = margin * y
                            }; break;

                            case DisplayOrientations.Portrait: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = margin * y, Bottom = -margin * x
                            }; break;

                            case DisplayOrientations.LandscapeFlipped: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = -margin * x, Bottom = -margin * y
                            }; break;

                            case DisplayOrientations.PortraitFlipped: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = -margin * y, Bottom = margin * x
                            }; break;
                            }
                        }
                        else if (displayInformation.NativeOrientation == DisplayOrientations.Portrait)
                        {
                            switch (displayInformation.CurrentOrientation)
                            {
                            case DisplayOrientations.Landscape: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = -margin * y, Bottom = margin * x
                            }; break;

                            case DisplayOrientations.Portrait: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = margin * x, Bottom = margin * y
                            }; break;

                            case DisplayOrientations.LandscapeFlipped: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = margin * y, Bottom = -margin * x
                            }; break;

                            case DisplayOrientations.PortraitFlipped: ellipseAccelerometer.Margin = new Thickness()
                            {
                                    Left = -margin * x, Bottom = -margin * y
                            }; break;
                            }
                        }
                    }

                    for (int i = 0; i < sensorData._reading[index].value.Length; i++)
                    {
                        textBlockProperty[i].Text = sensorData._property[i];
                        textBlockValue[i].Text    = string.Format("        {0,5:0.00}", sensorData._reading[index].value[i]);
                        textBlockMinValue[i].Text = string.Format("        {0,5:0.0}", sensorData._minValue[i]);
                        textBlockMaxValue[i].Text = string.Format("        {0,5:0.0}", sensorData._maxValue[i]);
                        if (sensorData._property[i].StartsWith("MagneticNorth"))
                        {
                            RotateTransform rotateCompass = new RotateTransform();
                            imageCompass.RenderTransform = rotateCompass;
                            rotateCompass.Angle          = (-1) * Convert.ToDouble(sensorData._reading[index].value[i]);
                            rotateCompass.CenterX        = imageCompass.ActualWidth / 2;
                            rotateCompass.CenterY        = imageCompass.ActualHeight / 2;
                        }
                        else if (sensorData._property[i].StartsWith("AngularVelocityX"))
                        {
                            RotateTransform rotateGyrometerX = new RotateTransform()
                            {
                                CenterX = imageGyrometerX.ActualWidth / 2, CenterY = imageGyrometerX.ActualHeight / 2
                            };
                            imageGyrometerX.RenderTransform = rotateGyrometerX;
                            rotateGyrometerX.Angle          = Math.Max(-135, Math.Min(135, Convert.ToDouble(sensorData._reading[index].value[i])));
                        }
                        else if (sensorData._property[i].StartsWith("AngularVelocityY"))
                        {
                            RotateTransform rotateGyrometerY = new RotateTransform();
                            imageGyrometerY.RenderTransform = rotateGyrometerY;
                            rotateGyrometerY.Angle          = Math.Max(-135, Math.Min(135, Convert.ToDouble(sensorData._reading[index].value[i])));
                            rotateGyrometerY.CenterX        = imageGyrometerY.ActualWidth / 2;
                            rotateGyrometerY.CenterY        = imageGyrometerY.ActualHeight / 2;
                        }
                        else if (sensorData._property[i].StartsWith("AngularVelocityZ"))
                        {
                            RotateTransform rotateGyrometerZ = new RotateTransform();
                            imageGyrometerZ.RenderTransform = rotateGyrometerZ;
                            rotateGyrometerZ.Angle          = Math.Max(-135, Math.Min(135, Convert.ToDouble(sensorData._reading[index].value[i])));
                            rotateGyrometerZ.CenterX        = imageGyrometerZ.ActualWidth / 2;
                            rotateGyrometerZ.CenterY        = imageGyrometerZ.ActualHeight / 2;
                        }
                        else if (sensorData._property[i].StartsWith("Pitch"))
                        {
                            RotateTransform rotate = new RotateTransform()
                            {
                                CenterX = imageInclinometerPitch.ActualWidth / 2, CenterY = imageInclinometerPitch.ActualHeight / 2
                            };
                            imageInclinometerPitch.RenderTransform = rotate;
                            rotate.Angle = sensorData._reading[index].value[i];
                        }
                        else if (sensorData._property[i].StartsWith("Roll"))
                        {
                            RotateTransform rotate = new RotateTransform()
                            {
                                CenterX = imageInclinometerRoll.ActualWidth / 2, CenterY = imageInclinometerRoll.ActualHeight / 2
                            };
                            imageInclinometerRoll.RenderTransform = rotate;
                            rotate.Angle = sensorData._reading[index].value[i];
                        }
                        else if (sensorData._property[i] == "Yaw (°)")
                        {
                            RotateTransform rotate = new RotateTransform()
                            {
                                CenterX = imageInclinometerYaw.ActualWidth / 2, CenterY = imageInclinometerYaw.ActualHeight / 2
                            };
                            imageInclinometerYaw.RenderTransform = rotate;
                            rotate.Angle = -sensorData._reading[index].value[i];
                        }
                        else if (sensorData._property[i] == "Illuminance (lux)")
                        {
                            textBlockSensor.Text = "💡";
                            if (sensorData._reading[index].value[i] < 1)
                            {
                                textBlockSensor.Opacity = 0.1;
                            }
                            else
                            {
                                textBlockSensor.Opacity = Math.Min(0.1 + Math.Log(sensorData._reading[index].value[i], 2) / 10, 1);
                            }
                        }
                        else if (sensorData._property[i] == "CumulativeSteps")
                        {
                            int value = Convert.ToInt32(sensorData._reading[index].value[i]) / 100;
                            _plotCanvas.SetRange((value + 1) * 100, value * 100);
                        }
                        else if (sensorData._property[i] == "HeadingAccuracy" || sensorData._property[i] == "YawAccuracy")
                        {
                            MagnetometerAccuracy magnetometerAccuracy = (MagnetometerAccuracy)sensorData._reading[index].value[i];
                            textBlockValue[i].Text = string.Format("        {0}", magnetometerAccuracy);
                        }
                        else if (sensorData._property[i] == "IsDetected")
                        {
                            textBlockSensor.Text = (sensorData._reading[index].value[i] > 0.5 ? "📲" : "📱");
                        }
                        else if (sensorData._property[i] == "StepKind")
                        {
                            PedometerStepKind pedometerStepKind = (PedometerStepKind)sensorData._reading[index].value[i];
                            textBlockValue[i].Text = string.Format("        {0}", pedometerStepKind);
                            textBlockSensor.Text   = DictionaryStepKind[pedometerStepKind];
                        }
                        else if (sensorData._sensorType == Sensor.SIMPLEORIENTATIONSENSOR)
                        {
                            SimpleOrientation simpleOrientation = (SimpleOrientation)sensorData._reading[index].value[i];
                            textBlockValue[i].Text    = string.Format("        {0}", simpleOrientation).Replace("DegreesCounterclockwise", "°↺");
                            textBlockMinValue[i].Text = "";
                            textBlockMaxValue[i].Text = "";
                        }
                        else if (sensorData._sensorType == Sensor.ACTIVITYSENSOR)
                        {
                            if (sensorData._reading[index].value[i] == Sensor.ACTIVITYNONE)
                            {
                                textBlockValue[i].Text = "None";
                            }
                            else if (sensorData._reading[index].value[i] == Sensor.ACTIVITYNOTSUPPORTED)
                            {
                                textBlockValue[i].Text = "Not Supported";
                            }
                            else
                            {
                                ActivitySensorReadingConfidence activitySensorReadingConfidence = (ActivitySensorReadingConfidence)sensorData._reading[index].value[i];
                                textBlockValue[i].Text = string.Format("        {0}", activitySensorReadingConfidence);
                                textBlockSensor.Text   = DictionaryActivity[(ActivityType)i];
                            }
                        }
                        else if (sensorData._sensorType == Sensor.LIGHTSENSOR)
                        {
                            if (sensorData._reading[index].value[i] == -1)
                            {
                                textBlockValue[i].Text    = "N/A";
                                textBlockMinValue[i].Text = "N/A";
                                textBlockMaxValue[i].Text = "N/A";
                            }
                        }
                    }
                }
            }
            catch { }
        }
예제 #22
0
 private static void RaiseConfigurationChanges()
 {
     Xaml.Window.Current?.RaiseNativeSizeChanged();
     ViewHelper.RefreshFontScale();
     DisplayInformation.GetForCurrentView().HandleConfigurationChange();
 }
예제 #23
0
 public TizenDisplayInformationExtension(object owner, Window window)
 {
     _displayInformation = (DisplayInformation)owner;
     _window             = window;
     _profile            = Elementary.GetProfile();
 }
예제 #24
0
 public void ShowDescription()
 {
     DisplayInformation.ShowText(Data.Name, Data.Description);
 }
예제 #25
0
 private void DisplayOnOrientationChanged(DisplayInformation sender, object args)
 {
     SetRotation(_display.CurrentOrientation);
 }
예제 #26
0
        private async void pickBackground(object sender, RoutedEventArgs e)
        {
            var picker = new FileOpenPicker();

            picker.ViewMode = PickerViewMode.Thumbnail;
            picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");
            picker.FileTypeFilter.Add(".png");
            StorageFile file = await picker.PickSingleFileAsync();

            BitmapImage bitmap = new BitmapImage();

            try
            {
                using (var stream = await file.OpenAsync(FileAccessMode.Read))
                {
                    bitmap.SetSource(stream);
                }
            }
            catch (Exception)
            {
                return;
            }
            backgroundPictrure.Source = bitmap;
            StorageFolder applicationFolder = ApplicationData.Current.LocalFolder;
            StorageFile   saveFile          = await applicationFolder.CreateFileAsync(file.Name, CreationCollisionOption.OpenIfExists);

            RenderTargetBitmap bitmap2 = new RenderTargetBitmap();
            await bitmap2.RenderAsync(backgroundPictrure);

            var pixelBuffer = await bitmap2.GetPixelsAsync();

            try
            {
                using (var fileStream = await saveFile.OpenAsync(FileAccessMode.ReadWrite))
                {
                    BitmapEncoder encoder = null;
                    if (file.FileType == ".jpg" || file.FileType == ".jepg")
                    {
                        encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, fileStream);
                    }
                    else
                    {
                        encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, fileStream);
                    }
                    encoder.SetPixelData(
                        BitmapPixelFormat.Bgra8,
                        BitmapAlphaMode.Ignore,
                        (uint)bitmap2.PixelWidth,
                        (uint)bitmap2.PixelHeight,
                        DisplayInformation.GetForCurrentView().LogicalDpi,
                        DisplayInformation.GetForCurrentView().LogicalDpi,
                        pixelBuffer.ToArray()
                        );
                    await encoder.FlushAsync();
                }
            }
            catch (Exception)
            {
                return;
            }
        }
예제 #27
0
 public void HideDescription()
 {
     DisplayInformation.HideText();
 }
 private void AdaptiveTriggerConsts_OrientationChanged(DisplayInformation sender, object args)
 {
     //RaisePropertyChanged(nameof(Orientation));
 }
예제 #29
0
        async private static Task CropBitmapAsync(Stream localFileStream, FaceRectangle rectangle, StorageFile resultFile)
        {
            //Get pixels of the crop region
            var pixels = await GetCroppedPixelsAsync(localFileStream.AsRandomAccessStream(), rectangle);

            // Save result to new image
            using (Stream resultStream = await resultFile.OpenStreamForWriteAsync())
            {
                IRandomAccessStream randomAccessStream = resultStream.AsRandomAccessStream();
                BitmapEncoder       encoder            = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, randomAccessStream);

                encoder.SetPixelData(BitmapPixelFormat.Bgra8,
                                     BitmapAlphaMode.Ignore,
                                     (uint)rectangle.Width, (uint)rectangle.Height,
                                     DisplayInformation.GetForCurrentView().LogicalDpi, DisplayInformation.GetForCurrentView().LogicalDpi, pixels);

                await encoder.FlushAsync();
            }
        }
예제 #30
0
        //
        // Adapted from https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/CameraStarterKit/cs/MainPage.xaml.cs
        //

        private async void OnOrientationChanged(DisplayInformation sender, object args)
        {
            await SetPreviewRotation();
        }
예제 #31
0
        public CameraEffectExample()
        {
            this.InitializeComponent();

            DisplayInformation.GetForCurrentView().OrientationChanged += OnOrientationChanged;
        }
예제 #32
0
        public void Initialize(CoreWindow coreWindow, UIElement inputElement, TouchQueue touchQueue)
        {
            _coreWindow = coreWindow;
            _windowEvents = new InputEvents(_coreWindow, inputElement, touchQueue);

			_dinfo = DisplayInformation.GetForCurrentView();
            _appView = ApplicationView.GetForCurrentView();

            // Set a min size that is reasonable knowing someone might try
            // to use some old school resolution like 640x480.
            var minSize = new Windows.Foundation.Size(640 / _dinfo.RawPixelsPerViewPixel, 480 / _dinfo.RawPixelsPerViewPixel);
            _appView.SetPreferredMinSize(minSize);

            _orientation = ToOrientation(_dinfo.CurrentOrientation);
            _dinfo.OrientationChanged += DisplayProperties_OrientationChanged;
            _swapChainPanel = inputElement as SwapChainPanel;

            _swapChainPanel.SizeChanged += SwapChain_SizeChanged;

            _coreWindow.Closed += Window_Closed;
            _coreWindow.Activated += Window_FocusChanged;
			_coreWindow.CharacterReceived += Window_CharacterReceived;

            SetViewBounds(_appView.VisibleBounds.Width, _appView.VisibleBounds.Height);

            SetCursor(false);
        }
예제 #33
0
 private float GetPixelDensity()
 {
     return((float)DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel);
 }
예제 #34
0
        private void _displayInformation_DpiChanged(DisplayInformation sender, object args)
        {
            DisplayInformation displayInformation = sender as DisplayInformation;

            UpdateDpi(displayInformation);
        }
 private void OnOrientationChanged(DisplayInformation sender, object args)
 {
     this.TransitionStoryboardState();
 }
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            RenderTargetBitmap rtb = new RenderTargetBitmap();
            await rtb.RenderAsync(lineChart);

            var pixelBuffer = await rtb.GetPixelsAsync();

            var           pixels             = pixelBuffer.ToArray();
            var           displayInformation = DisplayInformation.GetForCurrentView();
            MessageDialog messageDialog;
            var           savePicker = new Windows.Storage.Pickers.FileSavePicker();

            savePicker.SuggestedStartLocation =
                Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
            // Dropdown of file types the user can save the file as
            savePicker.FileTypeChoices.Add("PNG Bitmap", new List <string>()
            {
                ".png"
            });
            // Default file name if the user does not type one in or select a file to replace
            savePicker.SuggestedFileName = $"Chart-{ViewModel.CurrentCurrencyCode}_{HelperClass.formatDateTimeOffset((DateTimeOffset)ViewModel.FromRateHistoryDate)}_{HelperClass.formatDateTimeOffset((DateTimeOffset)ViewModel.ToRateHistoryDate)}";
            Windows.Storage.StorageFile file = await savePicker.PickSaveFileAsync();

            if (file != null)
            {
                // Prevent updates to the remote version of the file until
                // we finish making changes and call CompleteUpdatesAsync.
                Windows.Storage.CachedFileManager.DeferUpdates(file);
                // write to file
                await Windows.Storage.FileIO.WriteTextAsync(file, file.Name);

                // Let Windows know that we're finished changing the file so
                // the other app can update the remote version of the file.
                // Completing updates may require Windows to ask for user input.
                Windows.Storage.Provider.FileUpdateStatus status =
                    await Windows.Storage.CachedFileManager.CompleteUpdatesAsync(file);

                if (status == Windows.Storage.Provider.FileUpdateStatus.Complete)
                {
                    using (var stream = await file.OpenAsync(FileAccessMode.ReadWrite))
                    {
                        var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream);

                        encoder.SetPixelData(BitmapPixelFormat.Bgra8,
                                             BitmapAlphaMode.Premultiplied,
                                             (uint)rtb.PixelWidth,
                                             (uint)rtb.PixelHeight,
                                             displayInformation.RawDpiX,
                                             displayInformation.RawDpiY,
                                             pixels);
                        await encoder.FlushAsync();
                    }
                    messageDialog = new MessageDialog("File " + file.Name + " was saved.");
                }
                else
                {
                    messageDialog = new MessageDialog("File " + file.Name + " couldn't be saved.");
                }
            }
            else
            {
                return;
            }
            await messageDialog.ShowAsync();
        }
예제 #37
0
 private async void DisplayInformation_OrientationChanged(DisplayInformation sender, object args)
 {
     _displayOrientation = sender.CurrentOrientation;
     await SetPreviewRotationAsync();
 }
 private void OnOrientationChanged(DisplayInformation sender, object args)
 {
     Element?.ForceLayout();
 }
예제 #39
0
 private async void Eyedropper_DpiChanged(DisplayInformation sender, object args)
 {
     await UpdateAppScreenshotAsync();
 }
 async void displayInformation_OrientationChanged(DisplayInformation sender, object args)
 {
     displayOrientation = sender.CurrentOrientation;
     await SetPreviewRotationAsync();
 }
예제 #41
0
 private void DisplayInformation_OrientationChanged(DisplayInformation sender, object args)
 {
     HandleOrientationChanged(true);
 }
예제 #42
0
        /// <summary>
        /// Does the work necessary to setup and launch the app.
        /// </summary>
        /// <param name="arguments"></param>
        private void SetupAndALaunchApp(string arguments)
        {
            // Check the args for prevent crash
            if (!String.IsNullOrWhiteSpace(arguments))
            {
                string lowerArgs = arguments.ToLower();
                if (lowerArgs.Contains(c_protocolPreventCrashesDisabled))
                {
                    BaconMan.UiSettingsMan.Developer_StopFatalCrashesAndReport = false;
                }
                else if (lowerArgs.Contains(c_protocolPreventCrashesEnabled))
                {
                    BaconMan.UiSettingsMan.Developer_StopFatalCrashesAndReport = true;
                }
            }

            // Grab the accent color and make our custom accent color brushes.
            if (!Current.Resources.ContainsKey(AccentColorLevel1Resource))
            {
                Color accentColor = ((SolidColorBrush)Current.Resources["SystemControlBackgroundAccentBrush"]).Color;
                accentColor.A = 200;
                Current.Resources[AccentColorLevel1Resource] = new SolidColorBrush(accentColor);
                accentColor.A = 137;
                Current.Resources[AccentColorLevel2Resource] = new SolidColorBrush(accentColor);
                accentColor.A = 75;
                Current.Resources[AccentColorLevel3Resource] = new SolidColorBrush(accentColor);
                accentColor.A = 50;
                Current.Resources[AccentColorLevel4Resource] = new SolidColorBrush(accentColor);
            }

            // Register for back, if we haven't already.
            if (!m_hasRegisteredForBack)
            {
                m_hasRegisteredForBack = true;
                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
            }

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), arguments);
            }
            else
            {
                // If we have already navigated, we should tell the main page
                // we are being activated again.
                if (rootFrame.Content.GetType() == typeof(MainPage))
                {
                    MainPage main = (MainPage)rootFrame.Content;
                    main.OnReActivated(arguments);
                }
            }

            // We have to get the screen res before we call activate or it will be wrong and include the system tray.
            var bounds      = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds;
            var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;

            BaconMan.BackgroundMan.ImageUpdaterMan.LastKnownScreenResoultion = new Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor);

            // Ensure the current window is active
            Window.Current.Activate();
        }
        public SwapChainManager(CoreWindow window, CanvasDevice device)
        {
            float currentDpi = DisplayInformation.GetForCurrentView().LogicalDpi;

            SwapChain = CanvasSwapChain.CreateForCoreWindow(device, window, currentDpi);
        }
예제 #44
0
 private void OnDisplayOrientationChanged(DisplayInformation sender, object e)
 {
     UpdateTrigger(Orientation);
 }
예제 #45
0
        private async void DisplayInformation_OrientationChanged(DisplayInformation sender, object args)
        {
            _displayOrientation = sender.CurrentOrientation;

            if (_isPreviewing)
            {
                await SetPreviewRotationAsync();
            }
        }
예제 #46
0
        static void OnDisplayInformationChanged(DisplayInformation di, object args)
        {
            var metrics = GetScreenMetrics(di);

            OnScreenMetricsChanaged(metrics);
        }
예제 #47
0
 public MainViewModel()
 {
     _displayInformation = DisplayInformation.GetForCurrentView();
 }
예제 #48
0
        public static async Task <string> DumpAsync(Exception e, bool shouldDumpCompleteDeviceInfos = false)
        {
            var builder   = new StringBuilder();
            var packageId = Package.Current.Id;
            var clientDeviceInformation = new EasClientDeviceInformation();
            var displayInformation      = DisplayInformation.GetForCurrentView();
            var touchCapabilities       = new TouchCapabilities();

            builder.AppendLine("***** Diagnostic Information *****\r\n\n");
#if DEBUG
            builder.AppendLine("DEBUG\r\n");
#endif
            builder.AppendLine("MVP Companion Exception\r\n");
            builder.AppendFormat(e.Message + $"{e.Message}");

            builder.AppendFormat($"Time: {DateTime.Now.ToUniversalTime():r}\r\n");
            builder.AppendFormat($"App Name: {packageId.Name}\r\n");
            builder.AppendFormat($"App Version: {packageId.Version.Major}.{packageId.Version.Minor}.{packageId.Version.Build}.{packageId.Version.Revision}\r\n");
            builder.AppendFormat($"App Publisher: {packageId.Publisher}\r\n");
            builder.AppendFormat($"Supported Package Architecture: {packageId.Architecture}\r\n");
            builder.AppendFormat($"Store App Id: {CurrentApp.AppId}\r\n");
            builder.AppendFormat($"Culture: {CultureInfo.CurrentCulture}\r\n");
            builder.AppendFormat($"OS: {clientDeviceInformation.OperatingSystem}\r\n");
            builder.AppendFormat($"System Manufacturer: {clientDeviceInformation.SystemManufacturer}\r\n");
            builder.AppendFormat($"System Product Name: {clientDeviceInformation.SystemProductName}\r\n");
            builder.AppendFormat($"Friendly System Name: {clientDeviceInformation.FriendlyName}\r\n");
            builder.AppendFormat($"Friendly System ID: {clientDeviceInformation.Id}\r\n");
            builder.AppendFormat($"Current Memory Usage: {GC.GetTotalMemory(false) / 1024f / 1024f:f3} MB\r\n");
            builder.AppendFormat($"Window Bounds: {Window.Current.Bounds.Width} x {Window.Current.Bounds.Height}\r\n");
            builder.AppendFormat($"Logical DPI: {displayInformation.LogicalDpi}\r\n");
            builder.AppendFormat($"Resolution Scale: {displayInformation.ResolutionScale}\r\n");
            builder.AppendFormat($"Current Orientation: {displayInformation.CurrentOrientation}\r\n");
            builder.AppendFormat($"Native Orientation: {displayInformation.NativeOrientation}\r\n");
            builder.AppendFormat($"Is Stereo Enabled: {displayInformation.StereoEnabled}\r\n");
            builder.AppendFormat($"Supports Keyboard: {new KeyboardCapabilities().KeyboardPresent == 1}\r\n");
            builder.AppendFormat($"Supports Mouse: {new MouseCapabilities().MousePresent == 1}\r\n");
            builder.AppendFormat($"Supports Touch (contacts): {touchCapabilities.TouchPresent == 1} ({touchCapabilities.Contacts})\r\n");
            builder.AppendFormat($"Is Network Available: {NetworkInterface.GetIsNetworkAvailable()}\r\n");
            builder.AppendFormat($"Is Internet Connection Available: {NetworkInformation.GetInternetConnectionProfile() != null}\r\n");

            if (shouldDumpCompleteDeviceInfos)
            {
                builder.AppendFormat($"Installed Location: {Package.Current.InstalledLocation.Path}\r\n");
                builder.AppendFormat($"App Temp  Folder: {ApplicationData.Current.TemporaryFolder.Path}\r\n");
                builder.AppendFormat($"App Local Folder: {ApplicationData.Current.LocalFolder.Path}\r\n");
                builder.AppendFormat($"App Roam  Folder: {ApplicationData.Current.RoamingFolder.Path}\r\n\n");

                builder.AppendFormat("Network Host Names:\r\n");

                foreach (var hostName in NetworkInformation.GetHostNames())
                {
                    builder.AppendFormat($"{hostName.DisplayName} ({hostName.Type}), \r\n");
                }

                var devInfos = await DeviceInformation.FindAllAsync();

                builder.AppendLine("\r\n\nComplete Device Infos:\r\n");

                foreach (var devInfo in devInfos)
                {
                    builder.AppendFormat($"Name: {devInfo.Name} Id: {devInfo.Id} - Properties: \r\n");

                    foreach (var pair in devInfo.Properties)
                    {
                        builder.AppendFormat($"{pair.Key} = {pair.Value}, \r\n");
                    }
                }
            }

            return(builder.ToString());
        }
예제 #49
0
        public MainPage()
        {
            this.InitializeComponent();
            mainPageViewModel = new MainPageViewModel();
            DataContext       = mainPageViewModel;
            Authenticate();

            NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

            AppCallbacks appCallbacks = AppCallbacks.Instance;

            // Setup scripting bridge
            bridge = new WinRTBridge.WinRTBridge();
            appCallbacks.SetBridge(bridge);

            // Sets the delegate method on the ViewSwitcher so we can call UWP code...
            FlatAppHelper.NavigateToFlatApp = SwitchToFlatPage;

            bool isWindowsHolographic = false;

#if UNITY_HOLOGRAPHIC
            // If application was exported as Holographic check if the deviceFamily actually supports it,
            // otherwise we treat this as a normal XAML application
            string deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
            isWindowsHolographic = String.Compare("Windows.Holographic", deviceFamily) == 0;
#endif

            if (isWindowsHolographic)
            {
                appCallbacks.InitializeViewManager(Window.Current.CoreWindow);
            }
            else
            {
                appCallbacks.RenderingStarted += () => { RemoveSplashScreen(); };

#if UNITY_UWP
                if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
                {
                    isPhone = true;
                }
#endif
#if !UNITY_WP_8_1
                appCallbacks.SetKeyboardTriggerControl(this);
#else
                isPhone = true;
#endif
                appCallbacks.SetSwapChainPanel(GetSwapChainPanel());
                appCallbacks.SetCoreWindowEvents(Window.Current.CoreWindow);
                appCallbacks.InitializeD3DXAML();

                splash = ((App)App.Current).SplashScreen;
                GetSplashBackgroundColor();
                OnResize();
                onResizeHandler             = new WindowSizeChangedEventHandler((o, e) => OnResize());
                Window.Current.SizeChanged += onResizeHandler;

#if UNITY_WP_8_1
                onRotationChangedHandler = new TypedEventHandler <DisplayInformation, object>((di, o) => { OnRotate(di); });
                ExtendedSplashImage.RenderTransformOrigin = new Point(0.5, 0.5);
                var displayInfo = DisplayInformation.GetForCurrentView();
                displayInfo.OrientationChanged += onRotationChangedHandler;
                OnRotate(displayInfo);

                SetupLocationService();
#endif
            }
        }
 private void OnOrientationChanged(DisplayInformation sender, object args)
 {
     this.TransitionStoryboardState();
 }
예제 #51
0
        private void DisplayProperties_OrientationChanged(DisplayInformation dinfo, object sender)
        {
            lock(_eventLocker)
            {
                // Set the new orientation.
                _orientation = ToOrientation(dinfo.CurrentOrientation);

                // Call the user callback.
                OnOrientationChanged();

                // If we have a valid client bounds then update the graphics device.
                if (_viewBounds.Width > 0 && _viewBounds.Height > 0)
                    Game.graphicsDeviceManager.ApplyChanges();
            }
        }
 private void OnOrientationChanged(DisplayInformation sender, object args)
 {
     UpdateElementSize();
 }
 /// <summary>
 /// Event handler for the DpiChanged event. 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void OnDpiChanged(DisplayInformation sender, object args)
 {
     // If the DpiChanged event is raised then the DPI of the current view has changed. Since the image was generated
     // at the old DPI, it should be re-rendered if possible to ensure the content does not display rendering artifacts due
     // to scaling.  Note the resulting content may be different than before if the tree has changed.
     RenderImageSource();
 }
예제 #54
0
 private void MainPage_OrientationChanged(DisplayInformation info, object args)
 {
     DebugUtil.Log(() => "orientation: " + info.CurrentOrientation);
     DebugUtil.Log(() => LayoutRoot.ActualWidth + " x " + LayoutRoot.ActualHeight);
 }
 private void PageBaseOrientationChanged(DisplayInformation sender, object args)
 {
     CheckOrientationForPage();
 }
예제 #56
0
 private void NavigationRootPage_OrientationChanged(DisplayInformation sender, object args)
 {
     //Debug.WriteLine(sender.CurrentOrientation);
 }
예제 #57
0
 private void UserControlBaseOrientationChanged(DisplayInformation sender, object args)
 {
     CheckOrientation();
 }
예제 #58
0
        // Create marker symbols
        private async Task SetupSymbolsAsync()
        {
            try
            {
                int size   = Convert.ToInt32(LayoutRoot.Resources["ImageSize"]);
                int sizePt = (int)((float)size / DisplayInformation.GetForCurrentView().LogicalDpi * 72);

                // Create simple marker symbols
                var blackOutlineSymbol = new SimpleLineSymbol()
                {
                    Color = Colors.Black, Style = SimpleLineStyle.Solid, Width = 1
                };

                _symbols = new List <MarkerSymbol>()
                {
                    new SimpleMarkerSymbol()
                    {
                        Color = Colors.Red, Size = sizePt, Style = SimpleMarkerStyle.Circle, Outline = blackOutlineSymbol
                    },
                    new SimpleMarkerSymbol()
                    {
                        Color = Colors.Green, Size = sizePt, Style = SimpleMarkerStyle.Diamond, Outline = blackOutlineSymbol
                    },
                    new SimpleMarkerSymbol()
                    {
                        Color = Colors.Blue, Size = sizePt, Style = SimpleMarkerStyle.Square, Outline = blackOutlineSymbol
                    },
                    new SimpleMarkerSymbol()
                    {
                        Color = Colors.Purple, Size = sizePt, Style = SimpleMarkerStyle.X, Outline = blackOutlineSymbol
                    },
                };

                // Set image sources for picture marker symbols
                List <Task> setSourceTasks = new List <Task>();

                var stickPinSymbol = new PictureMarkerSymbol()
                {
                    Width = size, Height = size
                };
                setSourceTasks.Add(stickPinSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/RedStickpin.png")));
                _symbols.Add(stickPinSymbol);

                var pushPinSymbol = new PictureMarkerSymbol()
                {
                    Width = size, Height = size
                };
                setSourceTasks.Add(pushPinSymbol.SetSourceAsync(new Uri("http://static.arcgis.com/images/Symbols/Basic/RedShinyPin.png")));
                _symbols.Add(pushPinSymbol);

                var xPictureSymbol = new PictureMarkerSymbol()
                {
                    Width = size, Height = size
                };
                setSourceTasks.Add(xPictureSymbol.SetSourceAsync(new Uri("ms-appx:///Assets/x-24x24.png")));
                _symbols.Add(xPictureSymbol);

                await Task.WhenAll(setSourceTasks);

                // Create image swatches for the UI
                Task <ImageSource>[] swatchTasks = _symbols
                                                   .Select(sym => sym.CreateSwatchAsync())
                                                   .ToArray();

                symbolCombo.ItemsSource = await Task.WhenAll(swatchTasks);

                symbolCombo.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error: " + ex.Message);
            }
        }
        /// <summary>
        /// This event will fire when the page is rotated, when the DisplayInformation.AutoRotationPreferences value set in the SetupUiAsync() method cannot be not honored.
        /// </summary>
        /// <param name="sender">The event source.</param>
        /// <param name="args">The event data.</param>
        private async void DisplayInformation_OrientationChanged(DisplayInformation sender, object args)
        {
            _displayOrientation = sender.CurrentOrientation;

            if (_isPreviewing)
            {
                await SetPreviewRotationAsync();
            }

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateButtonOrientation());
        }
예제 #60
0
 public static string GetDisplayScreenScaling(string displayId)
 => (DisplayInformation.GetForCurrentView().LogicalDpi * 100f / 96f).ToString(CultureInfo.InvariantCulture);