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));
                });
            }
        }
示例#2
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) { }
        }
示例#3
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));
                });
            }
        }
示例#4
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;
            }
        }