示例#1
0
 public ModifyableItemsOnlyLocator(IEnumerable <T> modifyableItems, IEnumerable <IIdProvider> selectedItems, Func <object, object> convertFromIIdProviderToT)
 {
     _modifyableItems = new List <T>(modifyableItems ?? new T[0]);
     _currentItems    = new List <IIdProvider>();
     selectedItems.ForEach(item => SelectedItems.Add(item));
     _synchronizer = new CSharpToolkit.XAML.Behaviors.TwoListSynchronizer(_modifyableItems, _currentItems, new CSharpToolkit.XAML.Behaviors.CallbackListItemConverter(null, convertFromIIdProviderToT));
     _synchronizer.StartSynchronizing();
 }
        /// <summary>
        /// Instantiates <see cref="ModifyableFindViewModel{TDataGridSource, TDataCollector, TModifyable}"/>.
        /// </summary>
        /// <param name="validator">The validator used.</param>
        /// <param name="dataCollectorInitializer">A function which initializes the <see cref="DataCollector"/>.</param>
        public ModifyableFindViewModel(IValidate <string> validator, Func <TDataCollector> dataCollectorInitializer) : base(validator, dataCollectorInitializer)
        {
            var modifyableItems = new ObservableCollection <TModifyable>();

            ModifyableItems = modifyableItems;

            _synchronizer = new CSharpToolkit.XAML.Behaviors.TwoListSynchronizer(ItemsFound, modifyableItems, new CSharpToolkit.XAML.Behaviors.CallbackListItemConverter(x => x, ConvertFromModifyableToItemsFound));
            _synchronizer.StartSynchronizing();
        }
示例#3
0
        /// <summary>
        /// Instantiates the <see cref="FindViewModel{TDataGridSource, TDataCollector}"/> class.
        /// </summary>
        /// <param name="validator">The validator used.</param>
        /// <param name="dataCollectorInitializer">A function which initializes the <see cref="DataCollector"/>.</param>
        public FindViewModel(IValidate <string> validator, Func <TDataCollector> dataCollectorInitializer)
        {
            Validator = validator;

            Search        = new AwaitableDelegateCommand(PrivateSearchCallback, SearchEnable);
            Clear         = new AwaitableDelegateCommand(PrivateClearCallback, ClearEnable);
            RecordRequest = new AwaitableDelegateCommand(RecordRequestCallback, () => true);

            _formLocker.LockStatusChanged += (s, e) => OnPropertyChanged(nameof(Disable));
            _formLocker.LockStatusChanged += (s, e) => OnDisableChange?.Invoke(this, new GenericEventArgs <bool>(Disable));

            _clearingLocker.LockStatusChanged += (s, e) => OnPropertyChanged(nameof(Clearing));

            DataCollector = dataCollectorInitializer();

            ResetStringProperties();

            var currentItems = new ObservableCollection <IIdProvider>();

            CurrentItems = currentItems;

            _synchronizer = new XAML.Behaviors.TwoListSynchronizer(ItemsFound, currentItems, new XAML.Behaviors.CallbackListItemConverter(null, ConvertFromCurrentItemsToItemsFound));
            _synchronizer.StartSynchronizing();
        }