コード例 #1
0
ファイル: MenuExtensiones.cs プロジェクト: ggzor/AguaSB-N
        public MenuExtensiones(IReadOnlyCollection <IExtensionMenu> extensiones, IProveedorExtensionMenuView proveedorExtensionMenuView)
        {
            Extensiones = extensiones ?? throw new ArgumentNullException(nameof(extensiones));
            ProveedorExtensionMenuView = proveedorExtensionMenuView ?? throw new ArgumentNullException(nameof(proveedorExtensionMenuView));

            ExtensionesViews      = Extensiones.Select(proveedorExtensionMenuView.Para).ToArray();
            ExtensionSeleccionada = ExtensionesViews.Select(e => e.Seleccionada.Select(s => (e.Extension, s))).Merge();
        }
コード例 #2
0
        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);
            });
        }
コード例 #3
0
ファイル: PrincipalView.xaml.cs プロジェクト: ggzor/AguaSB-N
        public PrincipalView(IObservable <IReadOnlyCollection <IExtensionMenu> > extensiones, IProveedorExtensionMenuView proveedorExtensionMenuView,
                             IControladorVentanaPrincipal controladorVentanaPrincipal)
        {
            InitializeComponent();
            extensiones.Subscribe(c =>
            {
                var menuExtensiones = new MenuExtensiones(c, proveedorExtensionMenuView);
                MenuPrincipal       = new MenuPrincipalView(menuExtensiones);

                if (Panel.Children.Contains(MenuPrincipal))
                {
                    Panel.Children.Remove(MenuPrincipal);
                }

                var navegador = new NavegadorViews(Panel);
                navegador.Adelante(MenuPrincipal, null);

                controladorVentanaPrincipal.BackNavigation.Executed.Subscribe(u =>
                {
                    navegador.Atras(MenuPrincipal, null);
                    controladorVentanaPrincipal.BackNavigation.IsEnabled = false;
                });

                menuExtensiones.ExtensionSeleccionada
                .Subscribe(t =>
                {
                    controladorVentanaPrincipal.BackNavigation.IsEnabled = true;
                    navegador.Adelante(t.Extension.View, t.Parametro);
                });
            });
        }