Example #1
0
        public OpenSafeViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IThemeService themeService,
            IBaseUrlService webviewBaseUrl,
            IFeedbackService feedbackService,
            ICryptoRandomService randomService,
            ISettingsService settingsService,
            IRepositoryStorageService repositoryService,
            Navigation navigationTarget)
            : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl)
        {
            _feedbackService   = feedbackService ?? throw new ArgumentNullException(nameof(feedbackService));
            _randomService     = randomService;
            _settingsService   = settingsService;
            _repositoryService = repositoryService;
            _navigationTarget  = navigationTarget;

            _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository);
            Model = noteRepository;

            GoBackCommand    = new RelayCommand(GoBack);
            CancelCommand    = new RelayCommand(Cancel);
            OkCommand        = new RelayCommand(Ok);
            ResetSafeCommand = new RelayCommand(ResetSafe);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsViewModel"/> class.
        /// </summary>
        public SettingsViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IThemeService themeService,
            IBaseUrlService webviewBaseUrl,
            ISettingsService settingsService,
            IStoryBoardService storyBoardService,
            IFeedbackService feedbackService,
            ICloudStorageClientFactory cloudStorageClientFactory,
            IFilePickerService filePickerService)
            : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl)
        {
            _settingsService           = settingsService;
            _storyBoardService         = storyBoardService;
            _feedbackService           = feedbackService;
            _cloudStorageClientFactory = cloudStorageClientFactory;
            _filePickerService         = filePickerService;
            _fontSizeConverter         = new SliderStepConverter(ReferenceFontSize, 1.0);
            _noteMaxHeightConverter    = new SliderStepConverter(ReferenceNoteMaxSize, 20.0);
            Model = _settingsService.LoadSettingsOrDefault();

            EncryptionAlgorithms = new List <DropdownItemViewModel>();
            FillAlgorithmList(EncryptionAlgorithms);

            // Initialize commands
            GoBackCommand = new RelayCommand(GoBack);
            ChangeCloudSettingsCommand = new RelayCommand(ChangeCloudSettings);
            ClearCloudSettingsCommand  = new RelayCommand(ClearCloudSettings);
            TestNewLocalizationCommand = new RelayCommand(TestNewLocalization);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RecycleBinViewModel"/> class.
        /// </summary>
        public RecycleBinViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IThemeService themeService,
            IBaseUrlService webviewBaseUrl,
            IFeedbackService feedbackService,
            ISettingsService settingsService,
            ICryptoRandomSource randomSource,
            IRepositoryStorageService repositoryService)
            : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl)
        {
            _feedbackService   = feedbackService;
            _settingsService   = settingsService;
            _repositoryService = repositoryService;
            _noteCryptor       = new Cryptor(NoteModel.CryptorPackageName, randomSource);
            RecycledNotes      = new List <NoteViewModel>();

            _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository);
            Model = noteRepository;

            // Initialize commands
            GoBackCommand          = new RelayCommand(GoBack);
            RestoreNoteCommand     = new RelayCommand <object>(RestoreNote);
            EmptyRecycleBinCommand = new RelayCommand(EmptyRecycleBin);
        }
        /// <inheritdoc/>
        public ShortenedNoteViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IThemeService themeService,
            IBaseUrlService webviewBaseUrl,
            SearchableHtmlConverter searchableTextConverter,
            IRepositoryStorageService repositoryService,
            IFeedbackService feedbackService,
            ISettingsService settingsService,
            ICryptor cryptor,
            SafeListModel safes,
            NoteModel noteFromRepository)
            : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl, searchableTextConverter, repositoryService, feedbackService, settingsService, cryptor, safes, noteFromRepository)
        {
            if (_unlockedContent != null)
            {
                // Create a short version for large notes, with only the first part of the note.
                // This is a performance improvement if there are large notes in the repository.
                HtmlShortener shortener = new HtmlShortener();
                shortener.WantedLength    = 600; // Should be enough even for settings with
                shortener.WantedTagNumber = 20;  // small font and very height notes.

                string shortenedContent = shortener.Shorten(_unlockedContent);
                if (shortenedContent.Length != _unlockedContent.Length)
                {
                    // Because the note will be truncated, we have to build the searchable content
                    // first, before overwriting the original content.
                    string dummy = SearchableContent;
                    _unlockedContent = shortenedContent;
                }
            }
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NoteViewModel"/> class.
        /// </summary>
        public NoteViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IThemeService themeService,
            IBaseUrlService webviewBaseUrl,
            SearchableHtmlConverter searchableTextConverter,
            IRepositoryStorageService repositoryService,
            IFeedbackService feedbackService,
            ISettingsService settingsService,
            ICryptor cryptor,
            SafeListModel safes,
            NoteModel noteFromRepository)
            : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl)
        {
            _repositoryService       = repositoryService;
            _feedbackService         = feedbackService;
            _settingsService         = settingsService;
            _searchableTextConverter = searchableTextConverter;
            _cryptor = cryptor;
            _safes   = safes;
            MarkSearchableContentAsDirty();
            PushNoteToOnlineStorageCommand   = new RelayCommand(PushNoteToOnlineStorage);
            PullNoteFromOnlineStorageCommand = new RelayCommand(PullNoteFromOnlineStorage);
            ToggleShoppingModeCommand        = new RelayCommand(ToggleShoppingMode);
            GoBackCommand = new RelayCommand(GoBack);

            Model            = noteFromRepository;
            _unlockedContent = IsInSafe ? UnlockIfSafeOpen(Model.HtmlContent) : Model.HtmlContent;
        }
