Exemple #1
0
        public UserControlMenuItem(ItemMenu itemMenu, PrincipalView context)
        {
            InitializeComponent();

            _context = context;

            ExpanderMenu.Visibility     = itemMenu.SubItems == null ? Visibility.Collapsed : Visibility.Visible;
            ListViewItemMenu.Visibility = itemMenu.SubItems == null ? Visibility.Visible : Visibility.Collapsed;

            this.DataContext = itemMenu;
        }
Exemple #2
0
        public void Login()
        {
            PrincipalView p = new PrincipalView();

            if (this.txtUser.Text == "Admin" && this.txtPassword.Password == "1234")
            {
                p.Show();
                this.Hide();
            }
            else
            {
                this.Dialog.IsOpen = true;
            }
        }
Exemple #3
0
        public App()
        {
            InitializeComponent();
            Current = this;
            var isLoggedIn = Properties.ContainsKey("IsLoggedIn") ? (bool)Properties["IsLoggedIn"] : false;

            if (isLoggedIn)
            {
                MainPage = new PrincipalView();
            }
            else
            {
                MainPage = new Login(this);
            }
        }
        public VentanaPrincipal(VentanaPrincipalViewModel viewModel, AutenticacionPorUsuario autenticacion, IProveedorExtensionMenuView proveedorExtensionMenuView)
        {
            DataContext = ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
            InitializeComponent();

            var autenticacionView = new IniciarSesionView(autenticacion);
            var extensionesView   = new PrincipalView(
                ViewModel.Cargar.Select(a => a.Obtener <IExtensionMenu>().ToArray()),
                proveedorExtensionMenuView,
                ViewModel);

            PanelPrincipal.Children.Add(autenticacionView);
            var navegador = new NavegadorViewsPrincipales(this, PanelPrincipal);

            Activated += (s, a) => autenticacionView.DoFocus();

            (this).WhenActivated(d =>
            {
                (this).WhenAnyObservable(v => v.ViewModel.Autenticacion.Autenticar)
                .SelectMany(c => Observable.Return(c).Delay(TimeSpan.FromSeconds(3.8)))
                .ObserveOnDispatcher()
                .Subscribe(s => Fade.In.Apply(PanelCarga))
                .DisposeWith(d);

                (this).WhenAnyObservable(v => v.ViewModel.Cargar)
                .SelectMany(c => Observable.Return(c).Delay(TimeSpan.FromSeconds(1)))
                .ObserveOnDispatcher()
                .Subscribe(u =>
                           Fade.Out
                           .Create(PanelCarga)
                           .Then(() => navegador.IrA(extensionesView))
                           .BeginIn(PanelCarga))
                .DisposeWith(d);

                this.OneWayBind(ViewModel, vm => vm.BackNavigation.IsEnabled, v => v.PanelBotonAtras.Visibility, BoolToVisibility.Convert)
                .DisposeWith(d);

                this.BindCommand(ViewModel, vm => vm.BackNavigation.Execute, v => v.BotonAtras)
                .DisposeWith(d);
            });
        }
Exemple #5
0
 static void Main(string[] args)
 {
     PrincipalView.doRun();
 }
Exemple #6
0
 public void ShowMainPage()
 {
     MainPage = new PrincipalView();
 }
        public App()
        {
            InitializeComponent();

            MainPage = new PrincipalView();
        }
        private void autentificacion()
        {
            Error     = string.Empty;
            BandError = false;
            //SSP.Servidor.GlobalVariables.gUser = GlobalVar.gUsr = User.Username;
            SSP.Servidor.GlobalVariables.gUser = GlobalVar.gUsr = "******";
            SSP.Servidor.GlobalVariables.gPass = GlobalVar.gPass = "******";
            User.Password = "******";
            if (string.IsNullOrWhiteSpace(user.NombreCompleto))
            {
                user.NombreCompleto = "Salvador Ruiz Guevara";
            }

            if (string.IsNullOrEmpty(User.Username) ? false : string.IsNullOrEmpty(User.Password) ? false : true)
            {
                if (User.Username.Equals(User.Username) && User.Password.Equals("12345"))
                {
                    if (User.Username.Equals("ADMINALIMENTACION"))
                    {
                        User.Almacen_Grupo = "A";
                        user.CENTRO        = null;
                        User.ROL           = "ADMINISTRADOR CENTRAL";
                    }

                    if (User.Username.Equals("ADMINMEDICAMENTOS"))
                    {
                        User.Almacen_Grupo = "M";
                        user.CENTRO        = null;
                        User.ROL           = "ADMINISTRADOR CENTRAL";
                    }

                    if (User.Username.Equals("ADMINMEXICALI"))
                    {
                        User.Almacen_Grupo = "";
                        user.CENTRO        = 4;
                        User.ROL           = "ADMINISTRADOR DE CENTRO";
                    }
                    if (User.Username.Equals("ADMINTIJUANA"))
                    {
                        User.Almacen_Grupo = "";
                        user.CENTRO        = 2;
                        User.ROL           = "ADMINISTRADOR DE CENTRO";
                    }
                    if (User.Username.Equals("ADMINENSENADA"))
                    {
                        User.Almacen_Grupo = "";
                        user.CENTRO        = 5;
                        User.ROL           = "ADMINISTRADOR DE CENTRO";
                    }
                    if (User.Username.Equals("adminAP"))
                    {
                        User.Almacen_Grupo = "A";
                        User.ROL           = "ALMACENISTA";
                    }

                    if (User.Username.Equals("adminUA"))
                    {
                        User.Almacen_Grupo = "A";
                        user.ROL           = "ALMACENISTA";
                    }

                    if (User.Username.Equals("adminAlim"))
                    {
                        User.Almacen_Grupo = "A";
                        user.ROL           = "ALMACENISTA";
                    }

                    if (User.Username.Equals("adminMed"))
                    {
                        User.Almacen_Grupo = "M";
                        user.ROL           = "ALMACENISTA";
                    }

                    Application.Current.MainWindow.Hide();

                    var _view      = new PrincipalView();
                    var _viewModel = new PrincipalViewModel(User, DialogCoordinator.Instance);
                    _view.DataContext = _viewModel;


                    Application.Current.MainWindow.Close();

                    var metro = Application.Current.Windows[0] as MahApps.Metro.Controls.MetroWindow;


                    //Tenemos que cambiar esto a una dependencia

                    //((ContentControl)metro.FindName("contentControl")).Content = new BandejaEntradaView();
                    //((ContentControl)metro.FindName("contentControl")).DataContext = new BandejaEntradaViewModel();


                    Splasher.Splash = new GESAL.Views.Login.SplashScreen();
                    Splasher.ShowSplash();

                    for (int i = 0; i < 1500; i++)
                    {
                        if (i < 500)
                        {
                            MessageListener.Instance.ReceiveMessage("Revisando Disco Duro");
                            Thread.Sleep(1);
                            continue;
                        }
                        if (i < 1000)
                        {
                            MessageListener.Instance.ReceiveMessage("Verificando Credenciales");
                            Thread.Sleep(1);
                            continue;
                        }
                        if (i < 1500)
                        {
                            MessageListener.Instance.ReceiveMessage("Esperando Validación");
                            Thread.Sleep(1);
                            continue;
                        }
                    }


                    Splasher.CloseSplash();
                    _view.Show();
                }
                else
                {
                    Error     = "El usuario o la contraseña son incorrectos";
                    BandError = true;
                }
            }
            else
            {
                Error     = "Favor de capturar usuario y contraseña";
                BandError = true;
            }
        }