예제 #1
0
        public AsyncDataViewModel(
            IDataView dataView,
            AsyncDataViewModelPreset templatePreset,
            AsyncDataViewModelPreset defaultPreset,
            AdvmPresetCollection presetCollection)
        {
            if (dataView == null)
            {
                throw new ArgumentNullException(nameof(dataView));
            }
            if (templatePreset == null)
            {
                throw new ArgumentNullException(nameof(templatePreset));
            }

            uiTaskFactory    = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());
            DataView         = dataView;
            PresetCollection = presetCollection;

            TemplatePreset            = templatePreset.EnsureFrozen();
            GridViewModel             = new AsyncDataGridViewModel(this);
            dataView.RowCountChanged += OnRowCountChanged;

            Preset = defaultPreset;
            throttledRaiseUpdate = new ThrottledAction(
                TimeSpan.FromMilliseconds(100),
                () => uiTaskFactory.StartNew(RaiseUpdate));
        }
 public CopyContextMenu(AsyncDataGridViewModel advModel, CopyBehavior behavior)
 {
     this.advModel = advModel;
     this.behavior = behavior;
     switch (behavior)
     {
     case CopyBehavior.Selection:
         Header           = "Copy Selection";
         InputGestureText = "Ctrl+C";
         return;
     }
 }