Example #6
0
        public AuthControllerTests()
        {
            authClient            = A.Fake <IOpenIdConnectClient>();
            log                   = A.Fake <ILogger <AuthController> >();
            defaultVersionedFiles = A.Fake <IVersionedFiles>();
            defaultConfiguration  = A.Fake <IConfiguration>();
            var requestServices = A.Fake <IServiceProvider>();

            defaultAuthService = A.Fake <IAuthenticationService>();
            session            = new MockHttpSession();
            baseUrlService     = A.Fake <IBaseUrlService>();
            defaultUrlHelper   = A.Fake <IUrlHelper>();
            A.CallTo(() => defaultAuthService.SignInAsync(A <HttpContext> .Ignored, A <string> .Ignored, A <ClaimsPrincipal> .Ignored, A <AuthenticationProperties> .Ignored)).Returns(Task.CompletedTask);

            A.CallTo(() => requestServices.GetService(typeof(IAuthenticationService))).Returns(defaultAuthService);

            A.CallTo(() => baseUrlService.GetBaseUrl(A <HttpRequest> .Ignored, A <IUrlHelper> .Ignored))
            .Returns(baseAddress);

            defaultContext = new DefaultHttpContext
            {
                RequestServices = requestServices,
                Session         = session,
                Request         = { Headers = { new KeyValuePair <string, StringValues>("Referer", refererUrl) } },
            };

            defaultsettings = Options.Create(new AuthSettings
            {
                Audience           = "audience",
                ClientSecret       = "clientSecret123456",
                Issuer             = "issuer",
                DefaultRedirectUrl = "test",
                AuthDssEndpoint    = "test/{url}",
            });

            defaultSettings = Options.Create(new OpenIDConnectSettings
            {
                RedirectUrl        = "test/",
                SignOutRedirectUrl = "test/",
                Issuer             = "issuer",
                AuthdUrl           = "auth",
                AuthorizeUrl       = "AuthorizeUrl",
                ClientId           = "clientid",
                EndSessionUrl      = "Endsesison",
                JWK      = "jjjjjjfhfjjfjfjfjfhfjkhdfkhdfkjhskfhsldkjhfskdljfhsdlkfhsdflksdhsdlkfh",
                Exponent = "AQAB",
            });

            tokenHandler         = A.Fake <SecurityTokenHandler>();
            configurationManager = A.Fake <IConfigurationManager <OpenIdConnectConfiguration> >();
            A.CallTo(() => configurationManager.GetConfigurationAsync(CancellationToken.None)).Returns(
                new OpenIdConnectConfiguration
            {
                AuthorizationEndpoint = "auth",
                EndSessionEndpoint    = "end",
                Issuer = "issuer",
            });

            _urlHelper = A.Fake <IUrlHelper>();
        }
