private void Timer_Tick(object sender, EventArgs e)
 {
     //UpdateList();
     if (UpdateListCommand.CanExecute(null))
     {
         UpdateListCommand.Execute(null);
     }
 }
예제 #2
0
        public async Task <IActionResult> Update([FromBody] ListModel model)
        {
            var user = await _userManagerWrapper.FindByNameAsync(User.Identity.Name);

            model.UserId = user.Id;
            var updatelistCommand = new UpdateListCommand {
                Model = model
            };
            await _endpointInstance.Send("LifeManager.Lists", updatelistCommand).ConfigureAwait(false);

            return(Ok());
        }
예제 #3
0
        public MainWindowViewModel()
        {
            User = LoadUserProfile();

            UpdateList();

            UpdateListCommand.Subscribe(_ =>
            {
                UpdateList();
            });

            UploadCommand.Subscribe(_ =>
            {
                var path = _ as string;
                Upload(path);
            });
        }
예제 #4
0
        public async Task HandleUpdateCommand_ShouldCallListServiceUpdate()
        {
            // Data
            var model = new ListModel {
                Id = Guid.NewGuid(), Name = "Todo list"
            };
            var updateListCommand = new UpdateListCommand {
                Model = model
            };


            // Setup
            _mockListService.Setup(x => x.UpdateList(model)).Returns(Task.CompletedTask).Verifiable();

            // Test
            var handler = new ListsEventHandler(_mockListService.Object);
            await handler.Handle(updateListCommand, _mockMessageContext.Object);

            // Analysis
            _mockListService.Verify();
        }
        public ListViewModel(IListModel <DataModelType> model,
                             IViewModelCreator <DataModelType, DataViewModelType, DataDetailViewModelType> creator,
                             IItemModelAdapterCreator <DataModelType> itemModelCreator)
        {
            if (creator == null)
            {
                throw new ArgumentNullException("creator can't be null");
            }
            _creator = creator;

            if (itemModelCreator == null)
            {
                throw new ArgumentNullException("itemModelCreator can't be null");
            }
            _itemModelCreator = itemModelCreator;

            if (model == null)
            {
                throw new ArgumentNullException("model can't be null");
            }

            _model          = model;
            _model.Updated += OnUpdate;
            var itemViewModels = GetItemViewModels(_model.GetItems());

            UpdateList(itemViewModels);

            AddItemCommand    = new AddItemCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this);
            DeleteItemCommand = new DeleteItemCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this);
            EditListCommand   = new EditListCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this);
            SaveListCommand   = new SaveListCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this);
            SelectItemCommand = new SelectItemCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this);
            UpdateListCommand = new UpdateListCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this);

            addedAndDelatedItems = new Dictionary <IItemModelAdapter <DataModelType>, ChangeStatus>();

            IsSaved = true;
        }
예제 #6
0
 public async Task Handle(UpdateListCommand message, IMessageHandlerContext context)
 {
     await _listService.UpdateList(message.Model);
 }