Exemplo n.º 1
0
        public BaseViewModel()
        {
            LoadedCommand = new RxCommand();

            Title = new Observable <string>();

            Title.Subscribe(x =>
            {
                SecurityCode = x;
            });
        }
Exemplo n.º 2
0
        public PagedCollection(IList <T> list)
        {
            MoveNextCommand     = new RxCommand();
            MovePreviousCommand = new RxCommand();
            MoveFirstCommand    = new RxCommand();
            MoveLastCommand     = new RxCommand();

            CurrentPage     = new Observable <int>(1);
            ItemsPerPage    = new Observable <int>(20);
            CanMoveNext     = new Observable <bool>(false);
            CanMovePrevious = new Observable <bool>(false);
            WholeList       = new List <T>(list);
            double pageCount = Math.Ceiling((double)WholeList.Count / (double)ItemsPerPage.Value);

            TotalPageCount = new Observable <int>(Convert.ToInt32(pageCount));

            LoadCurrentPage();

            MoveNextCommand.Subscribe(x =>
            {
                if (CanMoveNext.Value)
                {
                    CurrentPage.Value++;
                    LoadCurrentPage();
                }
            });

            MovePreviousCommand.Subscribe(x =>
            {
                if (CanMovePrevious.Value)
                {
                    CurrentPage.Value--;
                    LoadCurrentPage();
                }
            });

            MoveFirstCommand.Subscribe(x =>
            {
                if (CanMovePrevious.Value)
                {
                    CurrentPage.Value = 1;
                    LoadCurrentPage();
                }
            });

            MoveLastCommand.Subscribe(x =>
            {
                if (CanMoveNext.Value)
                {
                    CurrentPage.Value = TotalPageCount.Value;
                    LoadCurrentPage();
                }
            });
        }
Exemplo n.º 3
0
        public BaseControlViewModel(IWindsorContainer container, IControl view, string title)
        {
            ControlLoadedCommand = new RxCommand();

            View        = new Observable <IControl>();
            Title.Value = title;

            Container              = container;
            View.Value             = view;
            View.Value.DataContext = this;
            Title.Value            = title;

            WindowViewModel = new Observable <IWindowViewModel>();
        }
Exemplo n.º 4
0
        public BaseWindowViewModel(IWindsorContainer container, IWindow window, ISecurityChecker securityChecker /*, IControlViewModel securityFailedControlViewModel*/)
        {
            //SecurityFailedControlViewModel = securityFailedControlViewModel;
            SecurityChecker          = securityChecker;
            Window                   = new Observable <IWindow>();
            IsEnabled                = new Observable <bool>(true);
            Window.Value             = window;
            Window.Value.DataContext = this;
            Container                = container;
            CurrentControlViewModel  = new Observable <IControlViewModel>();
            ClosingCommand           = new RxCommand();
            CanClose                 = new Observable <bool>(true);

            IsEnabled.Subscribe(x =>
            {
                Window.Value.IsEnabled = x;
            });
        }