コード例 #1
0
        public void Can_Insert_Configuration()
        {
            IConfiguracaoRepository repository = new ConfiguracaoRepository();

            repository.Add(new Configuracao
            {
                ClienteFormularioMostrarFiltros = true,
                ClienteFormularioSalvarAutomaticamenteAoSair   = true,
                ClienteFormularioSalvarArquivoEnquandoCadastra = true,
                ClienteFormularioLocalArquivoEnquantoCadastra  = "apppath\arquivo.ext",

                Sys_DataCadastro    = DateTime.Today,
                Sys_DataModificado  = DateTime.Today,
                Sys_Ativo           = true,
                Sys_Ativo_Descricao = ""
            });
        }
コード例 #2
0
 public ConfiguracaoServiceRepository(IConfiguration configuration)
 {
     configRepository = new ConfiguracaoRepository(configuration);
 }
コード例 #3
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (e.Kind == ActivationKind.Launch)
            {
                if (ApplicationData.Current.LocalSettings.Values.ContainsKey(Constantes.CONFIG_KEY_EXECUCOES))
                {
                    var qtde = 1;
                    if (int.TryParse(ApplicationData.Current.LocalSettings.Values[Constantes.CONFIG_KEY_EXECUCOES].ToString(), out qtde))
                    {
                        if (qtde != -1)
                        {
                            qtde++;
                            ApplicationData.Current.LocalSettings.Values[Constantes.CONFIG_KEY_EXECUCOES] = qtde;
                        }
                    }
                    else
                    {
                        ApplicationData.Current.LocalSettings.Values[Constantes.CONFIG_KEY_EXECUCOES] = 1;
                    }
                }
                else
                {
                    ApplicationData.Current.LocalSettings.Values.Add(Constantes.CONFIG_KEY_EXECUCOES, 1);
                }
            }
            //Efetua a verificação da licença do usuário (remover ADS)
            VerificarLicensa();

            var dataService = new DataService();

            if (e.PreviousExecutionState == ApplicationExecutionState.NotRunning)
            {
                var resourceLoader = new ResourceLoader();

                //var dataService = new DataService();
                await dataService.InicializarBaseDeDados(
                    resourceLoader.GetString("CriarLancamentoPageTagsReceitas").Split(new char[] { ',' }),
                    resourceLoader.GetString("CriarLancamentoPageTagsDespesas").Split(new char[] { ',' }),
                    resourceLoader.GetString("CriarLancamentoPageFormasPagamento").Split(new char[] { ',' }),
                    VERSAO
                    );
            }
            var _configurationRepository = new ConfiguracaoRepository(dataService);

            //Verifica se foi configurado uma senha para o aplicativo
            if (_configurationRepository != null)
            {
                PIN = await _configurationRepository.ObterValor("senha");

                if (!String.IsNullOrWhiteSpace(PIN))
                {
                    App.LoginConfigurado = true;
                }
            }


            var shell = Window.Current.Content as AppShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                // Create a Shell which navigates to the first page
                shell = new AppShell(e.PreviousExecutionState);

                // hook-up shell root frame navigation events
                shell.AppFrame.NavigationFailed += OnNavigationFailed;
                shell.AppFrame.Navigated        += OnNavigated;
                //shell.AppFrame.Navigating += OnNavigating;



                // set the Shell as content
                Window.Current.Content = shell;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    if (ApplicationData.Current.LocalSettings.Values.ContainsKey("NavigationState"))
                    {
                        //Pega a pagina via Expressão Regular
                        //DinDinPro.Universal.Views.\w+
                        shell.AppFrame.SetNavigationState((string)ApplicationData.Current.LocalSettings.Values["NavigationState"]);
                    }
                }

                // listen for back button clicks (both soft- and hardware)
                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

                if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
                {
                    HardwareButtons.BackPressed += OnBackPressed;
                }

                UpdateBackButtonVisibility();
            }

            DispatcherHelper.Initialize();
            // Ensure the current window is active
            Window.Current.Activate();
        }