Example #7
0
        public SitemapControllerTests()
        {
            defaultPathDataService = A.Fake <IPathDataService>();
            defaultLogger          = A.Fake <ILogger <SitemapController> >();
            defaultBaseUrlService  = A.Fake <IBaseUrlService>();

            var pathModels = new List <PathModel>
            {
                new PathModel
                {
                    SitemapURL = "http://SomeSitemapUrl.xyz",
                    IsOnline   = true,
                },
            };

            A.CallTo(() => defaultPathDataService.GetPaths()).Returns(pathModels);

            var user = A.Fake <ClaimsPrincipal>();

            A.CallTo(() => user.Identity.IsAuthenticated).Returns(true);

            defaultHttpContext = A.Fake <HttpContext>();
            defaultHttpContext.Request.Scheme = DummyScheme;
            defaultHttpContext.Request.Host   = new HostString(DummyHost);

            var fakeIdentity = new GenericIdentity("User");
            var principal    = new GenericPrincipal(fakeIdentity, null);

            A.CallTo(() => defaultHttpContext.User).Returns(principal);

            defaultUrlHelper = A.Fake <IUrlHelper>();
            A.CallTo(() => defaultUrlHelper.Action(A <UrlActionContext> .Ignored)).Returns(DummyHomeIndex);

            defaultTokenRetriever = A.Fake <IBearerTokenRetriever>();
            A.CallTo(() => defaultTokenRetriever.GetToken(A <HttpContext> .Ignored)).Returns("SomeToken");

            A.CallTo(() => defaultBaseUrlService.GetBaseUrl(A <HttpRequest> .Ignored, A <IUrlHelper> .Ignored))
            .Returns("http://SomeBaseUrl");

            defaultSitemapService = A.Fake <IApplicationSitemapService>();
            A.CallTo(() => defaultSitemapService.GetAsync(A <ApplicationSitemapModel> .Ignored))
            .Returns(Task.FromResult <IEnumerable <SitemapLocation> >(new List <SitemapLocation>()
            {
                new SitemapLocation
                {
                    Url      = "http://Sitemap.xml",
                    Priority = 1,
                },
            }));

            defaultController = new SitemapController(defaultPathDataService, defaultLogger, defaultTokenRetriever, defaultBaseUrlService, defaultSitemapService)
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = defaultHttpContext,
                },
                Url = defaultUrlHelper,
            };
        }
Example #8
0
        public ApplicationControllerTests()
        {
            defaultMapper             = new ApplicationToPageModelMapper();
            defaultLogger             = A.Fake <ILogger <ApplicationController> >();
            defaultApplicationService = A.Fake <IApplicationService>();
            defaultVersionedFiles     = A.Fake <IVersionedFiles>();
            defaultConfiguration      = A.Fake <IConfiguration>();
            defaultBaseUrlService     = A.Fake <IBaseUrlService>();

            defaultApplicationModel = new ApplicationModel
            {
                Path = new PathModel {
                    Path = ChildAppPath
                },
                Regions = new List <RegionModel>
                {
                    new RegionModel
                    {
                        Path           = ChildAppPath,
                        IsHealthy      = true,
                        PageRegion     = PageRegion.Body,
                        RegionEndpoint = "http://childApp/bodyRegion",
                    },
                },
            };
            A.CallTo(() => defaultApplicationService.GetApplicationAsync(ChildAppPath)).Returns(defaultApplicationModel);

            var fakeHttpContext = new DefaultHttpContext {
                Request = { QueryString = QueryString.Create("test", "testvalue") }
            };

            defaultPostRequestViewModel = new ActionPostRequestModel
            {
                Path           = ChildAppPath,
                FormCollection = new FormCollection(new Dictionary <string, StringValues>
                {
                    { "someKey", "someFormValue" },
                }),
            };

            defaultGetController = new ApplicationController(defaultMapper, defaultLogger, defaultApplicationService, defaultVersionedFiles, defaultConfiguration, defaultBaseUrlService)
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = fakeHttpContext,
                },
            };

            defaultPostController = new ApplicationController(defaultMapper, defaultLogger, defaultApplicationService, defaultVersionedFiles, defaultConfiguration, defaultBaseUrlService)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                    {
                        Request = { Method = "POST" },
                    },
                },
            };
        }
Example #9
0
 public StopViewModel(
     INavigationService navigationService,
     ILanguageService languageService,
     ISvgIconService svgIconService,
     IBaseUrlService webviewBaseUrl)
     : base(navigationService, languageService, svgIconService, webviewBaseUrl)
 {
 }
