本文整理汇总了C#中IImage.LoadFromUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IImage.LoadFromUrl方法的具体用法?C# IImage.LoadFromUrl怎么用?C# IImage.LoadFromUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IImage
的用法示例。
在下文中一共展示了IImage.LoadFromUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public override void Start()
{
base.Start();
IStack stack = Platform.Current.Create<IStack>();
ILabel lblLabel = Platform.Current.Create<ILabel>();
lblLabel.Text = "View an image from Url";
lblLabel.Height = 30;
stack.Children.Add(lblLabel);
IImageButton imgbtn = Platform.Current.Create<IImageButton>();
imgbtn.LoadFromUrl(new Uri("http://okhosting.com/wp-content/uploads/2016/02/okhosting-150x150.png"));
imgbtn.Height = 100;
imgbtn.Width = 100;
imgbtn.Click += CmdViewImage_Click;
stack.Children.Add(imgbtn);
imgPicture = Platform.Current.Create<IImage>();
imgPicture.LoadFromUrl(new Uri("http://www.patycantu.com/wp-content/uploads/2014/07/91.jpg"));
imgPicture.Height = 250;
imgPicture.Width = 600;
imgPicture.Visible = false;
stack.Children.Add(imgPicture);
IButton cmdClose = Platform.Current.Create<IButton>();
cmdClose.Text = "Close";
cmdClose.Click += CmdClose_Click;
stack.Children.Add(cmdClose);
Platform.Current.Page.Title = "Test label";
Platform.Current.Page.Content = stack;
}
示例2: Start
/// <summary>
/// Start this instance.
/// <para xml:lang="es">
/// Inicia una instancia de este objeto.
/// </para>
/// </summary>
public override void Start()
{
base.Start();
// Create an RelativePanel.
IRelativePanel panel = Platform.Current.Create<IRelativePanel>();
//should be a background image
BackgroundImage = Platform.Current.Create<IImage>();
BackgroundImage.LoadFromUrl(new Uri("http://okhosting.com/resources/uploads/2015/09/diseno-de-paginas-responsivas.png"));
BackgroundImage.Width = Platform.Current.Page.Width;
BackgroundImage.Height = Platform.Current.Page.Height;
panel.Add(BackgroundImage, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith);
//Create the Label lblLabel with text, fontcolor, backgroundcolor and margin specific.
ILabel lblLabel = Platform.Current.Create<ILabel>();
lblLabel.Text = "This label is centered";
lblLabel.FontColor = new Color(255, 0, 0, 255);
lblLabel.BackgroundColor = new Color(255, 255, 0, 0);
lblLabel.Margin = new Thickness(20);
panel.Add(lblLabel, RelativePanelHorizontalContraint.CenterWith, RelativePanelVerticalContraint.CenterWith);
//Create the Label lblLabel2 with text, Fontcolor, backgroundcolor and margin specific.
ILabel lblLabel2 = Platform.Current.Create<ILabel>();
lblLabel2.Text = "This label is centered and below the first one";
lblLabel2.FontColor = new Color(255, 0, 0, 255);
lblLabel2.BackgroundColor = new Color(255, 0, 255, 0);
lblLabel2.Margin = new Thickness(10);
panel.Add(lblLabel2, RelativePanelHorizontalContraint.CenterWith, RelativePanelVerticalContraint.BelowOf, lblLabel);
//Creates the Button cmdClose with text, fontcolor, backgroundcolor and margin specific, with the event also click and adds it to the stack.
IButton cmdClose = Platform.Current.Create<IButton>();
cmdClose.Text = "Close";
cmdClose.Click += CmdClose_Click;
cmdClose.FontColor = new Color(255, 0, 0, 0);
cmdClose.BackgroundColor = new Color(255, 0, 255, 255);
cmdClose.Margin = new Thickness(10);
panel.Add(cmdClose, RelativePanelHorizontalContraint.RightOf, RelativePanelVerticalContraint.AboveOf, lblLabel);
// Establishes the content and title of the page.
Platform.Current.Page.Title = "Test RelativePanel";
Platform.Current.Page.Content = panel;
}
示例3: Start
public override void Start()
{
base.Start();
Current = this;
IRelativePanel panel = Platform.Current.Create<IRelativePanel>();
panel.BackgroundColor = new Color(255, 255, 255, 255);
AudioPlayer = Core.BaitAndSwitch.Create<IAudioPlayer>(new string[] { "Xamarin.Android", "Xamarin.iOS" });
IGrid grdMenu = Constantes.CrearMenuVacio();
panel.Add(grdMenu, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith);
IImageButton imgHome = Platform.Current.Create<IImageButton>();
imgHome.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon2--15.png"));
grdMenu.SetContent(1, 0, imgHome);
IImageButton imgRegionales = Platform.Current.Create<IImageButton>();
imgRegionales.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-11.png"));
imgRegionales.Click += (object sender, EventArgs e) => new RegionalesController().Start();
grdMenu.SetContent(1, 1, imgRegionales);
IImageButton imgProgramas = Platform.Current.Create<IImageButton>();
imgProgramas.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-07.png"));
imgProgramas.Click += (object sender, EventArgs e) => new ProgramasController().Start();
grdMenu.SetContent(1, 2, imgProgramas);
IImageButton imgVirtuales = Platform.Current.Create<IImageButton>();
imgVirtuales.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-09.png"));
imgVirtuales.Click += (object sender, EventArgs e) => new VirtualesController().Start();
grdMenu.SetContent(1, 3, imgVirtuales);
ILabel lblTitulo = Constantes.CrearTitulo("Radio Universidad De Guadalajara", new Color(255, 255, 212, 79));
panel.Add(lblTitulo, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, grdMenu);
if (Platform.Current.Page.Width > 250)
{
IImage imgLogo = Platform.Current.Create<IImage>();
imgLogo.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon2--14.png"));
imgLogo.Width = Platform.Current.Page.Width / 6;
imgLogo.Height = lblTitulo.Height;
imgLogo.Margin = new Thickness(0, 0, 10, 0);
panel.Add(imgLogo, RelativePanelHorizontalContraint.RightWith, RelativePanelVerticalContraint.TopWith, lblTitulo);
}
IImage imgAntena = Platform.Current.Create<IImage>();
imgAntena.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images-old/icon-22.png"));
imgAntena.Width = Platform.Current.Page.Width * .1;
imgAntena.Margin = new Thickness(10, 0, 10, 20);
panel.Add(imgAntena, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblTitulo);
ILabel lblAlAire = Platform.Current.Create<ILabel>();
lblAlAire.Text = "Estas escuchando:";
lblAlAire.Bold = true;
lblAlAire.FontSize = Constantes.FontSize2;
lblAlAire.FontFamily = Constantes.FontFamily;
lblAlAire.FontColor = Constantes.FontColor2;
panel.Add(lblAlAire, RelativePanelHorizontalContraint.RightWith, RelativePanelVerticalContraint.TopWith, imgAntena);
var estacionDefault = RegionalesController.LeerEstaciones().First();
AudioPlayer.Stop();
AudioPlayer.Source = estacionDefault.StramingUri;
IGrid grdReproductor = Platform.Current.Create<IGrid>();
grdReproductor.RowCount = 1;
grdReproductor.ColumnCount = 4;
grdReproductor.Width = Platform.Current.Page.Width - 20;
grdReproductor.BackgroundColor = new Color(60, 255, 255, 255);
panel.Add(grdReproductor, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, imgAntena);
imgLogoPrograma = Platform.Current.Create<IImage>();
imgLogoPrograma.LoadFromUrl(estacionDefault.WebSiteUri);
imgLogoPrograma.Width = Constantes.AnchoIconos;
imgLogoPrograma.Height = Constantes.AnchoIconos;
imgLogoPrograma.Margin = new Thickness(0, 0, 10, 0);
panel.Add(imgLogoPrograma, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith, grdReproductor);
lblNombre = Platform.Current.Create<ILabel>();
lblNombre.Text = estacionDefault.Name;
lblNombre.FontColor = Constantes.FontColor2;
lblNombre.FontFamily = Constantes.FontFamily;
lblNombre.FontSize = Constantes.FontSize2;
lblNombre.Bold = true;
lblNombre.Width = Platform.Current.Page.Width - (Constantes.AnchoIconos * 3) + 10;
panel.Add(lblNombre, RelativePanelHorizontalContraint.RightOf, RelativePanelVerticalContraint.TopWith, imgLogoPrograma);
lblDescripcion = Platform.Current.Create<ILabel>();
lblDescripcion.Text = estacionDefault.Description;
lblDescripcion.FontColor = Constantes.FontColor3;
lblDescripcion.FontFamily = Constantes.FontFamily;
lblDescripcion.FontSize = Constantes.FontSize3;
lblDescripcion.Margin = new Thickness(0, 5, 0, 0);
lblDescripcion.Width = lblNombre.Width;
panel.Add(lblDescripcion, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblNombre);
cmdPlay = Platform.Current.Create<IImageButton>();
cmdPlay.LoadFromUrl(new Uri("http://radioudg.okhosting.com/images/app-54.png"));
cmdPlay.Click += Play_Click;
cmdPlay.Width = Constantes.AnchoIconos;
//.........这里部分代码省略.........
示例4: Start
public override void Start()
{
base.Start();
IRelativePanel panel = Platform.Current.CreateControl<IRelativePanel>();
BackgroundImage = Platform.Current.CreateControl<IImage>();
BackgroundImage.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon2--47.png"));
BackgroundImage.Width = Platform.Current.Page.Width;
BackgroundImage.Height = Platform.Current.Page.Height;
panel.Add(BackgroundImage, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith);
ILabelButton cmdProgramas = Platform.Current.CreateControl<ILabelButton>();
cmdProgramas.Text = "Programas";
cmdProgramas.FontSize = 13;
cmdProgramas.Width = 80;
cmdProgramas.Height = 35;
cmdProgramas.Click += (object sender, EventArgs e) => new Programas().Start();
panel.Add(cmdProgramas, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith);
ILabelButton Regionales = Platform.Current.CreateControl<ILabelButton>();
Regionales.Text = "Regionales";
Regionales.FontSize = 13;
Regionales.Width = 80;
Regionales.Height = 35;
panel.Add(Regionales, RelativePanelHorizontalContraint.CenterWith, RelativePanelVerticalContraint.TopWith);
ILabelButton Virtuales = Platform.Current.CreateControl<ILabelButton>();
Virtuales.Text = "Virtual";
Virtuales.FontSize = 13;
Virtuales.Width = 80;
Virtuales.Height = 35;
panel.Add(Virtuales, RelativePanelHorizontalContraint.RightWith, RelativePanelVerticalContraint.TopWith);
ILabel lblLabel = Platform.Current.CreateControl<ILabel>();
lblLabel.Text = "Radio Universidad De Guadalajara";
lblLabel.Width = 240;
lblLabel.Height = 20;
lblLabel.FontColor = new Color(1, 0, 0, 255);
lblLabel.BackgroundColor = new Color(1, 255, 0, 255);
panel.Add(lblLabel, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, cmdProgramas);
ILabel lblLabels = Platform.Current.CreateControl<ILabel>();
lblLabels.Text = "";
lblLabels.Height = 20;
lblLabels.Width = 20;
panel.Add(lblLabels, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel);
ILabel lblLabel2 = Platform.Current.CreateControl<ILabel>();
lblLabel2.Text = "AHORA AL AIRE";
lblLabel2.FontColor = new Color(1, 255, 0, 255);
panel.Add(lblLabel2, RelativePanelHorizontalContraint.CenterWith, RelativePanelVerticalContraint.BelowOf, lblLabels);
play = Platform.Current.CreateControl<IImageButton>();
play.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon-28.png"));
play.Click += Play_Click;
play.Width = 80;
play.Height = 35;
panel.Add(play, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel2);
pause = Platform.Current.CreateControl<IImageButton>();
pause.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon-04.png"));
pause.Click += Pause_Click;
pause.Width = 80;
pause.Height = 35;
panel.Add(pause, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, play);
stop = Platform.Current.CreateControl<IImageButton>();
stop.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon-15.png"));
stop.Click += Stop_Click;
stop.Width = 80;
stop.Height = 35;
panel.Add(stop, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, pause);
ILabel lblLabel3 = Platform.Current.CreateControl<ILabel>();
lblLabel3.Text = "NOTAS DE EL ACORDEON";
lblLabel3.FontColor = new Color(1, 255, 0, 255);
panel.Add(lblLabel3, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, stop);
ILabel lblTexto = Platform.Current.CreateControl<ILabel>();
lblTexto.Text = "Hoy estamos hablando de las palabras que usamos que provienen del árabe. Llama a cabina y dinos cules conoces. Entras a la rifa de boletos de Radaid";
lblTexto.BorderColor = new Color(1, 255, 255, 255);
lblTexto.BorderWidth = new Thickness(9, 9, 9, 9);
panel.Add(lblTexto, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel3);
ILabel lblLabel4 = Platform.Current.CreateControl<ILabel>();
lblLabel4.Text = "ENVIA UN MENSAJE A EL ACORDEON";
lblLabel4.FontSize = 11;
lblLabel4.FontColor = new Color(1, 255, 0, 255);
panel.Add(lblLabel4, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblTexto);
ITextArea txtAreaComentario = Platform.Current.CreateControl<ITextArea>();
txtAreaComentario.Value = "";
txtAreaComentario.FontSize = 12;
txtAreaComentario.FontColor = new Color(1, 0, 0, 255);
txtAreaComentario.BackgroundColor = new Color(1, 255, 255, 255);
txtAreaComentario.Width = 210;
txtAreaComentario.Height = 80;
panel.Add(txtAreaComentario, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel4);
//.........这里部分代码省略.........