示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //ResetSplashCreated = new ManualResetEvent(false);

            //// Create a new thread for the splash screen to run on
            //SplashThread = new Thread(ShowSplash);
            //SplashThread.SetApartmentState(ApartmentState.STA);
            //SplashThread.IsBackground = true;
            //SplashThread.Name = "Splash Screen";
            //SplashThread.Start();

            //// Wait for the blocker to be signaled before continuing. This is essentially the same as: while(ResetSplashCreated.NotSet) {}
            //ResetSplashCreated.WaitOne();
            //var initType = ConfigurationManager.AppSettings["initDbType"];
            //if (Settings.Default.Lix == null)
            //{
            //    new RequisicaoLicencaView().ShowDialog();
            //    if (Settings.Default.Lix == null)
            //    {
            //        Process.GetCurrentProcess().Kill();
            //    }
            //Settings.Default.Lix = new LicencaConcedida(); // Apagar após o fim dos testes do serviço

            //if (!Services.SuporteClient.LicenceActivated(Settings.Default.Lix.Codigo))
            //{
            //    Services.SuporteClient.Log("Cliente:" + Settings.Default.Lix.Documento
            //        + "\nErro ao carregar aplicação.\n Código do erro: x0:001\n");
            //}
            //}
            //else
            //{

            //}
            var initType = ConfigurationManager.AppSettings["initDbType"];

            //DataBaseManager.CnnStr = ConfigurationManager.AppSettings["cnnDeploy"];
            if (!string.IsNullOrEmpty(initType))
            {
                switch (initType)
                {
                case "init":
                    DataBaseManager.InitDb();
                    break;

                case "update":
                    DataBaseManager.UpdateDb();
                    break;
                }
            }

            Configuracao = ConfiguracaoGeralRepository.GetById(1);
            Ncms         = new ObservableCollection <Ncm>(NcmRepository.GetList());
            Csts         = new ObservableCollection <Cst>(CstRepository.GetList());
            CstCofins    = new ObservableCollection <CstCofins>(CstCofinsRepository.GetList());
            CstIpi       = new ObservableCollection <CstIpi>(CstIpiRepository.GetList());
            CstPis       = new ObservableCollection <CstPis>(CstPisRepository.GetList());
            Cfops        = new ObservableCollection <Cfop>(CfopRepository.GetList());
            base.OnStartup(e);
            //SplashThread.Interrupt();
        }
示例#2
0
 public override void Salvar()
 {
     ConfiguracaoGeralRepository.Save(Entity);
 }