Example #10
0
 public StarshipShipCounselorRelatedResourceMaterializer(
     ISingleResourceDocumentBuilder singleResourceDocumentBuilder, IBaseUrlService baseUrlService,
     IResourceTypeRegistration primaryTypeRegistration, ResourceTypeRelationship relationship,
     DbContext dbContext)
     : base(singleResourceDocumentBuilder, baseUrlService, primaryTypeRegistration, relationship, dbContext)
 {
     _dbContext = dbContext;
 }
 /// <summary>
 /// Builds a new EntityFrameworkToOneRelatedResourceDocumentMaterializer
 /// </summary>
 public EntityFrameworkToOneRelatedResourceDocumentMaterializer(
     ISingleResourceDocumentBuilder singleResourceDocumentBuilder, IBaseUrlService baseUrlService,
     IResourceTypeRegistration primaryTypeRegistration, ResourceTypeRelationship relationship,
     DbContext dbContext)
     : base(singleResourceDocumentBuilder, baseUrlService)
 {
     _primaryTypeRegistration = primaryTypeRegistration;
     _relationship            = relationship;
     _dbContext = dbContext;
 }
Example #12
0
 protected ViewModelBase(
     INavigationService navigationService,
     ILanguageService languageService,
     ISvgIconService svgIconService,
     IBaseUrlService webviewBaseUrl)
 {
     _navigationService = navigationService;
     Language           = languageService;
     Icon            = svgIconService;
     _webviewBaseUrl = webviewBaseUrl;
 }
 public StarshipDocumentMaterializer(
     TestDbContext dbContext,
     IQueryableResourceCollectionDocumentBuilder queryableResourceCollectionDocumentBuilder,
     IBaseUrlService baseUrlService, ISingleResourceDocumentBuilder singleResourceDocumentBuilder,
     ISortExpressionExtractor sortExpressionExtractor,
     IQueryableEnumerationTransformer queryableEnumerationTransformer, IResourceTypeRegistry resourceTypeRegistry)
     : base(
         queryableResourceCollectionDocumentBuilder, baseUrlService, singleResourceDocumentBuilder,
         queryableEnumerationTransformer, sortExpressionExtractor, resourceTypeRegistry)
 {
     _dbContext = dbContext;
 }
        public RobotControllerTests()
        {
            defaultAppRegistryDataService = A.Fake <IAppRegistryDataService>();
            defaultLogger             = A.Fake <ILogger <RobotController> >();
            defaultWebHostEnvironment = A.Fake <IWebHostEnvironment>();
            defaultBaseUrlService     = A.Fake <IBaseUrlService>();

            var appRegistrationModels = new List <AppRegistrationModel>
            {
                new AppRegistrationModel
                {
                    RobotsURL = new Uri("http://SomeRobotUrl.xyz", UriKind.Absolute),
                    IsOnline  = true,
                },
            };

            A.CallTo(() => defaultAppRegistryDataService.GetAppRegistrationModels()).Returns(appRegistrationModels);

            var user = A.Fake <ClaimsPrincipal>();

            A.CallTo(() => user.Identity.IsAuthenticated).Returns(true);

            defaultHttpContext = A.Fake <HttpContext>();
            defaultHttpContext.Request.Scheme = DummyScheme;
            defaultHttpContext.Request.Host   = new HostString(DummyHost);

            var fakeIdentity = new GenericIdentity("User");
            var principal    = new GenericPrincipal(fakeIdentity, null);

            A.CallTo(() => defaultHttpContext.User).Returns(principal);

            defaultUrlHelper = A.Fake <IUrlHelper>();
            A.CallTo(() => defaultUrlHelper.Content(A <string> .Ignored)).Returns("DummyUrl");
            A.CallTo(() => defaultUrlHelper.RouteUrl(A <UrlRouteContext> .Ignored)).Returns(DummySitemapUrl);

            defaultTokenRetriever = A.Fake <IBearerTokenRetriever>();
            A.CallTo(() => defaultTokenRetriever.GetToken(A <HttpContext> .Ignored)).Returns("SomeToken");

            defaultApplicationRobotService = A.Fake <IApplicationRobotService>();
            A.CallTo(() => defaultApplicationRobotService.GetAsync(A <ApplicationRobotModel> .Ignored)).Returns("RetrievedValue: SomeValue");

            defaultShellRobotFileService = A.Fake <IShellRobotFileService>();
            A.CallTo(() => defaultShellRobotFileService.GetStaticFileText(A <string> .Ignored)).Returns("{Insertion}");

            defaultController = new RobotController(defaultAppRegistryDataService, defaultLogger, defaultWebHostEnvironment, defaultTokenRetriever, defaultApplicationRobotService, defaultShellRobotFileService, defaultBaseUrlService)
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = defaultHttpContext,
                },
                Url = defaultUrlHelper,
            };
        }
        public FirstTimeSyncViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IBaseUrlService webviewBaseUrl,
            IStoryBoardService storyBoardService)
            : base(navigationService, languageService, svgIconService, webviewBaseUrl)
        {
            _storyBoardService = storyBoardService;

            GoBackCommand   = new RelayCommand(GoBack);
            ContinueCommand = new RelayCommand(Continue);
        }
