Esempio n. 1
0
 private void FrmLogin_Load(object sender, EventArgs e)
 {
     conLogin = ObjectoUserSetings.Default;
     if (conLogin.Estado)
     {
         checkEdit11.EditValue = (bool)conLogin.Estado;
         txtUserName.Text      = conLogin.Nome;
         txtPassword.Text      = conLogin.Senha;
         btnEntrar.Focus();
     }
 }
Esempio n. 2
0
 private void FrmLogin_FormClosed(object sender, FormClosedEventArgs e)
 {
     conLogin = ObjectoUserSetings.Default;
     if (!string.IsNullOrWhiteSpace(txtUserName.Text) && !string.IsNullOrWhiteSpace(txtPassword.Text))
     {
         conLogin.Estado = (bool)checkEdit11.EditValue;
         conLogin.Nome   = txtUserName.Text;
         conLogin.Senha  = txtPassword.Text;
         conLogin.Save();
     }
 }
Esempio n. 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException          += new ThreadExceptionEventHandler(ErrorThread);
            Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("pt-BR");
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt-BR");

            // Leitura de Temas e Paletas
            BonusSkins.Register();
            SkinManager.EnableFormSkins();
            var objectoUserSetings = new ObjectoUserSetings();

            UserLookAndFeel.Default.SetSkinStyle(
                objectoUserSetings.DefaultAppSkin,
                objectoUserSetings.DefaultPalette);

            WindowsFormsSettings.TouchUIMode      = objectoUserSetings.TouchUI == true ? TouchUIMode.True : TouchUIMode.False;
            WindowsFormsSettings.DefaultFont      = objectoUserSetings.DefaultAppFont;
            WindowsFormsSettings.DefaultPrintFont = objectoUserSetings.DefaultAppFont;
            var licenceResult = false;

            // Acessar e verificar a Base de dados
            using (var frm = new frmSplash(new ILicence()))
            {
                frm.Show();

                // Licença
                licenceResult = frm.LecencaOk;
                Task.Run(async() => { await new BibliotecaContextData(new BiblioteContext()).Seed(); }).Wait();
            }
            if (licenceResult)
            {
                Application.Run(new frmLogin(new UserRepository(new BiblioteContext())));
            }
            else
            {
                XtraMessageBox.Show("Lamentamos Muito mais o seu Software ainda não foi Registado\nFaçau agora!...\n"
                                    , "Licença requerida",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                Application.Exit();
                Application.Run(new frmRegistar(new KeyGenRepository(new BiblioteContext())));
            }
        }
        public MenuDesign(PermissoesModels permissoesModels,
                          IlogModels logsRepository)
        {
            InitializeComponent();
            this.permissoesModels = permissoesModels;
            this.logsRepository   = logsRepository;
            Program.menuDesign    = this;
            objectoUserSetings    = new ObjectoUserSetings();


            #region Time
            Time_         = new Timer();
            Time_.Enabled = true;
            Time_.Start();
            Time_.Tick += delegate { barStaticItem2.Caption = $"{DateTime.Now:F}"; };

            // Sistema/Usuarios
            btnUsuariosConsultas.Click += delegate { OpenForms(new frmUsuarios(new UserRepository(new BiblioteContext()))); };
            btnUsuariosAuditoria.Click += delegate { OpenForms(new frmLogs(new LogsRepository(new BiblioteContext()))); };
            btnGrupos.Click            += delegate { OpenForms(new frmGrupos(new GruposRepository(new BiblioteContext()))); };
            btnPermissoes.Click        += delegate { OpenFormsDialog.ShowForm(this, null, new frmPermisssoesAdd(new PermissoesRepository(new BiblioteContext()))); };

            // Biblioteca
            btnLivros.Click  += delegate { OpenForms(new frmLivros(new LivrosRepository(new BiblioteContext()))); };
            btnAutores.Click += delegate { OpenForms(new frmAutor(new AutorRepositoty(new BiblioteContext()))); };
            btnEditora.Click += delegate { OpenForms(new frmEditora(new EditoraRepository(new BiblioteContext()))); };
            btnPais.Click    += delegate { OpenForms(new frmPais(new PaisRepository(new BiblioteContext()))); };

            // Estudantes
            btnAlunoConsultas.Click       += delegate { OpenForms(new frmAlunos(new AlunoRepository(new BiblioteContext()))); };
            btnInstituicaoConsultas.Click += delegate { OpenForms(new frmInstituicao(new InstituicaoRepository(new BiblioteContext()))); };
            btnClasseConsultas.Click      += delegate { OpenForms(new frmClasse(new ClasseRepository(new BiblioteContext()))); };
            btnturmaConsultas.Click       += delegate { OpenForms(new frmTurma(new TurmaRepository(new BiblioteContext()))); };

            //Toos
            btnTatil.CheckedChanged += delegate {
                WindowsFormsSettings.TouchUIMode   = btnTatil.Checked == true ? TouchUIMode.True : TouchUIMode.False;
                ObjectoUserSetings.Default.TouchUI = btnTatil.Checked;
                ObjectoUserSetings.Default.Save();
            };
            //Requisições
            StocksConsultas.Click += delegate { OpenForms(new frmStocks(new StocksModelsRepository(new BiblioteContext()))); };
            StocksRegistar.Click  += delegate {
                OpenFormsDialog.ShowForm(this, null, new frmStocksAdd(null, new StocksModelsRepository(new BiblioteContext()),
                                                                      new LivrosRepository(new BiblioteContext())));
            };
            RequisicoesLeitura.Click += delegate {
                OpenFormsDialog.ShowForm(this, null,
                                         new frmPedidosRequisicoesAdd(new PedidosRepository(new BiblioteContext()),
                                                                      new AlunoRepository(new BiblioteContext()),
                                                                      new StocksModelsRepository(new BiblioteContext())));
            };
            RequisicoesPedidos.Click += delegate { OpenForms(new frmPedidosRequisicoes(new PedidosRepository(new BiblioteContext()))); };

            AplicarPermissoes();
            FormsThemeReader();
            SetStatuBar();
            this.FormClosed     += MenuDesign_FormClosed;
            btnDefinicoes.Click += delegate { OpenFormsDialog.ShowForm(this, null, new frmDefinicoesAdd(new DefinicoesRepository(new BiblioteContext()))); };
            //tabbedView1.DocumentClosed += TabbedView1_DocumentClosed;

            tabbedView1.AddDocument(new frmBackground());
        }