Created
August 17, 2020 12:55
-
-
Save Alvarocda/f351ab36d14ef2b8d4815e700e192f2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StackLayout stkContainer = new StackLayout | |
{ | |
MinimumHeightRequest = 90, | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
Orientation = StackOrientation.Horizontal, | |
TabIndex = index, | |
StyleId = "stkContainer" + index | |
}; | |
StackLayout stkIconeArquivo = new StackLayout | |
{ | |
WidthRequest = 85, | |
HeightRequest = 85 | |
}; | |
Image iconeArquivo = new Image | |
{ | |
WidthRequest = 80, | |
HeightRequest = 80 | |
}; | |
if (arquivo.UrlDownload.Contains(".pdf")) | |
{ | |
iconeArquivo.Source = "pdf80.png"; | |
} | |
else if (arquivo.UrlDownload.Contains(".doc") || arquivo.UrlDownload.Contains(".docx")) | |
{ | |
iconeArquivo.Source = "doc80.png"; | |
} | |
else | |
{ | |
iconeArquivo.Source = "file80.png"; | |
} | |
Grid GridBotoes = new Grid | |
{ | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
}; | |
ColumnDefinition coluna1 = new ColumnDefinition(); | |
ColumnDefinition coluna2 = new ColumnDefinition(); | |
RowDefinition linha1 = new RowDefinition | |
{ | |
Height = 40 | |
}; | |
GridBotoes.ColumnDefinitions.Add(coluna1); | |
GridBotoes.ColumnDefinitions.Add(coluna2); | |
GridBotoes.RowDefinitions.Add(linha1); | |
StackLayout stkInformacoesArquivo = new StackLayout | |
{ | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
Orientation = StackOrientation.Vertical, | |
TabIndex = index, | |
StyleId = "stkInformacoesArquivo" + index | |
}; | |
stkInformacoesArquivo.StyleId = "stkInformacoesArquivo" + index; | |
StackLayout stkBotoes = new StackLayout | |
{ | |
Orientation = StackOrientation.Horizontal, | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
Margin = new Thickness(0, -7, 0, 0), | |
HeightRequest = 50 | |
}; | |
Label lblNomeArquivo = new Label | |
{ | |
Text = arquivo.NomeArquivoOriginal, | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
LineBreakMode = LineBreakMode.TailTruncation | |
}; | |
Label lblTipoArquivo = new Label | |
{ | |
Text = arquivo.NomeTipoDocumento, | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
LineBreakMode = LineBreakMode.TailTruncation, | |
Margin = new Thickness(0, -7, 0, 0) | |
}; | |
Button btnApagar = new Button | |
{ | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
TabIndex = index, | |
BackgroundColor = Color.Red, | |
TextColor = Color.White, | |
IsEnabled = false, | |
Text = "Apagar", | |
HeightRequest = 35 | |
}; | |
btnApagar.SetBinding(Button.CommandProperty, new Binding("ApagaArquivo", 0)); | |
btnApagar.CommandParameter = arquivo; | |
Button btnDownload = new Button | |
{ | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
TabIndex = index, | |
HeightRequest = 25 | |
}; | |
if (arquivo.JaBaixou) | |
{ | |
btnDownload.Text = "Abrir"; | |
btnDownload.BackgroundColor = Color.FromHex("#4C912C"); | |
btnDownload.TextColor = Color.White; | |
btnDownload.SetBinding(Button.CommandProperty, new Binding("AbreArquivo", 0)); | |
btnDownload.CommandParameter = arquivo; | |
btnApagar.IsEnabled = true; | |
} | |
else | |
{ | |
btnDownload.Text = "Baixar"; | |
btnDownload.BackgroundColor = Color.FromHex("#1B1F5F"); | |
btnDownload.TextColor = Color.White; | |
btnDownload.SetBinding(Button.CommandProperty, new Binding("BaixaArquivo", 0)); | |
btnDownload.CommandParameter = arquivo; | |
} | |
Grid.SetColumn(btnDownload, 0); | |
Grid.SetColumn(btnApagar, 1); | |
GridBotoes.Children.Add(btnDownload); | |
GridBotoes.Children.Add(btnApagar); | |
stkBotoes.Children.Add(GridBotoes); | |
stkInformacoesArquivo.Children.Add(lblNomeArquivo); | |
stkInformacoesArquivo.Children.Add(lblTipoArquivo); | |
stkInformacoesArquivo.Children.Add(stkBotoes); | |
stkIconeArquivo.Children.Add(iconeArquivo); | |
stkContainer.Children.Add(stkIconeArquivo); | |
stkContainer.Children.Add(stkInformacoesArquivo); | |
BoxView linhaSeparadora = new BoxView | |
{ | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
BackgroundColor = Color.Black, | |
Color = Color.Black, | |
HeightRequest = 1 | |
}; | |
stkArquivosRecebidos.Children.Add(stkContainer); | |
stkArquivosRecebidos.Children.Add(linhaSeparadora); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment