示例#1
0
        private void LoginWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            Task.Factory.StartNew(() =>
            {
                var repositorio = ContainerIoc.GetInstance <RepositorioBase>();
                repositorio.LimparLogDaBase();

                InstanceManager.ListaDeTipoPagamentos = repositorio.RecuperarTodos <TipoPagamento>();
                InstanceManager.Parametros            = ContainerIoc.GetInstance <Parametros>();
                InstanceManager.Logger.Info("Login Loaded.....");
            });
        }
示例#2
0
        private async void btnEntrar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.StartWait();
                if (txtUsuario.Text.Length == 0 || txtSenha.Password.Length == 0)
                {
                    return;
                }
                var login = txtUsuario.Text;
                var senha = txtSenha.Password;
                var task  = Task.Factory.StartNew(() =>
                {
                    InstanceManager.UsuarioCorrente = ContainerIoc.GetInstance <Usuario>();
                    InstanceManager.UsuarioCorrente.LogarUsuario(login, senha);
                });

                await task;

                if (InstanceManager.UsuarioCorrente.Status == EnumStatusDoResultado.MensagemDeSucesso)
                {
                    ContainerIoc.containerIoc.Configure(ioc =>
                    {
                        ioc.ForConcreteType <Caixa>().Configure.Ctor <string>("nomeDoCaixa").Is("NomeDoCaixa".GetConfigValue()).Ctor <Entity.Usuario>().Is(InstanceManager.UsuarioCorrente.UsuarioLogado);
                    });

                    InstanceManager.ListaDeProdutosDoPdv = ContainerIoc.GetInstance <Produto>().RecuperarListaDeProdutosDoPdvPoTipo(RdoTp2.IsChecked.Value ? 2 : 1);

                    UIManager <TelaPrincipal> .Show();

                    Close();
                }
                else
                {
                    MessageBox.Show(InstanceManager.UsuarioCorrente.Mensagem, InstanceManager.Parametros.TituloDasMensagens, MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                InstanceManager.Logger.Error(ex);
                MessageBox.Show(ex.Message, InstanceManager.Parametros.TituloDasMensagens, MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                this.StopWait();
            }
        }
示例#3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            InstanceManager.Logger = ContainerIoc.GetInstance <IInfraLogger>().Log();
            log4net.Config.XmlConfigurator.Configure();
            ContainerIoc.SetDefaultConstructorParameter <Caixa, string>("nomeDoCaixa".GetConfigValue(), "nomeDoCaixa");
            // Select the text in a TextBox when it receives focus.
            EventManager.RegisterClassHandler(typeof(TextBox), TextBox.PreviewMouseLeftButtonDownEvent,
                                              new MouseButtonEventHandler(SelectivelyIgnoreMouseButton));
            EventManager.RegisterClassHandler(typeof(TextBox), TextBox.GotKeyboardFocusEvent,
                                              new RoutedEventHandler(SelectAllText));
            EventManager.RegisterClassHandler(typeof(TextBox), TextBox.MouseDoubleClickEvent,
                                              new RoutedEventHandler(SelectAllText));

            InstanceManager.Cupom = ContainerIoc.GetInstance <Cupom>();

            CultureInfo culture = new CultureInfo(ConfigurationManager.AppSettings["Cultura"]);

            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

            base.OnStartup(e);
        }