コード例 #1
0
        public void UpdateToken(Token paramRefreshToken)
        {
            try
            {
                if (paramRefreshToken != null)
                {
                    TokenRealm _tokenRealm = new TokenRealm();
                    _tokenRealm.Id           = 1;
                    _tokenRealm.Access_Token = paramRefreshToken.Access_token;
                    _tokenRealm.UrlLogo      = paramRefreshToken.UrlLogo;
                    _tokenRealm.LstFuncao    = paramRefreshToken.LstFuncao;
                    _tokenRealm.NomeCliente  = paramRefreshToken.NomeCliente;
                    _tokenRealm.NomeUsuario  = paramRefreshToken.NomeUsuario;
                    _tokenRealm.IdAplicativo = paramRefreshToken.Aplicativo.IdAplicativo;

                    TokenDataStore store = new TokenDataStore();
                    store.CreateUpadate(_tokenRealm);
                    RefazPaginaLista();

                    Token _token = new Token();
                    _token.TransformFromRealm(_tokenRealm);
                    _app.Token = _token;
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #2
0
        public SplashPersonalizado()
        {
            InitializeComponent();

            try
            {
                imageLogo.SetBinding(Image.SourceProperty, "SplashImage");

                if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS)
                {
                    imageLogo.HeightRequest = (_app.ScreenHeight / 100) * 13;
                    imageLogo.IsVisible     = false;
                }


                Task.Delay(7000);

                _viewModel          = new ViewModelSplash();
                this.BindingContext = _viewModel;


                TokenDataStore store = new TokenDataStore();
                _token = store.Get(1);

                if (_token != null)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Application.Current.MainPage.Navigation.PushAsync(new ViewPainel());
                    });
                }
                else if (_token != null && _token.IdAplicativo == 0)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Application.Current.MainPage.Navigation.PushAsync(new ViewLogin(_app.isPersonalizado, _app.nameProject));
                    });
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Application.Current.MainPage.Navigation.PushAsync(new ViewLogin(_app.isPersonalizado, _app.nameProject));
                    });
                }
            }
            catch (Exception)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Application.Current.MainPage.Navigation.PushAsync(new ViewLogin(_app.isPersonalizado, _app.nameProject));
                });
            }
        }
コード例 #3
0
ファイル: Token.cs プロジェクト: alexandregois/SSXTracking
        public void TransformFromRealm(TokenRealm paramToken)
        {
            Access_token            = paramToken.Access_Token;
            LstFuncao               = paramToken.LstFuncao;
            Aplicativo              = new AplicativoDto();
            Aplicativo.IdAplicativo = paramToken.IdAplicativo;
            UrlLogo = paramToken.UrlLogo;

            IdAplicativo = paramToken.IdAplicativo;
            UrlLogo      = paramToken.UrlLogo;
        }
コード例 #4
0
        private void ConfiguraChamadaPadrao()
        {
            TokenRealm _token = _tokenDataStore.Get(1);

            if (_token != null)
            {
                client.DefaultRequestHeaders.Authorization =
                    new AuthenticationHeaderValue("Basic",
                                                  _token.Access_Token);
            }

            client.DefaultRequestHeaders.IfModifiedSince = DateTime.Now;
        }
コード例 #5
0
        public async Task Atualiza_PushKey(
            String paramPushKey
            , CancellationToken paramToken
            )
        {
            try
            {
                TokenDataStore store  = new TokenDataStore();
                TokenRealm     _token = store.Get(1);


                ServiceResult <Boolean> result = await DataStore.Atualiza_PushKey(
                    _token.IdAplicativo //_app.Token.Aplicativo.IdAplicativo
                    , paramPushKey
                    , paramToken
                    );
            }
            catch (Exception) { }
        }
コード例 #6
0
        public ViewModelPainel()
        {
            DefaultTemplateBuild();
            this.ViewDetalhesCommand       = new Command(this.ViewDetalhes);
            this.ListPainel_RefreshCommand = new Command(this.ListPainelRefresh);

            _refreshTime = App.Configuracao.RefreshTime;
            _tokensource = new CancellationTokenSource();


            TokenDataStore store  = new TokenDataStore();
            TokenRealm     _token = store.Get(1);


            if (_token == null)
            {
                _navigationService.NavigateToLogin();

                Device.BeginInvokeOnMainThread(() =>
                {
                    Application.Current.MainPage.Navigation.PushAsync(new ViewLogin(_app.isPersonalizado, _app.nameProject));
                });
            }
        }
コード例 #7
0
        public override void DefaultTemplateBuild()
        {
            TokenDataStore store  = new TokenDataStore();
            TokenRealm     _token = store.Get(1);

            if (_token == null)
            {
                _messageService.ShowAlertAsync(
                    AppResources.LoginNaoEncontrado
                    , AppResources.Erro
                    );
                _navigationService.NavigateToLogin();
            }
            else
            {
                Button foto = VoltarButtonDefault();
                foto.Image        = "ic_placeholder_foto.png";
                foto.WidthRequest = 50;
                foto.Command      = new Command(ImageLogout);
                BoxLeftContent    = foto;

                StackLayout stackTopo = new StackLayout()
                {
                    Orientation     = StackOrientation.Vertical,
                    HeightRequest   = _app.DefaultTemplateHeightNavegationBar,
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    Margin          = 0,
                    Spacing         = 0
                };

                Label labelTitulo = PanelTituloLabel_Titulo();
                labelTitulo.Text = _token.NomeUsuario;

                Label labelSubTitulo = PanelTituloLabel_SubTitulo();
                labelSubTitulo.Text = _token.NomeCliente;

                labelTitulo.HeightRequest         = labelSubTitulo.HeightRequest;
                labelTitulo.VerticalTextAlignment = TextAlignment.End;

                stackTopo.Children.Add(labelTitulo);
                stackTopo.Children.Add(labelSubTitulo);

                BoxMiddleContent = stackTopo;


                Button refreshButton = new Button()
                {
                    Image           = "ic_refresh.png",
                    HeightRequest   = _app.DefaultTemplateHeightNavegationBar,
                    WidthRequest    = 18,
                    Margin          = new Thickness(5, 0),
                    BorderRadius    = 0,
                    BorderWidth     = 0,
                    BorderColor     = Color.Transparent,
                    BackgroundColor = Color.Transparent,
                    Command         = new Command(Refresh)
                };

                refreshButton.SetBinding(
                    Button.IsEnabledProperty
                    , new TemplateBinding("Parent.BindingContext.RefreshButtonIsEnabled")
                    );

                BoxRightContent = refreshButton;
            }
        }