예제 #1
0
파일: App.cs 프로젝트: makhin/PhotoBank
 public App(IPhotoProcessor photoProcessor, IRepository <Storage> repository, IFaceService faceService, ILogger <App> logger, ISyncService syncService, IPhotoService photoService)
 {
     _photoProcessor = photoProcessor;
     _repository     = repository;
     _faceService    = faceService;
     _logger         = logger;
     _syncService    = syncService;
     _photoService   = photoService;
 }
예제 #2
0
        public App(
            AppOptions options,
            IAuthService authService,
            IConnectivity connectivity,
            IDatabaseService databaseService,
            ISyncService syncService,
            ISettings settings,
            ILockService lockService,
            ILocalizeService localizeService,
            IAppInfoService appInfoService,
            IAppSettingsService appSettingsService,
            IDeviceActionService deviceActionService)
        {
            _options             = options ?? new AppOptions();
            _authService         = authService;
            _databaseService     = databaseService;
            _connectivity        = connectivity;
            _syncService         = syncService;
            _settings            = settings;
            _lockService         = lockService;
            _localizeService     = localizeService;
            _appInfoService      = appInfoService;
            _appSettingsService  = appSettingsService;
            _deviceActionService = deviceActionService;

            SetCulture();
            SetStyles();

            if (authService.IsAuthenticated)
            {
                if (_options.FromAutofillFramework && _options.SaveType.HasValue)
                {
                    MainPage = new ExtendedNavigationPage(new VaultAddCipherPage(_options));
                }
                else if (_options.Uri != null)
                {
                    MainPage = new ExtendedNavigationPage(new VaultAutofillListCiphersPage(_options));
                }
                else
                {
                    MainPage = new MainPage();
                }
            }
            else
            {
                MainPage = new ExtendedNavigationPage(new HomePage());
            }

            MessagingCenter.Subscribe <Application, bool>(Current, "Resumed", async(sender, forceLock) =>
            {
                Device.BeginInvokeOnMainThread(async() => await _lockService.CheckLockAsync(forceLock));
                if (Device.RuntimePlatform == Device.iOS)
                {
                    await Task.Run(() => FullSyncAsync()).ConfigureAwait(false);
                }
            });
        }
        public AnnotationTaskContext(IAnnotationSyncTask annotationSyncTask, ISyncService syncService, IAnnotationAccess annotationAccess)
        {
            this.AnnotationSyncTask = annotationSyncTask;
            this.SyncService        = syncService;
            this.AnnotationAccess   = annotationAccess;
            var uerFolder = GlobalAccess.Instance.CurrentUserInfo.UserFolder;

            this.AnnotationDownloadFile       = Path.Combine(uerFolder, Constants.AnnotationDownZip);
            this.AnnotationDownloadTempFolder = Path.Combine(uerFolder, Constants.AnnotationDown);
        }
예제 #4
0
        public SettingsSyncPage()
        {
            _syncService            = Resolver.Resolve <ISyncService>();
            _userDialogs            = Resolver.Resolve <IUserDialogs>();
            _connectivity           = Resolver.Resolve <IConnectivity>();
            _settings               = Resolver.Resolve <ISettings>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();

            Init();
        }
 public void SetUp()
 {
     _dmzRateList    = new List <Rate>();
     _masterRateList = new List <Core.DomainModel.Rate>();
     _dmzRepoMock    = NSubstitute.Substitute.For <IGenericDmzRepository <Core.DmzModel.Rate> >();
     _masterRepoMock = NSubstitute.Substitute.For <IGenericRepository <Core.DomainModel.Rate> >();
     _dmzRepoMock.WhenForAnyArgs(x => x.Insert(new Core.DmzModel.Rate())).Do(p => _dmzRateList.Add(p.Arg <Core.DmzModel.Rate>()));
     _dmzRepoMock.AsQueryable().Returns(_dmzRateList.AsQueryable());
     _uut = new RateSyncService(_dmzRepoMock, _masterRepoMock);
 }
    public BackgroundSyncJob(ISettingsService settingsService, ISyncStatusDb syncStatusDb, ISyncService syncService)
    {
        _settingsService = settingsService;
        _syncStatusDb    = syncStatusDb;

        _previousPollingState = null;
        _syncService          = syncService;

        _config = new Settings();
    }
