Пример #1
0
        public DirectoryListVM(ISourceDirectoryService sourceDirectoryService)
        {
            this.WhenActivated(disposables =>
            {
                AddDirectory = ReactiveCommand.Create(
                    () => {
                    var card = Locator.Current.GetService <IDirectoryCard>();
                    card.SetEditMode(true);
                    card.EditModeChanges
                    .Where(x => x == false)
                    .Take(1)
                    .Subscribe(_ => _temporaryDirectoryCards.RemoveKey(card.Id));
                    _temporaryDirectoryCards.AddOrUpdate(card);
                }
                    );


                sourceDirectoryService.Directories
                .Connect()
                .Transform(model =>
                           Locator.Current.GetService <IDirectoryCard>()
                           .SetSourceModel(model)
                           ).FullJoin(
                    _temporaryDirectoryCards.Connect(),
                    x => x.Id,
                    (saved, temp) => saved.HasValue ? saved.Value : temp.Value
                    ) // basically a concat
                .Bind(out var directoryCards)
                .Subscribe()
                .DisposeWith(disposables);
                this.DirectoryCards = directoryCards;
            });
        }
Пример #2
0
 public FileSynchronizationService(
     IItemService itemService,
     IJobService jobManagementService,
     ISourceDirectoryService fileSetupService,
     ILoggerFactory loggerFactory,
     IFileDataStorageService fileDataStorageService)
 {
     _logger                 = loggerFactory.CreateLogger <FileSynchronizationService>();
     _itemService            = itemService;
     _jobManagementService   = jobManagementService;
     _fileSetupService       = fileSetupService;
     _fileDataStorageService = fileDataStorageService;
 }