Skip to content

Commit 632398b

Browse files
author
Rohit Agrawal
committedMar 1, 2016
Update samples with latest APIs
Change DpiScaleInfo to DpiScale
1 parent 67df32f commit 632398b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed
 

Diff for: ‎PerMonitorDPI/FormattedTextExample/MainWindow.xaml.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ private void MainWindow_Loaded(object sender, RoutedEventArgs e)
3131
DrawFormattedText(VisualTreeHelper.GetDpi(this));
3232
}
3333

34-
protected override void OnDpiChanged(DpiScaleInfo oldDpiScaleInfo, DpiScaleInfo newDpiScaleInfo)
34+
protected override void OnDpiChanged(DpiScale oldDpiScaleInfo, DpiScale newDpiScaleInfo)
3535
{
3636
DrawFormattedText(newDpiScaleInfo);
3737
}
3838

39-
private void DrawFormattedText(DpiScaleInfo dpiInfo)
39+
private void DrawFormattedText(DpiScale dpiInfo)
4040
{
4141
FormattedText formattedText = new FormattedText(
4242
"FABLE",

Diff for: ‎PerMonitorDPI/ImageScaling/DpiAwareImage.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ public DpiAwareImage() : base()
2121
// on initial load, ensure we are using the right scaled image, based on the DPI.
2222
private void DpiAwareImage_Initialized(object sender, EventArgs e)
2323
{
24-
DpiScaleInfo newDpi = VisualTreeHelper.GetDpi(sender as Visual);
24+
DpiScale newDpi = VisualTreeHelper.GetDpi(sender as Visual);
2525
ScaleRightImage(newDpi);
2626
}
2727

2828
// when DPI changes, ensure we are using the right scaled image, based on the DPI.
29-
protected override void OnDpiChanged(DpiScaleInfo oldDpi, DpiScaleInfo newDpi)
29+
protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
3030
{
3131
ScaleRightImage(newDpi);
3232
}
3333

34-
private void ScaleRightImage(DpiScaleInfo newDpi)
34+
private void ScaleRightImage(DpiScale newDpi)
3535
{
3636
// update bestScale
3737
bestScale = ImageDpiHelper.GetBestScale(newDpi.PixelsPerDip);

Diff for: ‎PerMonitorDPI/ImageScaling/ImageDpiHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static class ImageDpiHelper
1616
/// <returns>image URL for the most appropriate scale, given DPI</returns>
1717
public static string GetDesiredImageUrlForDpi(Image image)
1818
{
19-
DpiScaleInfo imageScaleInfo = VisualTreeHelper.GetDpi(image);
19+
DpiScale imageScaleInfo = VisualTreeHelper.GetDpi(image);
2020
int bestScale = ImageDpiHelper.GetBestScale(imageScaleInfo.PixelsPerDip);
2121

2222
var sourceUrl = image.Source.ToString();

Diff for: ‎PerMonitorDPI/TextFormatting/MainWindow.xaml.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public MainWindow()
2727
InitializeComponent();
2828
}
2929

30-
protected override void OnDpiChanged(DpiScaleInfo oldDpiScaleInfo, DpiScaleInfo newDpiScaleInfo)
30+
protected override void OnDpiChanged(DpiScale oldDpiScale, DpiScale newDpiScale)
3131
{
32-
_pixelsPerDip = newDpiScaleInfo.PixelsPerDip;
32+
_pixelsPerDip = newDpiScale.PixelsPerDip;
3333
UpdateFormattedText(_pixelsPerDip);
3434
}
3535

0 commit comments

Comments
 (0)
Please sign in to comment.