Example #16
0
 public SitemapController(
     IPathDataService pathDataService,
     ILogger <SitemapController> logger,
     IBearerTokenRetriever bearerTokenRetriever,
     IBaseUrlService baseUrlService,
     IApplicationSitemapService sitemapService)
 {
     this.pathDataService      = pathDataService;
     this.logger               = logger;
     this.bearerTokenRetriever = bearerTokenRetriever;
     this.baseUrlService       = baseUrlService;
     this.sitemapService       = sitemapService;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NoteRepositoryViewModel"/> class.
        /// </summary>
        public NoteRepositoryViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IThemeService themeService,
            IBaseUrlService webviewBaseUrl,
            IStoryBoardService storyBoardService,
            IFeedbackService feedbackService,
            ISettingsService settingsService,
            IEnvironmentService environmentService,
            ICryptoRandomSource randomSource,
            IRepositoryStorageService repositoryService)
            : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl)
        {
            _storyBoardService       = storyBoardService;
            _repositoryService       = repositoryService;
            _feedbackService         = feedbackService;
            _settingsService         = settingsService;
            _environmentService      = environmentService;
            _noteCryptor             = new Cryptor(NoteModel.CryptorPackageName, randomSource);
            _searchableTextConverter = new SearchableHtmlConverter();
            AllNotes      = new List <NoteViewModel>();
            FilteredNotes = new ObservableCollection <NoteViewModel>();

            _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository);
            Model = noteRepository;

            // Initialize commands and events
            ShowNoteCommand           = new RelayCommand <object>(ShowNote);
            NewNoteCommand            = new RelayCommand(NewNote);
            NewChecklistCommand       = new RelayCommand(NewChecklist);
            DeleteNoteCommand         = new RelayCommand <object>(DeleteNote);
            ClearFilterCommand        = new RelayCommand(ClearFilter);
            SynchronizeCommand        = new RelayCommand(Synchronize);
            ShowTransferCodeCommand   = new RelayCommand(ShowTransferCode);
            ShowSettingsCommand       = new RelayCommand(ShowSettings);
            ShowRecycleBinCommand     = new RelayCommand(ShowRecycleBin);
            ShowExportCommand         = new RelayCommand(ShowExport);
            ShowInfoCommand           = new RelayCommand(ShowInfo);
            OpenSafeCommand           = new RelayCommand(OpenSafe);
            CloseSafeCommand          = new RelayCommand(CloseSafe);
            ChangeSafePasswordCommand = new RelayCommand(ChangeSafePassword);

            Modified = false;

            // If a filter was set before e.g. opening a note, set the same filter again.
            if (!string.IsNullOrEmpty(_lastFilter))
            {
                Filter = _lastFilter;
            }
        }
Example #18
0
        public CloudStorageOauthWaitingViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IBaseUrlService webviewBaseUrl,
            IStoryBoardService storyBoardService,
            IFeedbackService feedbackService)
            : base(navigationService, languageService, svgIconService, webviewBaseUrl)
        {
            _storyBoardService = storyBoardService;
            feedbackService.ShowBusyIndicator(true);

            GoBackCommand = new RelayCommand(GoBack);
        }
Example #19
0
 public InfoViewModel(
     INavigationService navigationService,
     ILanguageService languageService,
     ISvgIconService svgIconService,
     IBaseUrlService webviewBaseUrl,
     IVersionService versionService,
     INativeBrowserService nativeBrowserService)
     : base(navigationService, languageService, svgIconService, webviewBaseUrl)
 {
     _versionService       = versionService;
     _nativeBrowserService = nativeBrowserService;
     GoBackCommand         = new RelayCommand(GoBack);
     OpenHomepageCommand   = new RelayCommand(OpenHomepage);
 }
