예제 #1
0
 internal async Task<bool> Load(ID7Client client, CancellationToken token)
 {
     if (IsLoaded) return true;
     Terms = await client.Get<List<D7Term>>(URL.Json_TaxoTerms, token);
     if (Terms == null) return false;
     return IsLoaded = true;
 }
예제 #2
0
 internal D7FileDownloader(string targetDir, string subUrlPattern, IFileSystemShim fsShim, ID7Client d7Client)
 {
     _client     = ForwardLogs(d7Client);
     _fs         = ForwardLogs(fsShim);
     _foldr      = _fs.Folder(targetDir);
     _urlPattern = subUrlPattern;
     _suffix     = "_" + DateTime.Now.TimeOfDay.TotalMinutes;
     DeleteOldReplacements();
 }
예제 #3
0
 internal D7FileDownloader(string targetDir, string subUrlPattern, IFileSystemShim fsShim, ID7Client d7Client)
 {
     _client     = ForwardLogs(d7Client);
     _fs         = ForwardLogs(fsShim);
     _foldr      = _fs.Folder(targetDir);
     _urlPattern = subUrlPattern;
     _suffix     = "_" + DateTime.Now.TimeOfDay.TotalMinutes;
     DeleteOldReplacements();
 }
예제 #4
0
        internal async Task <bool> Load(ID7Client client, CancellationToken token)
        {
            if (IsLoaded)
            {
                return(true);
            }
            Terms = await client.Get <List <D7Term> >(URL.Json_TaxoTerms, token);

            if (Terms == null)
            {
                return(false);
            }
            return(IsLoaded = true);
        }
예제 #5
0
        public FilesTabVM2(IRepository<SyncableFileRemote> filesRepo, AppFileGrouper fileGrouper, IFileSynchronizer fileSynchronizer, ID7Client d7Client, BinUploaderCfgFile cfgFile)
        {
            _grouper         = ForwardLogs(fileGrouper);
            _synchronizer    = ForwardLogs(fileSynchronizer);
            _remotes         = ForwardLogs(filesRepo);
            //_cfgFile         = ForwardLogs(cfgFile);
            //_d7Client        = ForwardLogs(d7Client);
            MainList         = new VmList<RemoteVsLocalFile>();
            UploadChangesCmd = AsyncCommand.Create(token => UploadChanges(token));

            _remotes.SetClient(d7Client, cfgFile);
            _synchronizer.SetClient(d7Client);

            SetEventHandlers();
        }
예제 #6
0
        public BinUpdaterVM(IRepository<SyncableFileRemote> filesRepo, 
                            AppFileGrouper fileGrouper, 
                            IFileSynchronizer fileSynchronizer,
                            BinUpdaterCfgFile cfgFile,
                            UpdaterSessionVM usrSessionVm,
                            ID7Client d7Client,
                            LogScrollerVM logScroller)
        {
            DisplayName   = "Bin Updater";
            _d7Client     = ForwardLogs(d7Client);
            _grouper      = ForwardLogs(fileGrouper);
            _synchronizer = ForwardLogs(fileSynchronizer);
            _remotes      = ForwardLogs(filesRepo);
            _cfgFile      = ForwardLogs(cfgFile);
            UserSession   = ForwardLogs(usrSessionVm);
            UpdateNowCmd  = AsyncCommand.Create(tkn => UpdateNow(tkn));

            LogScroller = logScroller.ListenTo(this);
        }
예제 #7
0
        public BinUpdaterVM(IRepository <SyncableFileRemote> filesRepo,
                            AppFileGrouper fileGrouper,
                            IFileSynchronizer fileSynchronizer,
                            BinUpdaterCfgFile cfgFile,
                            UpdaterSessionVM usrSessionVm,
                            ID7Client d7Client,
                            LogScrollerVM logScroller)
        {
            DisplayName   = "Bin Updater";
            _d7Client     = ForwardLogs(d7Client);
            _grouper      = ForwardLogs(fileGrouper);
            _synchronizer = ForwardLogs(fileSynchronizer);
            _remotes      = ForwardLogs(filesRepo);
            _cfgFile      = ForwardLogs(cfgFile);
            UserSession   = ForwardLogs(usrSessionVm);
            UpdateNowCmd  = AsyncCommand.Create(tkn => UpdateNow(tkn));

            LogScroller = logScroller.ListenTo(this);
        }
예제 #8
0
        private async Task <bool> Query(ID7Client client, string subUrl, CancellationToken tkn)
        {
            Debug_n($"Querying repository of ‹{ClsTyp}›...", subUrl);

            List <TNodeDto> dtos;

            try
            {
                dtos = await client.Get <List <TNodeDto> >(subUrl, tkn);
            }
            catch (Exception ex)
            {
                return(Error_n("Query error:", ex.Details(false, false)));
            }

            if (dtos == null)
            {
                return(false);
            }

            var tmp = dtos.Select(x => FromDto(x));

            if (!AreKeysUnique(tmp))
            {
                return(Warn_n($"‹{ClsTyp}› Keys are not unique.", GetKey.ToString()));
            }

            _list = tmp.ToList();
            if (_list.Count == 1 && _list[0] == null)
            {
                _list.Clear();
            }

            StartTrackingChanges();

            return(true);
        }
예제 #9
0
 public void SetClient(ID7Client d7Client)
 => _client = ForwardLogs(d7Client);
예제 #10
0
 public override void SetClient(ISessionClient sessionClient, IBasicAuthenticationKey credentials)
 {
     _client      = sessionClient.As <ID7Client>();
     _credentials = credentials;
 }
예제 #11
0
 public void SetClient(ID7Client d7Client)
     => _client = ForwardLogs(d7Client);
예제 #12
0
 public D7Daily1KeyReaderBase(ID7Client d7Client
                              , ISerializer serializer
                              ) : base(d7Client, serializer)
 {
 }
예제 #13
0
        public FilesTabVM2(IRepository <SyncableFileRemote> filesRepo, AppFileGrouper fileGrouper, IFileSynchronizer fileSynchronizer, ID7Client d7Client, BinUploaderCfgFile cfgFile)
        {
            _grouper      = ForwardLogs(fileGrouper);
            _synchronizer = ForwardLogs(fileSynchronizer);
            _remotes      = ForwardLogs(filesRepo);
            //_cfgFile         = ForwardLogs(cfgFile);
            //_d7Client        = ForwardLogs(d7Client);
            MainList         = new VmList <RemoteVsLocalFile>();
            UploadChangesCmd = AsyncCommand.Create(token => UploadChanges(token));

            _remotes.SetClient(d7Client, cfgFile);
            _synchronizer.SetClient(d7Client);

            SetEventHandlers();
        }
예제 #14
0
 public DailyReaderBase(ID7Client d7Client
                        , ISerializer serializer)
 {
     _client  = d7Client;
     _serialr = serializer;
 }