Ejemplo n.º 1
0
        public MainViewModel()
        {
            SelectFirstItemCommand = new perRelayCommand(() => SelectedItem = Items.First());
            SelectLastItemCommand  = new perRelayCommand(() => SelectedItem = Items.Last());

            Items = Enumerable.Range(1, 1000).Select(i => $"Item {i}").ToArray();
        }
Ejemplo n.º 2
0
        public MainViewModel()
        {
            _repository = new DataItemRepository();

            DataItemsCollection = new perAsyncProperty <IReadOnlyCollection <DataItemViewModel> >(() => _repository.LoadData());

            ResetImagesCommand = new perRelayCommand(OnResetImages);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        public MainViewModel()
        {
            SetReadOnlyPropCommand = new perRelayCommand(OnSetReadOnlyProp);
            AddDataItemCommand     = new perRelayCommand(OnAddDataItem);
            DeleteDataItemCommand  = new perRelayCommand <DataItemViewModel>(OnDeleteDataItem);

            for (var i = 1; i <= 10; i++)
            {
                OnAddDataItem();
            }
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
 public MainViewModel()
 {
     LoadedCommand = new perRelayCommand(OnLoaded);
     InitialiseSelectedItemCommand = new perRelayCommand(OnInitialiseSelectedItem);
 }
Ejemplo n.º 13
0
 public MainViewModel()
 {
     LoadedCommand = new perRelayCommand(OnLoaded);
 }
Ejemplo n.º 14
0
 public DataItemViewModel(DataItem model)
 {
     Model            = model;
     CloseViewCommand = new perRelayCommand(() => ViewClosed = true);
 }
Ejemplo n.º 15
0
 public perHslColorPicker()
 {
     _colorButtonCommand    = new perRelayCommand <perHsla>(OnColorButton);
     CopyToClipboardCommand = new perRelayCommand(() => Clipboard.SetText(SelectedColor.AsHex8));
 }
Ejemplo n.º 16
0
 public perDialog()
 {
     ButtonClickCommand = new perRelayCommand <perDialogButton>(OnButtonClick);
     InitializeComponent();
 }