public BaseViewModel() { LoadedCommand = new RxCommand(); Title = new Observable <string>(); Title.Subscribe(x => { SecurityCode = x; }); }
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(); } }); }
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>(); }
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; }); }