Example #20
0
        public AuthController(IOpenIdConnectClient client, ILogger <AuthController> logger, IOptions <AuthSettings> settings, IVersionedFiles versionedFiles, IConfiguration configuration, IBaseUrlService baseUrlService)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            authClient          = client;
            this.logger         = logger;
            this.settings       = settings.Value;
            this.versionedFiles = versionedFiles;
            this.configuration  = configuration;
            this.baseUrlService = baseUrlService;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StopViewModel"/> class.
 /// </summary>
 public StopViewModel(
     INavigationService navigationService,
     ILanguageService languageService,
     ISvgIconService svgIconService,
     IThemeService themeService,
     IBaseUrlService webviewBaseUrl,
     IRepositoryStorageService repositoryService,
     IFolderPickerService folderPickerService)
     : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl)
 {
     _repositoryService       = repositoryService;
     _folderPickerService     = folderPickerService;
     RecoverRepositoryCommand = new RelayCommand(RecoverRepository);
 }
 /// <summary>
 /// Creates a new DefaultQueryableResourceCollectionDocumentBuilder
 /// </summary>
 public DefaultQueryableResourceCollectionDocumentBuilder(
     IResourceCollectionDocumentBuilder resourceCollectionDocumentBuilder,
     IQueryableEnumerationTransformer enumerationTransformer,
     IQueryableFilteringTransformer filteringTransformer,
     IQueryableSortingTransformer sortingTransformer,
     IQueryablePaginationTransformer paginationTransformer,
     IBaseUrlService baseUrlService)
 {
     _resourceCollectionDocumentBuilder = resourceCollectionDocumentBuilder;
     _enumerationTransformer            = enumerationTransformer;
     _filteringTransformer  = filteringTransformer;
     _sortingTransformer    = sortingTransformer;
     _paginationTransformer = paginationTransformer;
     _baseUrlService        = baseUrlService;
 }
 /// <summary>
 /// Creates a new MappedDocumentMaterializer
 /// </summary>
 protected MappedDocumentMaterializer(
     IQueryableResourceCollectionDocumentBuilder queryableResourceCollectionDocumentBuilder,
     IBaseUrlService baseUrlService,
     ISingleResourceDocumentBuilder singleResourceDocumentBuilder,
     IQueryableEnumerationTransformer queryableEnumerationTransformer,
     ISortExpressionExtractor sortExpressionExtractor,
     IResourceTypeRegistry resourceTypeRegistry)
 {
     _queryableResourceCollectionDocumentBuilder = queryableResourceCollectionDocumentBuilder;
     _baseUrlService = baseUrlService;
     _singleResourceDocumentBuilder   = singleResourceDocumentBuilder;
     _queryableEnumerationTransformer = queryableEnumerationTransformer;
     _sortExpressionExtractor         = sortExpressionExtractor;
     _resourceTypeRegistry            = resourceTypeRegistry;
 }
Example #24
0
 public ApplicationController(
     IMapper <ApplicationModel, PageViewModel> mapper,
     ILogger <ApplicationController> logger,
     IApplicationService applicationService,
     IVersionedFiles versionedFiles,
     IConfiguration configuration,
     IBaseUrlService baseUrlService)
 {
     this.mapper             = mapper;
     this.logger             = logger;
     this.applicationService = applicationService;
     this.versionedFiles     = versionedFiles;
     this.configuration      = configuration;
     this.baseUrlService     = baseUrlService;
 }
Example #25
0
 /// <summary>
 /// Creates a new EntityFrameworkQueryableResourceCollectionDocumentBuilder
 /// </summary>
 public EntityFrameworkQueryableResourceCollectionDocumentBuilder(
     IResourceCollectionDocumentBuilder resourceCollectionDocumentBuilder,
     IQueryableEnumerationTransformer enumerationTransformer,
     IQueryableFilteringTransformer filteringTransformer,
     IQueryableSortingTransformer sortingTransformer,
     IQueryablePaginationTransformer paginationTransformer,
     IBaseUrlService baseUrlService) :
     base(resourceCollectionDocumentBuilder,
          enumerationTransformer,
          filteringTransformer,
          sortingTransformer,
          paginationTransformer,
          baseUrlService)
 {
 }