예제 #7
0
        public LoginPageViewModel()
        {
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _authService         = ServiceContainer.Resolve <IAuthService>("authService");
            _syncService         = ServiceContainer.Resolve <ISyncService>("syncService");
            _storageService      = ServiceContainer.Resolve <IStorageService>("storageService");

            PageTitle             = AppResources.Bitwarden;
            TogglePasswordCommand = new Command(TogglePassword);
        }
예제 #8
0
        public AppViewModel(ISyncService syncService, DownloadManager downloads, CampaignManager campaigns, PlaySpaceManager playSpaces)
        {
            Campaigns        = campaigns ?? throw new ArgumentNullException(nameof(campaigns));
            PlaySpaces       = playSpaces ?? throw new ArgumentNullException(nameof(playSpaces));
            this.syncService = syncService ?? throw new ArgumentNullException(nameof(syncService));

            this.synchronization             = SynchronizationContext.Current;
            this.downloads                   = downloads ?? throw new ArgumentNullException(nameof(downloads));
            this.downloads.DownloadsChanged += OnDownloadsChanged;
        }
예제 #9
0
        public SyncPageViewModel()
        {
            _deviceActionService  = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService       = ServiceContainer.Resolve <IStorageService>("storageService");
            _syncService          = ServiceContainer.Resolve <ISyncService>("syncService");
            _localizeService      = ServiceContainer.Resolve <ILocalizeService>("localizeService");

            PageTitle = AppResources.Sync;
        }
        public SettingsSyncPage()
        {
            _syncService            = Resolver.Resolve <ISyncService>();
            _deviceActionService    = Resolver.Resolve <IDeviceActionService>();
            _connectivity           = Resolver.Resolve <IConnectivity>();
            _settings               = Resolver.Resolve <ISettings>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();

            Init();
        }
예제 #11
0
        public TaskViewModel(ISyncService syncService, ITaskService taskService)
        {
            _syncService = syncService;
            _syncService.AddUpdateHandler(SyncUpdateHandler);

            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

            this.taskService = taskService;
            SetTasksforList();
        }
예제 #12
0
        public PortfoliosController(IPortfolioService portfolioService, IProjectDataService projectDataService, ISyncService syncService)
        {
            this.portfolioService   = portfolioService;
            this.projectDataService = projectDataService;
            this.syncService        = syncService;

#if DEBUG
            AppLog.TraceVerbose($"{nameof(PortfoliosController)} created.");
#endif
        }
예제 #13
0
        public Task DescribeAsync(ISyncService sync, MarkdownWriter writer)
        {
            var models =
                GetFiles(sync.FileSystem)
                .Select(x => (x, sync.Read <AssetsModel>(x, log)));

            writer.Paragraph($"{models.SelectMany(x => x.Item2.Assets).Count()} asset(s).");

            return(Task.CompletedTask);
        }
예제 #14
0
        public ExtendedContentPage(bool syncIndicator = false, bool updateActivity = true)
        {
            _syncIndicator          = syncIndicator;
            _updateActivity         = updateActivity;
            _syncService            = Resolver.Resolve <ISyncService>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();
            _lockService            = Resolver.Resolve <ILockService>();
            _deviceActionService    = Resolver.Resolve <IDeviceActionService>();

            BackgroundColor = Color.FromHex("efeff4");
        }
예제 #15
0
        public async Task ExportAsync(ISyncService sync, SyncOptions options, ISession session)
        {
            var downloadPipeline = new DownloadPipeline(session, log, sync.FileSystem)
            {
                FilePathProvider = asset => asset.Id.GetBlobPath()
            };

            try
            {
                var assets     = new List <AssetModel>();
                var assetBatch = 0;

                async Task SaveAsync()
                {
                    var model = new AssetsModel
                    {
                        Assets = assets
                    };

                    await log.DoSafeAsync($"Exporting Assets ({assetBatch})", async() =>
                    {
                        await sync.WriteWithSchema(new FilePath("assets", $"{assetBatch}.json"), model, Ref);
                    });
                }

                await session.Assets.GetAllAsync(session.App, async asset =>
                {
                    var model = asset.ToModel();

                    model.FolderPath = await sync.Folders.GetPathAsync(asset.ParentId);

                    assets.Add(model);

                    if (assets.Count > 50)
                    {
                        await SaveAsync();

                        assets.Clear();
                        assetBatch++;
                    }

                    await downloadPipeline.DownloadAsync(asset);
                });

                if (assets.Count > 0)
                {
                    await SaveAsync();
                }
            }
            finally
            {
                await downloadPipeline.CompleteAsync();
            }
        }
