Skip to content

Commit

Permalink
[WorkingWithImages] fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustam Zaitov committed Mar 25, 2015
1 parent 635d987 commit d5b9db2
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 57 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions WorkingWithImages/WorkingWithImages/DownloadImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ public DownloadImages() {
// CacheValidity = new TimeSpan(5,0,0,0)
// };

Content = new StackLayout
{
Children = {
new Label {Text = "ImageSource.FromUri", Font=Font.BoldSystemFontOfSize(NamedSize.Medium)},
webImage,
new Label {Text = "example-app.png gets downloaded from xamarin.com"}
},
Padding = new Thickness(0, 20, 0, 0),
VerticalOptions = LayoutOptions.StartAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
Content = new StackLayout {
Children = {
new Label {
Text = "ImageSource.FromUri",
FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold
},
webImage,
new Label { Text = "example-app.png gets downloaded from xamarin.com" }
},
Padding = new Thickness (0, 20, 0, 0),
VerticalOptions = LayoutOptions.StartAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
}
}
}
39 changes: 21 additions & 18 deletions WorkingWithImages/WorkingWithImages/EmbeddedImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,34 @@

namespace WorkingWithImages
{
public class EmbeddedImages : ContentPage
{
public EmbeddedImages()
{
public class EmbeddedImages : ContentPage
{
public EmbeddedImages ()
{
var embeddedImage = new Image { Aspect = Aspect.AspectFit };

// resource identifiers start with assembly-name DOT filename
embeddedImage.Source = ImageSource.FromResource("WorkingWithImages.beach.jpg");

Content = new StackLayout
{
Children = {
new Label {Text = "ImageSource.FromResource", Font=Font.BoldSystemFontOfSize(NamedSize.Medium)},
embeddedImage.Source = ImageSource.FromResource ("WorkingWithImages.beach.jpg");

Content = new StackLayout {
Children = {
new Label {
Text = "ImageSource.FromResource",
FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold
},
embeddedImage,
new Label {Text = "WorkingWithImages.beach.jpg embedded resource"}
},
Padding = new Thickness(0, 20, 0, 0),
VerticalOptions = LayoutOptions.StartAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
new Label { Text = "WorkingWithImages.beach.jpg embedded resource" }
},
Padding = new Thickness (0, 20, 0, 0),
VerticalOptions = LayoutOptions.StartAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};

// NOTE: use for debugging, not in released app code!
//var assembly = typeof(EmbeddedImages).GetTypeInfo().Assembly;
//foreach (var res in assembly.GetManifestResourceNames())
// System.Diagnostics.Debug.WriteLine("found resource: " + res);
}
}
}
}
}
40 changes: 22 additions & 18 deletions WorkingWithImages/WorkingWithImages/LocalImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@

namespace WorkingWithImages
{
public class LocalImages : ContentPage
{
public LocalImages() {

var beachImage = new Image { WidthRequest=300, HeightRequest=300 };
beachImage.Source = ImageSource.FromFile("waterfront.jpg");
public class LocalImages : ContentPage
{
public LocalImages ()
{
var beachImage = new Image { WidthRequest = 300, HeightRequest = 300 };
beachImage.Source = ImageSource.FromFile ("waterfront.jpg");
beachImage.Aspect = Aspect.AspectFit;

Content = new StackLayout{
Children = {
new Label {Text = "ImageSource.FromFile", Font=Font.BoldSystemFontOfSize(NamedSize.Medium)},
beachImage,
new Label {Text = "waterfront.jpg has been added each application project: iOS, Android and Windows Phone. On iOS and Android multiple resolutions are supplied and resolved at runtime."}
},
Padding = new Thickness(0, 20, 0, 0),
VerticalOptions = LayoutOptions.StartAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
}
}
Content = new StackLayout {
Children = {
new Label {
Text = "ImageSource.FromFile",
FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold
},
beachImage,
new Label { Text = "waterfront.jpg has been added each application project: iOS, Android and Windows Phone. On iOS and Android multiple resolutions are supplied and resolved at runtime." }
},
Padding = new Thickness (0, 20, 0, 0),
VerticalOptions = LayoutOptions.StartAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
}
}
}

0 comments on commit d5b9db2

Please sign in to comment.