public MainViewModel() { SelectFirstItemCommand = new perRelayCommand(() => SelectedItem = Items.First()); SelectLastItemCommand = new perRelayCommand(() => SelectedItem = Items.Last()); Items = Enumerable.Range(1, 1000).Select(i => $"Item {i}").ToArray(); }
public MainViewModel() { _repository = new DataItemRepository(); DataItemsCollection = new perAsyncProperty <IReadOnlyCollection <DataItemViewModel> >(() => _repository.LoadData()); ResetImagesCommand = new perRelayCommand(OnResetImages); }
public MainViewModel(INavigationService navigationService) { _navigationService = navigationService; AllDataItems = Enumerable.Range(1, 20).Select(i => new DataItem(i, "Data Item " + i)).ToList(); ShowDataItemCommand = new perRelayCommand(OnShowDataItem, () => SelectedDataItem != null) .ObservesInternalProperty(this, nameof(SelectedDataItem)); }
public MainViewModel() { SetReadOnlyPropCommand = new perRelayCommand(OnSetReadOnlyProp); AddDataItemCommand = new perRelayCommand(OnAddDataItem); DeleteDataItemCommand = new perRelayCommand <DataItemViewModel>(OnDeleteDataItem); for (var i = 1; i <= 10; i++) { OnAddDataItem(); } }
public AllDepartmentsViewModel(IStaffManagerNavigationService navigationService, IStaffManagerDataService dataService) { _navigationService = navigationService; _dataService = dataService; Caption = "All Departments"; SetLazyLoadingMode(); ViewDepartmentCommand = new perRelayCommand(OnViewDepartment, () => SelectedDepartment != null) .ObservesInternalProperty(this, nameof(SelectedDepartment)); AddNewDepartmentCommand = new perRelayCommand(OnAddNewDepartment); }
public DepartmentViewModel(IStaffManagerNavigationService navigationService, IStaffManagerDataService dataService) { _dataService = dataService; _navigationService = navigationService; // creates a expansion toggle button in lazy loading mode SetLazyLoadingMode(); ViewPersonCommand = new perRelayCommand(OnViewPerson, () => SelectedPerson != null) .ObservesInternalProperty(this, nameof(SelectedPerson)); AddNewPersonCommand = new perRelayCommand(OnAddNewPerson); }
public MainViewModel(IStaffManagerDataService dataService) { _dataService = dataService; LoadDataCommand = new perRelayCommandAsync(OnLoadData); AddPersonCommand = new perRelayCommand(OnAddPerson); DeletePersonCommand = new perRelayCommand(OnDeletePerson, () => SelectedPersonVm != null) .ObservesInternalProperty(this, nameof(SelectedPersonVm)); ListSelectedPeopleCommand = new perRelayCommand(OnListSelectedPeople, () => _personVmList.Any()) .ObservesCollection(_personVmList); _departmentVmList.CollectionChanged += (s, e) => RaisePropertyChanged(nameof(DepartmentVmsForCombo)); }
public MainViewModel() { StartTasksCommand = new perRelayCommandAsync(OnStartTasks); CancelCommand = new perRelayCommand(() => _cancellationTokenSource?.Cancel(), ()=>StartTasksCommand.IsExecuting) .ObservesInternalProperty(StartTasksCommand, nameof(StartTasksCommand.IsExecuting)); var allTimeouts = new List<perValueDisplayPair<TimeSpan>> { perTimeSpanHelper.Forever.CreateValueDisplayPair("None") }; allTimeouts.AddRange(Enumerable.Range(1, 20) .Select(i => TimeSpan.FromSeconds(i).CreateValueDisplayPair($"{i} second{(i > 1 ? "s" : "")}"))); AllTimeouts = allTimeouts; SelectedTimeout = allTimeouts.First().Value; }
public MainViewModel(IStaffManagerDataService dataService, IStaffManagerNavigationService navigationService) { _dataService = dataService; _navigationService = navigationService; LoadDataCommand = new perRelayCommandAsync(RefreshDataAsync); perMessageService.RegisterMessageHandler <SelectItemMessage>(this, msg => SelectedItem = msg.SelectedItem); SelectPreviousSearchCommand = new perRelayCommand(OnSelectPreviousSearch, () => _peopleMatchingSearchCollection.Count > 1) .ObservesCollection(_peopleMatchingSearchCollection); SelectNextSearchCommand = new perRelayCommand(OnSelectNextSearch, () => _peopleMatchingSearchCollection.Count > 1) .ObservesCollection(_peopleMatchingSearchCollection); EditSelectedItemCommand = new perRelayCommand(OnEditSelectedItem, () => SelectedItem is smViewModelBase) .ObservesInternalProperty(this, nameof(SelectedItem)); }
public MainViewModel() { TimerTick(); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(0.1) }; timer.Tick += (s, e) => TimerTick(); timer.Start(); ForceGarbageCollectCommand = new perRelayCommand(OnForceGarbageCollect); CreateBlankChildWindowCommand = new perRelayCommand(OnCreateBlankChildWindow); BadCreateChildWindowWithTimeCommand = new perRelayCommand(OnBadCreateChildWindowWithTime); GoodCreateChildWindowWithTimeCommand = new perRelayCommand(OnGoodCreateChildWindowWithTime); ClearWeakListenersCommand = new perRelayCommand(OnClearWeakListeners); }
public MainViewModel() { var rootNode = new perTreeViewItemViewModelBase { Caption = "Root Node" }; _rootItems.Add(rootNode); for (var i = 1; i <= ItemCount; i++) { var child1 = new perTreeViewItemViewModelBase { Caption = "Item " + i }; rootNode.AddChild(child1); for (var j = 1; j <= ItemCount; j++) { var child2 = new perTreeViewItemViewModelBase { Caption = child1.Caption + "." + j }; child1.AddChild(child2); for (var k = 1; k <= ItemCount; k++) { var child3 = new perTreeViewItemViewModelBase { Caption = child2.Caption + "." + k }; child2.AddChild(child3); for (var l = 1; l <= ItemCount; l++) { var child4 = new perTreeViewItemViewModelBase { Caption = child3.Caption + "." + l }; child3.AddChild(child4); } } } } SelectItemCommand = new perRelayCommand(OnSelectItem); }
public MainViewModel() { LoadedCommand = new perRelayCommand(OnLoaded); InitialiseSelectedItemCommand = new perRelayCommand(OnInitialiseSelectedItem); }
public MainViewModel() { LoadedCommand = new perRelayCommand(OnLoaded); }
public DataItemViewModel(DataItem model) { Model = model; CloseViewCommand = new perRelayCommand(() => ViewClosed = true); }
public perHslColorPicker() { _colorButtonCommand = new perRelayCommand <perHsla>(OnColorButton); CopyToClipboardCommand = new perRelayCommand(() => Clipboard.SetText(SelectedColor.AsHex8)); }
public perDialog() { ButtonClickCommand = new perRelayCommand <perDialogButton>(OnButtonClick); InitializeComponent(); }