Example #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewModelBase"/> class.
        /// </summary>
        protected ViewModelBase(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IThemeService themeService,
            IBaseUrlService webviewBaseUrl)
        {
            _navigationService = navigationService;
            Language           = languageService;
            Icon            = svgIconService;
            Theme           = themeService;
            _webviewBaseUrl = webviewBaseUrl;

            HtmlRecource = new HtmlRecourceService();
        }
        public MergeChoiceViewModel(
            INavigationService navigationService,
            ILanguageService languageService,
            ISvgIconService svgIconService,
            IBaseUrlService webviewBaseUrl,
            IStoryBoardService storyBoardService)
            : base(navigationService, languageService, svgIconService, webviewBaseUrl)
        {
            _storyBoardService = storyBoardService;

            UseMergedRepositoryCommand = new RelayCommand(UseMergedRepository);
            UseLocalRepositoryCommand  = new RelayCommand(UseLocalRepository);
            UseCloudRepositoryCommand  = new RelayCommand(UseCloudRepository);
            GoBackCommand = new RelayCommand(GoBack);
            CancelCommand = new RelayCommand(Cancel);
        }
Example #28
0
 /// <summary>
 /// Creates a new EntityFrameworkDocumentMaterializer
 /// </summary>
 public EntityFrameworkDocumentMaterializer(
     DbContext dbContext,
     IResourceTypeRegistration resourceTypeRegistration,
     IQueryableResourceCollectionDocumentBuilder queryableResourceCollectionDocumentBuilder,
     ISingleResourceDocumentBuilder singleResourceDocumentBuilder,
     IEntityFrameworkResourceObjectMaterializer entityFrameworkResourceObjectMaterializer,
     ISortExpressionExtractor sortExpressionExtractor,
     IBaseUrlService baseUrlService)
 {
     _dbContext = dbContext;
     _resourceTypeRegistration = resourceTypeRegistration;
     _queryableResourceCollectionDocumentBuilder = queryableResourceCollectionDocumentBuilder;
     _singleResourceDocumentBuilder             = singleResourceDocumentBuilder;
     _entityFrameworkResourceObjectMaterializer = entityFrameworkResourceObjectMaterializer;
     _sortExpressionExtractor = sortExpressionExtractor;
     _baseUrlService          = baseUrlService;
 }
Example #29
0
 public RobotController(
     IAppRegistryDataService appRegistryDataService,
     ILogger <RobotController> logger,
     IWebHostEnvironment webHostEnvironment,
     IBearerTokenRetriever bearerTokenRetriever,
     IApplicationRobotService applicationRobotService,
     IShellRobotFileService shellRobotFileService,
     IBaseUrlService baseUrlService)
 {
     this.appRegistryDataService = appRegistryDataService;
     this.logger                  = logger;
     this.webHostEnvironment      = webHostEnvironment;
     this.bearerTokenRetriever    = bearerTokenRetriever;
     this.applicationRobotService = applicationRobotService;
     this.shellRobotFileService   = shellRobotFileService;
     this.baseUrlService          = baseUrlService;
 }
Example #30
0
 public HttpService(
     IHttpConfigOptions configOptions,
     IServiceProvider serviceProvider,
     IBaseUrlService baseUrlService,
     ITokenService tokenService
     )
 {
     baseUrl = baseUrlService.Uri.ToString();
     client  = new HttpClient()
     {
         BaseAddress = new Uri(baseUrl)
     };
     setCommonHeader(client);
     this.configOptions   = configOptions;
     this.serviceProvider = serviceProvider;
     this.tokenService    = tokenService;
 }
        /// <summary>
        /// Creates a new FallbackDocumentBuilder
        /// </summary>
        public FallbackDocumentBuilder(ISingleResourceDocumentBuilder singleResourceDocumentBuilder,
            IQueryableResourceCollectionDocumentBuilder queryableResourceCollectionDocumentBuilder,
            IResourceCollectionDocumentBuilder resourceCollectionDocumentBuilder,
            IBaseUrlService baseUrlService)
        {
            _singleResourceDocumentBuilder = singleResourceDocumentBuilder;
            _queryableResourceCollectionDocumentBuilder = queryableResourceCollectionDocumentBuilder;
            _resourceCollectionDocumentBuilder = resourceCollectionDocumentBuilder;
            _baseUrlService = baseUrlService;

            _openBuildDocumentFromQueryableMethod =
                new Lazy<MethodInfo>(
                    () => _queryableResourceCollectionDocumentBuilder.GetType()
                        .GetMethod("BuildDocument", BindingFlags.Instance | BindingFlags.Public));

            _openBuildDocumentFromEnumerableMethod =
                new Lazy<MethodInfo>(
                    () => _resourceCollectionDocumentBuilder.GetType()
                        .GetMethod("BuildDocument", BindingFlags.Instance | BindingFlags.Public));
        }