예제 #16
0
        public Task DescribeAsync(ISyncService sync, MarkdownWriter writer)
        {
            var models =
                GetFiles(sync.FileSystem)
                .Select(x => sync.Read <AssetFoldersModel>(x, log))
                .ToList();

            writer.Paragraph($"{models.SelectMany(x => x.Paths).Distinct().Count()} asset folder(s).");

            return(Task.CompletedTask);
        }
예제 #17
0
        protected ElementViewModel(IAsyncServiceProvider serviceProvider, ISyncService syncService, string id)
            : this(serviceProvider, syncService)
        {
            if (id is null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            this.id = id;
            Load();
        }
예제 #18
0
        public void Setup()
        {
            _user = new User {
                ObjectId = Guid.NewGuid().ToString()
            };
            _service1 = Substitute.For <ISyncService>();
            _service2 = Substitute.For <ISyncService>();
            _persistenceContextFactory = Substitute.For <IPersistenceContextFactory>();

            _syncService = new SyncService(_persistenceContextFactory, new [] { _service1, _service2 });
        }
예제 #19
0
 public DialogCreator(
     INotificationService notificationService,
     IPasswordManager passwordManager,
     PasswordFileParser passwordFileParser,
     Option <ISyncService> syncService)
 {
     this.notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
     this.passwordManager     = passwordManager ?? throw new ArgumentNullException(nameof(passwordManager));
     this.passwordFileParser  = passwordFileParser;
     this.syncService         = syncService.Value;
     this.pathDisplayHelper   = new PathDisplayHelper(ConfigManager.Config.Interface.DirectorySeparator);
 }
예제 #20
0
        public LoginPageViewModel()
        {
            _deviceActionService  = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _authService          = ServiceContainer.Resolve <IAuthService>("authService");
            _syncService          = ServiceContainer.Resolve <ISyncService>("syncService");
            _storageService       = ServiceContainer.Resolve <IStorageService>("storageService");
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");

            PageTitle             = AppResources.Bitwarden;
            TogglePasswordCommand = new Command(TogglePassword);
            LogInCommand          = new Command(async() => await LogInAsync());
        }
예제 #21
0
 public MainPageViewModel(
     IAuthenticator authenticator,
     INavigationService navigationService,
     ITodoItemsService todoItemsService,
     IUserService userService, ISyncService syncService)
 {
     _authenticator     = authenticator;
     _navigationService = navigationService;
     _todoItemsService  = todoItemsService;
     _userService       = userService;
     _authenticator     = authenticator;
 }
예제 #22
0
        /// <summary>
        /// Initializes a new <see cref="ClerkController"/>.
        /// </summary>
        /// <param name="logService">Service used for logging.</param>
        /// <param name="syncService">Service used to synchronize the packages.</param>
        /// <param name="deployService">Service used for announcing deployments.</param>
        /// <param name="scheduleService">Service used for controlling fusions.</param>
        public ClerkController(
            ILog logService,
            ISyncService syncService,
            IDeployService deployService,
            IScheduleService scheduleService)
        {
            this.logService = logService;

            this.syncService     = syncService;
            this.deployService   = deployService;
            this.scheduleService = scheduleService;
        }
예제 #23
0
        private void StartServices()
        {
            Container.Resolve <IDialogManager>();
            Container.Resolve <IScreenConductor>();
            _notificationService = Container.Resolve <INotificationService>();
            Container.Resolve <IApplicationStateService>();
            _syncService = Container.Resolve <ISyncService>();

            var busyService = Container.Resolve <IBusyService>();

            busyService.BusyView = new FlowerLoadingControl();
        }
예제 #24
0
        public void SetUp()
        {
            _fileSyncService = new Mock <IFileSyncService>();
            _oneStepService  = new Mock <IOneStepService>();
            _gridRunEngine   = new Mock <IGridRunEngine>();

            _syncService = new SyncService(_fileSyncService.Object, _oneStepService.Object, _gridRunEngine.Object);

            _oneStepService.Setup(o => o.GetFileData(It.IsAny <DateTime>())).Returns(_fileData);
            _fileSyncService.Setup(f => f.GetLatest()).Returns(new FileSync());
            _fileSyncService.Setup(u => u.UpdateFileSync(It.IsAny <int>()));
        }
 public CustomerInfoViewModel(
     IRepository <SalesOrder> repository,
     IServiceBundle serviceBundle,
     ISalesOrderRepository salesOrderRepository,
     ICustomerInfoRepository customerInfoRepositoy,
     ISyncService syncService
     ) : base(serviceBundle)
 {
     _repository             = repository;
     _salesOrderRepository   = salesOrderRepository;
     _customerInfoRepository = customerInfoRepositoy;
 }
예제 #26
0
        public ListViewModel(ISyncService syncService, IListService listService = null)
        {
            _syncService = syncService;
            _syncService.AddUpdateHandler(SyncUpdateHandler);

            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

            this.listService = listService;

            // Initialize observable list collection;
            this.Lists = new ObservableCollection <ListItem>(this.listService.GetExistingLists());
        }
예제 #27
0
 public JobImportLdapUsers(ClientManager clientManager,
                           DirectoryManager directoryManager,
                           ILdapService <LdapUser> ldapService,
                           ISyncService <User, LdapUser> syncService,
                           UserManager userManager)
 {
     _clientManager    = clientManager;
     _directoryManager = directoryManager;
     _userManager      = userManager;
     _ldapService      = ldapService;
     _syncService      = syncService;
 }
예제 #28
0
        public LoginTwoFactorPage()
            : base(updateActivity: false)
        {
            _cryptoService     = Resolver.Resolve <ICryptoService>();
            _authService       = Resolver.Resolve <IAuthService>();
            _deviceInfoService = Resolver.Resolve <IDeviceInfoService>();
            _appIdService      = Resolver.Resolve <IAppIdService>();
            _userDialogs       = Resolver.Resolve <IUserDialogs>();
            _syncService       = Resolver.Resolve <ISyncService>();

            Init();
        }
예제 #29
0
        public static async Task ImportAsync(IReadOnlyList <IStorageItem> items, IProgress <double> progress = null)
        {
            items = GetImportableItems(items);

            AggregateProgress total = (progress != null) ? new AggregateProgress(progress) : null;

            ISyncService sync = await App.Services.GetServiceAsync <ISyncService> ().ConfigureAwait(false);

            DownloadManager downloads = await App.Services.GetServiceAsync <DownloadManager> ().ConfigureAwait(false);

            List <Task> importTasks = new List <Task> ();

            foreach (IStorageItem item in items)
            {
                var node = total?.CreateProgressNode();
                if (item is IStorageFolder folder)
                {
                    var children = await folder.GetItemsAsync();

                    importTasks.Add(ImportAsync(children, node));
                }
                else if (item is IStorageFile file)
                {
                    Task <FileSample> import   = null;
                    ManagedDownload   download = null;

                    Func <CancellationToken, IProgress <double>, Task <FileSample> > importGetter = async(cancel, progress) => {
                        import = ImportAsync(file, sync, progress, cancel);
                        FileSample sample = null;
                        try {
                            sample = await import;
                            if (download != null)
                            {
                                download.State = DownloadState.Completed;
                            }
                        } catch {
                            if (download != null)
                            {
                                download.State = DownloadState.LocalError;
                            }
                        }

                        return(sample);
                    };
                    download = downloads.QueueImport(file.Name, importGetter);
                    importTasks.Add(import);
                }
            }

            total?.FinishDiscovery();
            await Task.WhenAll(importTasks);
        }
예제 #30
0
        public GroupingsPage(bool mainPage, CipherType?type = null, string folderId  = null,
                             string collectionId            = null, string pageTitle = null, string vaultFilterSelection = null,
                             PreviousPageInfo previousPage  = null, bool deleted     = false)
        {
            _pageName = string.Concat(nameof(GroupingsPage), "_", DateTime.UtcNow.Ticks);
            InitializeComponent();
            SetActivityIndicator(_mainContent);
            _broadcasterService      = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _syncService             = ServiceContainer.Resolve <ISyncService>("syncService");
            _pushNotificationService = ServiceContainer.Resolve <IPushNotificationService>("pushNotificationService");
            _stateService            = ServiceContainer.Resolve <IStateService>("stateService");
            _vaultTimeoutService     = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _cipherService           = ServiceContainer.Resolve <ICipherService>("cipherService");
            _deviceActionService     = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _vm              = BindingContext as GroupingsPageViewModel;
            _vm.Page         = this;
            _vm.MainPage     = mainPage;
            _vm.Type         = type;
            _vm.FolderId     = folderId;
            _vm.CollectionId = collectionId;
            _vm.Deleted      = deleted;
            _previousPage    = previousPage;
            if (pageTitle != null)
            {
                _vm.PageTitle = pageTitle;
            }
            if (vaultFilterSelection != null)
            {
                _vm.VaultFilterDescription = vaultFilterSelection;
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                _absLayout.Children.Remove(_fab);
                ToolbarItems.Add(_addItem);
            }
            else
            {
                ToolbarItems.Add(_syncItem);
                ToolbarItems.Add(_lockItem);
                ToolbarItems.Add(_exitItem);
            }
            if (deleted)
            {
                _absLayout.Children.Remove(_fab);
                ToolbarItems.Remove(_addItem);
            }
            if (!mainPage)
            {
                ToolbarItems.Remove(_accountAvatar);
            }
        }
예제 #31
0
        public ShellController(ShellViewModel shellViewModel, ISyncService syncService,
            ISettingsSerializationService settingsSerializationService,
            ISummarySerializationService summarySerializationService,
            SystemTrayNotifierViewModel systemTrayNotifierViewModel,
            ApplicationLogger applicationLogger)
        {
            _shellViewModel = shellViewModel;
            _syncService = syncService;
            _settingsSerializationService = settingsSerializationService;
            _summarySerializationService = summarySerializationService;

            _systemTrayNotifierViewModel = systemTrayNotifierViewModel;
            _applicationLogger = applicationLogger;
        }
예제 #32
0
 public void Init() {
     SyncService = new HTTPSyncService("http://sagsrv:8080/nww3d/mod/ws-tst/xml-rpc/");
 }
예제 #33
0
 public DefaultSyncProvider(ISyncService syncService)
 {
     _syncService = syncService;
 }
예제 #34
0
 public MainViewModel(IRMSController controller,ISyncService syncService)
 {
     this.controller = controller;
     this.syncService = syncService;
     DisplayName = "سیستم مدیریت آرامش بانک مهر";
 }
예제 #35
0
		/// <summary>
		/// Initializes a new instance of the <see cref="BootViewModel"/> class.
		/// </summary>
		/// <param name="settings">The settings.</param>
		/// <param name="server">The server.</param>
		/// <param name="dataContext">The data context.</param>
		/// <param name="container">The container.</param>
		/// <param name="eventAggregator">The event aggregator.</param>
		public BootViewModel(ISyncService syncService, IDataContext context, WinRTContainer container, INavigationService service, IEventAggregator eventAggregator) 
			: base(container, service, eventAggregator)
		{
			this.syncService = syncService;
			this.context = context;
		}
예제 #36
0
 /// <summary>
 /// 注册与任务系统的联系人进行数据同步的服务
 /// </summary>
 public void RegisterContactSyncService(ISyncService<ContactSyncData, ISyncData, ContactSyncResult> contactSyncService)
 {
     _contactSyncServices.Add(contactSyncService);
 }
예제 #37
0
 /// <summary>
 /// 注册与任务系统的任务进行数据同步的服务
 /// </summary>
 public void RegisterTaskSyncService(ISyncService<TaskSyncData, ISyncData, TaskSyncResult> taskSyncService)
 {
     _taskSyncServices.Add(taskSyncService);
 }