public async Task EnviarComandoCancelar(ComandoLog paramComando, Boolean paramEnvia ) { ModelComando _modelComandos = new ModelComando(); _tokensource = new CancellationTokenSource(); if (!_tokensource.IsCancellationRequested) { ServiceResult <Boolean> comando = new ServiceResult <Boolean>(); try { if (paramEnvia) { comando = await _modelComandos.ComandoCancelar( paramComando.IdComandoLog , _tokensource.Token ); } } catch { comando.MessageError = "Exception"; } finally { await _messageService.ShowAlertAsync(AppResources.CancelarComandoSucesso); } } }
private async void ListComandos_ItemTapped( object sender , ItemTappedEventArgs e ) { ComandoLog paramComando = (ComandoLog)e.Item; if (paramComando != null) { ComandosCellTapp temp = new ComandosCellTapp( paramComando , PainelDetalhes ); } }
protected override void OnBindingContextChanged() { try { base.OnBindingContextChanged(); ComandoLog comandos = (ComandoLog)BindingContext; if (comandos != null) { //Stack Principal Grid boxPrincipal = this.BuildCell(comandos); View = boxPrincipal; } } catch { } }
public ComandosCellTapp( ComandoLog paramComando , CustomDialogAlert paramPainelDetalhes ) { _painelDetalhes = paramPainelDetalhes; Color corTitulo = Color.Black; Color corTexto = Color.FromHex("#9b9eb0"); Thickness marginBottom = new Thickness(0, 0, 0, 15); StackLayout boxPrincipal = new StackLayout(); StackLayout boxDados = new StackLayout { Margin = 0, Padding = 0, Spacing = 0 }; #region Comando Label labelComando = new Label() { Text = paramComando.IdentificacaoComando, TextColor = corTitulo, FontAttributes = FontAttributes.Bold, FontSize = 15, Margin = 0, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelComando); #endregion #region UnidadeRastreada if (!String.IsNullOrWhiteSpace(paramComando.UnidadeRastreada)) { Label labelUnidadeRastreada = new Label() { Text = paramComando.IdentificacaoUnidadeRastreada, TextColor = corTexto, FontSize = 15, Margin = marginBottom, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelUnidadeRastreada); } #endregion #region StatusComando if (!String.IsNullOrWhiteSpace(paramComando.StatusComando)) { Label labelStatus = new Label() { Text = paramComando.StatusComando, TextColor = corTexto, FontSize = 15, FontAttributes = FontAttributes.Bold, Margin = marginBottom, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelStatus); } #endregion #region DataEnvio if (paramComando.DataEnvio != null) { Label labelTituloDataEnvio = new Label() { Text = AppResources.DataEnvio, TextColor = corTitulo, FontAttributes = FontAttributes.Bold, FontSize = 14, Margin = 0, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelTituloDataEnvio); Label labelDataEnvio = new Label() { Text = String.Format( "{0:dd/MM/yyyy HH:mm:ss}" , paramComando.DataEnvio.Value.ToLocalTime() ), TextColor = corTexto, FontSize = 14, Margin = marginBottom, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelDataEnvio); } #endregion #region DataFila Label labelTituloDataFila = new Label() { Text = AppResources.DataFila, TextColor = corTitulo, FontAttributes = FontAttributes.Bold, FontSize = 14, Margin = 0, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelTituloDataFila); Label labelDataFila = new Label() { Text = String.Format( "{0:dd/MM/yyyy HH:mm:ss}" , paramComando.DataFila.ToLocalTime() ), TextColor = corTexto, FontSize = 14, Margin = marginBottom, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelDataFila); #endregion #region DataFinalizacao Processamento if (paramComando.DataFinalizacao != null) { Label labelTituloDataProcessamento = new Label() { Text = AppResources.DataProcessamento, TextColor = corTitulo, FontAttributes = FontAttributes.Bold, FontSize = 14, Margin = 0, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelTituloDataProcessamento); Label labelDataProcessamento = new Label() { Text = String.Format( "{0:dd/MM/yyyy HH:mm:ss}" , paramComando.DataFinalizacao.Value.ToLocalTime() ), TextColor = corTexto, FontSize = 14, Margin = marginBottom, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelDataProcessamento); } #endregion #region CriadoPor if (paramComando.UsuarioEnvio != null) { Label labelTituloCriadoPor = new Label() { Text = AppResources.CriadoPor, TextColor = corTitulo, FontAttributes = FontAttributes.Bold, FontSize = 14, Margin = 0, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelTituloCriadoPor); Label labelCriadoPor = new Label() { Text = paramComando.UsuarioEnvio, TextColor = corTexto, FontSize = 14, Margin = marginBottom, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxDados.Children.Add(labelCriadoPor); } #endregion ScrollView scroll = new ScrollView { Content = boxDados }; #region Botao Fechar //StackLayout boxFechar = new StackLayout(); //boxFechar.HeightRequest = 30; //boxFechar.Orientation = StackOrientation.Horizontal; //boxFechar.VerticalOptions = LayoutOptions.End; //boxFechar.HorizontalOptions = LayoutOptions.End; Button botaoFecharDetalhes = new Button { Text = AppResources.Fechar, HorizontalOptions = LayoutOptions.End, BackgroundColor = Color.Transparent, TextColor = Color.Black, HeightRequest = 30 }; botaoFecharDetalhes.Clicked += BotaoFecharDetalhes_OnButtonClicked; //boxFechar.Children.Add(botaoFecharDetalhes); #endregion Frame activity = _painelDetalhes.RequireFramePadrao(); scroll.HeightRequest = (_app.DefaultTemplateHeightContent * 0.8) - botaoFecharDetalhes.HeightRequest; boxPrincipal.Children.Add(scroll); boxPrincipal.Children.Add(botaoFecharDetalhes); activity.Content = boxPrincipal; Device.BeginInvokeOnMainThread(() => { _painelDetalhes.ShowAlert(activity); }); }
public Grid BuildCell( ComandoLog paramComando , View paramView = null ) { try { Double margin = 10; #region Grid Grid boxPrincipal = new Grid(); //TODO: Remover boxPrincipal.WidthRequest = _app.ScreenWidth; boxPrincipal.ColumnSpacing = 0; boxPrincipal.RowSpacing = 0; boxPrincipal.VerticalOptions = LayoutOptions.FillAndExpand; boxPrincipal.ColumnDefinitions = new ColumnDefinitionCollection(); ColumnDefinition col01 = new ColumnDefinition() { Width = 37 }; ColumnDefinition col02 = new ColumnDefinition() { Width = GridLength.Star }; //boxPrincipal.ColumnDefinitions.Add(col01); boxPrincipal.ColumnDefinitions.Add(col02); boxPrincipal.RowDefinitions = new RowDefinitionCollection(); boxPrincipal.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star }); #endregion #region Texto StackLayout boxTexto = new StackLayout() { Margin = new Thickness(margin), Spacing = 0, Padding = 0, Orientation = StackOrientation.Vertical, WidthRequest = col02.Width.Value, VerticalOptions = LayoutOptions.Center }; Label labelComando = new Label() { Text = paramComando.IdentificacaoComando, TextColor = Color.Black, FontAttributes = FontAttributes.Bold, FontSize = 15, Margin = new Thickness(0, 0, 0, 2), LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxTexto.Children.Add(labelComando); Label labelDataEvento = new Label() { Text = String.Format( "{0:dd/MM/yyyy HH:mm:ss}" , paramComando.DataFila.ToLocalTime() ), TextColor = Color.FromHex("#9b9eb0"), FontSize = 14, Margin = labelComando.Margin, LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; if (!String.IsNullOrWhiteSpace(paramComando.StatusComando)) { labelDataEvento.Text += " - " + paramComando.StatusComando; } boxTexto.Children.Add(labelDataEvento); if (!String.IsNullOrWhiteSpace(paramComando.UnidadeRastreada)) { Label labelUnidadeRastreada = new Label() { Text = paramComando.IdentificacaoUnidadeRastreada, TextColor = Color.Black, FontSize = 14, Margin = new Thickness(0), LineBreakMode = LineBreakMode.TailTruncation, HorizontalTextAlignment = TextAlignment.Start }; boxTexto.Children.Add(labelUnidadeRastreada); } boxPrincipal.Children.Add(boxTexto, 0, 0); boxPrincipal.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(BoxPrincipal_Tap), CommandParameter = paramComando, NumberOfTapsRequired = 1 }); #endregion return(boxPrincipal); } catch { throw; } }
private async void BoxPrincipal_Tap(object obj) { String answer; ComandoLog paramComando = (ComandoLog)obj; List <String> respostas = new List <String> { AppResources.DetalhesComando }; if (paramComando.Status == 1 || paramComando.Status == 3) { respostas.Add(AppResources.CancelarComando); } answer = await this._messageService.ShowMessageAsync( paramComando.IdentificacaoComando , AppResources.cancelar , null , respostas.ToArray() ); if (answer == AppResources.CancelarComando) { Boolean confirm = await this._messageService.ShowAlertChooseAsync( AppResources.CancelarComandoConfirma , AppResources.cancelar , AppResources.Ok , null); if (confirm == true) { await _viewHistoricoComando.EnviarComandoCancelar(paramComando, true); } } if (answer == AppResources.DetalhesComando) { //String strDetalhes = "<strong>" + AppResources.Status + "</strong>" + "\n" + paramComando.StatusComando + // "\n" + // "\n" + // "<strong>" + AppResources.DataFila + "</strong>" + "\n" + String.Format("{0:dd/MM/yyyy HH:mm:ss}", paramComando.DataFila.ToLocalTime()) + // "\n" + // "\n" + // "<strong>" + AppResources.CriadoPor + "</strong>" + "\n" + paramComando.ClienteEnvio + // "\n" + // "\n"; String strDetalhes = paramComando.IdentificacaoComando + "\n" + "\n" + "\n" + AppResources.Status + ":" + "\n" + paramComando.StatusComando + "\n" + "\n" + AppResources.DataFila + ":" + "\n" + String.Format("{0:dd/MM/yyyy HH:mm:ss}", paramComando.DataFila.ToLocalTime()) + "\n" + "\n" + AppResources.CriadoPor + ":" + "\n" + paramComando.ClienteEnvio + "\n" + "\n"; List <String> detalhes = new List <String> { AppResources.Status + "\n" + paramComando.StatusComando, "\n", "\n", AppResources.DataFila + "\n" + String.Format("{0:dd/MM/yyyy HH:mm:ss}", paramComando.DataFila.ToLocalTime()), "\n", "\n", AppResources.CriadoPor + "\n" + paramComando.ClienteEnvio }; Boolean confirmComandoCancelar = false; if (paramComando.Status == 1 || paramComando.Status == 3) { confirmComandoCancelar = await this._messageService.ShowAlertChooseAsync( strDetalhes , AppResources.Fechar , AppResources.CancelarComando , null); } else { await this._messageService.ShowAlertChooseAsync( strDetalhes , AppResources.Fechar , " " , null); } if (confirmComandoCancelar == true) { await _viewHistoricoComando.EnviarComandoCancelar(paramComando, true); } } }